[IronPython] Duck typing / builders
dinov at exchange.microsoft.com
Wed Dec 13 21:38:14 CET 2006
Yes, IronPython is completely duck typed, but I'm not certain how your x.bar & x.foo ties into that.
It almost sounds like you want foo and bar to be properties. You can do that with:
print "I've been called"
print "Me too!"
a = baz()
which will print "Me too!" and return 23. You can then also do anything with this object from there, eg:
a.xyz = 23
Traditionally duck typing refers to "if it looks like a duck, and quacks like a duck, it's a duck". That's more like:
print 'inflating balloon'
Both call the blowup method disregarding the fact that blowing up a ballon and blowing up a bomb are two rather different concepts - but they both look like the same duck.
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Hamilton Verissimo
Sent: Wednesday, December 13, 2006 11:19 AM
To: users at lists.ironpython.com
Subject: [IronPython] Duck typing / builders
Does IronPython support any form of duck typing? Ideally I want somethign like
And record this invocations to generate, well, other things.
hammett at castlestronghold.com
users mailing list
users at lists.ironpython.com
More information about the Ironpython-users