Appologies for not being specific. I was really looking forward to the
ability to allow invocations on undeclared methods. I'm not fluent in
python, but I think __call__ is the way to support that, for instance:

class Proxy(object):

  def __call__(self, method, arguments):
    record(method, arguments)

In Ruby I'd use method_missing in a similar fashion.

Thanks

On 12/13/06, Dino Viehland <[EMAIL PROTECTED]> wrote:
> 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:
>
> class baz(object):
>         @property
>         def foo(self):
>                 print "I've been called"
>                 return 42
>         @property
>         def bar(self):
>                 print "Me too!"
>                 return 23
>
> a = baz()
> a.bar
>
> 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:
>
> class balloon(object):
>         def blowup(self):
>                 print 'inflating balloon'
>
> class bomb(object):
>         def blowup(self):
>                 print 'exploding'
>
> def InflateIt(obj):
>         obj.blowup()
>
> InflateIt(bomb())
>         Or
> InflateIt(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.
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hamilton 
> Verissimo
> Sent: Wednesday, December 13, 2006 11:19 AM
> To: [email protected]
> Subject: [IronPython] Duck typing / builders
>
> Does IronPython support any form of duck typing? Ideally I want somethign like
>
> x.foo
> x.bar
>
> And record this invocations to generate, well, other things.
>
> Thanks
>
> --
> Cheers,
> hamilton verissimo
> [EMAIL PROTECTED]
> http://www.castlestronghold.com/
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>


-- 
Cheers,
hamilton verissimo
[EMAIL PROTECTED]
http://www.castlestronghold.com/
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to