. Python 2.1 function attributes

Moshe Zadka moshez at zadka.site.co.il
Sat Jan 27 13:46:22 EST 2001


[I wrote]
> try:
> 	print foo, bar
> finally:
> 	sys.stdout = sys.__stdout__
 
[Roy Katz] 
> what is wrong with redirection? must we wrap the output in a try:
> anymore than wrap a standard print in a try:?

Because if the print raises an exception, I want the stdout to be
the old one.

[Moshe Zadka]
> print >>sys.stderr foo, bar
> 
> Is obvious, simple and easy to understand.

[Roy Katz]
> Perhaps simple, but to me it looks like it has the potential to be
> ambiguating.

Huh? What else *could* it mean?

>  If we have print>>file,  why not print>>obj (if not already
> so);

print >>obj, something

Prints ``something'' to obj. Any file-like object would do. Just the
same as almost anywhere in Python.

> if we already have print>>obj, why not extend it to
> statement>>obj

Which would do?
Besides, it would be ambigous, since expressions are statements
in Python.

> Why stop there? if not statement>>obj, why not 
> func>>obj? since obj's can implement __call__(self), why
> not obj>>obj?

What has any of it got to do with telling "print" to print to some
other file-like object rather then sys.stdout? Your reductio ad absordum
has no logical basis.

> I'm only interested in why it happened at all, and how to prevent it from
> screwing up our language further :)

But Guido has been wanting all this to happen sooner -- he just did not
have the man power.

> Let's see it! petition! vote! who wants and who doesn't?  No more of this
> of this 'Benevolent Dictator' or 'Hey I've got a patch' garbage.  *vote*
> and make Python not the patcher's language, not my language, and not
> yours, but *our* language.

Why would anyone care about votes? If you have a rational argument, let's
hear it. And if you think the Python development doesn't listen to your
logical arguments, then you're welcome to take Python and develop it in
a direction that suits you -- the license is quite liberal.

> Let's add bless().  I want to change the class of an object at
> runtime.

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?

> all this when real issues like typing and making int's first-class objects
> falls to the wayside. 

You're welcome to contribute patches.
http://sourceforge.net/projects/python/ -> Patches
-- 
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