Code Bucket …

Python first-class classes for Koden

You can visit http://www.the-barn.org/codebucket.php?id=76 to view this snippet directly.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
class Foo(object):
  """ Here's a class that prints it's constructor parameter when instantiated. """
  def __init__(self, param):
    print "You made a new foo with param: ", param

def make_instance(class_, param):
  """ This is a method that instantiates a new instance of 'class_' with a single parameter. """
  return class_(param)

x = make_instance(Foo, 'bobobobo')
print x
  • Posted on 04.07.2010 at 8:19 AM by stoffle
  • Language: Python

Snippets

 
36 Results
Page 1 of 3
TitleLanguagePosted ByPostedExpiresActions
Python first-class classes for KodenPythonstoffle04.07.2010 8:19 AM (64 days 3h 12m ago)-view
mLAN Activation ScriptPlain Textstoffle23.06.2010 6:42 AM (75 days 4h 49m ago)-view
areaC#stoffle27.02.2010 3:51 AM (191 days 8h 40m ago)-view
list extensionsC#stoffle09.02.2010 11:12 PM (208 days 13h 19m ago)-view
possible IComponent intererface version 95C#stoffle09.02.2010 11:04 PM (208 days 13h 27m ago)-view
Render SystemC++spam05.06.2009 12:14 PM (457 days 23h 17m ago)-view
Effect SampleC++spam03.06.2009 2:40 PM (459 days 20h 51m ago)-view
Rho LambdasC++spam03.06.2009 2:38 PM (459 days 20h 53m ago)-view
Example VSM implC++spam02.06.2009 1:21 PM (460 days 22h 10m ago)-view
Vector3 Interface (public)C++kalin11.02.2008 9:53 PM (937 days 14h 38m ago)-view
TimesTablesC++kalin09.02.2008 6:04 PM (939 days 18h 27m ago)-view
Skruje Account Search PagePHPstoffle03.02.2008 5:12 PM (945 days 19h 19m ago)-view
C++ is still bork...C++spam26.01.2008 5:58 PM (953 days 18h 33m ago)-view
C++ is bork #3C++spam26.01.2008 5:47 PM (953 days 18h 44m ago)-view
C++ is bork #2C++spam26.01.2008 5:46 PM (953 days 18h 45m ago)-view
36 Results
Page 1 of 3