On 12-Jan-2007, at 19:01 , Guido van Rossum wrote:
On 1/12/07, A.M. Kuchling <[EMAIL PROTECTED]> wrote:Many types in Python are idempotent, so that int(1) works as expected, float(2.34)==2.34, ''.join('hello')=='hello' et cetera.I'm not sure I understand the use case; I don't believe I've ever felt the need for this.
I have oodles of routines of the form def foo(thefile): if type(thefile) == str: thefile = open(thefile) or if not hasattr(thefile, 'read'): thefile = open(thefile) or something similar.
We should also consider the semantics in more detail. Should the seek position be shared between the two objects? What about buffering?
That's definitely the hard part. But it's somewhat similar to "normal" mutable objects which are (I think always, right?) shallow copied when used in a constructor.
-- Jack Jansen, <[EMAIL PROTECTED]>, http://www.cwi.nl/~jackIf I can't dance I don't want to be part of your revolution -- Emma Goldman
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com