On Dec 18, 2008, at 11:03 AM, Paul McNett wrote:
> Wow, I can't believe they implemented it as magically as that.
Is this magical?
tuple([4, 5, 6])
Here's another custom class:
class Foo(tuple):
def dummy(self):
print "dummy output"
x = Foo([1, 3, 5])
print x
-> (1, 3, 5)
print x.dummy()
-> 'dummy output'
The problem is that because we need code to customize the class at
__init__(), we have to provide the parameter. It doesn't matter what
we call it; it's just needed to make the call work. The Foo class
above doesn't do any __init__() stuff, so it doesn't need to define
that method, and works like any other tuple.
-- Ed Leafe
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]