. Python 2.1 function attributes

Moshe Zadka moshez at zadka.site.co.il
Tue Jan 30 02:29:39 EST 2001


[Roy Katz]
> Let's add bless().  I want to change the class of an object at
> runtime.
> 
[ Moshe Zadka <moshez at zadka.site.co.il> ]
> You can already do this, and have been able to a long time.
> 
> foo.__class__ = new_class
> 
> Why would anyone want a new builtin for that?

[Sune Kirkeby]
> Why would anyone want the syntactic (sp?) sugar that "print >>" is?
> 
> Probably because it's both simpler to use and easier to understand.
> 
> I would think you would understand that  ;-)

Hardly:

bless(foo, new_class) vs. foo.__class__ = new_class for an operation
that I doubt  10% of Pythoneers do, vs.

print >>sys.stderr, "danger will robinson! number", n

(How many Python programmers preferred to write to stdout that warning
because print was too conveinient? You'll never know...)

I was originally against print>>, but the rather weak arguments people
manage to come up to denounce it (with the exception of Alex, who reported
a use case) have turned me about...
- 
Moshe Zadka <sig at zadka.site.co.il>
This is a signature anti-virus. 
Please stop the spread of signature viruses!
Fingerprint: 4BD1 7705 EEC0 260A 7F21  4817 C7FC A636 46D0 1BD6




More information about the Python-list mailing list