Trying to print from inside a method

Alex Martelli aleax at mac.com
Sun Mar 18 20:41:51 EDT 2007


<AWasilenko at gmail.com> wrote:
   ...
> > This would be pretty weird, but legal Python.
> > Weirder and weirder, but still legal Python.
> 
> This is usually how most of my code turns out :(  I'm afraid if I ever
> learn enough
> to make a serious program I will be burned at the stake for such un-
> pythonic practices :P

Function attributes are rarely used, because they belong to "the
function object itself", not to any given _call_ to that function, or to
any _method_ that may wrap that function, and so on.  That's what pretty
weird here -- it would not appear that you necessarily want to associate
those attributes with the function object, and yet (if you want them to
access as attributes of the function object) you do of course need to do
that.  Of course, it's somewhat hard to divine "semantic intent of the
programmer" from a totally abstract toy example, so I could be wrong!


Alex





More information about the Python-list mailing list