[IronPython] Method invocation when assigned to instancediffers from default assignment?

drew moore drew at astro.pas.rochester.edu
Sun Feb 18 17:24:54 CET 2007


Erzengel des Lichtes wrote:
>  
>
> -----Original Message-----
> From: users-bounces at lists.ironpython.com
> [mailto:users-bounces at lists.ironpython.com] On Behalf Of drew moore
> Sent: Saturday, February 17, 2007 1:07 PM
> To: Discussion of IronPython
> Subject: Re: [IronPython] Method invocation when assigned to instancediffers
> from default assignment?
>
> Your question might not seem so silly (sorry) if we can see the problem you
> are trying to solve.
>
> --Reply--
> I'm not actually trying to solve a problem, just understand a behavior.
>   
Wow! you're not the typical Python newbie!
I don't know much about Fibers and Interruptible IronPython, but it 
sounds very interesting.

Here's a simple scenario I can think of where instances might have 
callable attributes that don't need (or want) self automatically put in 
as the first argument::

class Logger(object) :
    def __init__(self, writer=None) :
        if writer == None :
            import sys
            self.writer = sys.stdout
        else:
            self.writer = writer
    def Log(self, message) :
        self.writer(message)

cheers

Drew



More information about the Ironpython-users mailing list