At 10:26 AM 9/29/2007 -0500, Michael Urman wrote:
>[Sending direct because this is just a thanks and some idea fodder,
>but feel free to return this to the list]
>
>On 9/29/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote:
> > can both be constants, a simple list.index() test could now raise a
> > TypeError, as could "item in list".
>
>Good point - I keep missing the forest for the trees. This isn't just
>a matter of dicts; any collection type can be susceptible. Thanks for
>this reminder.
>
>I'm torn on your idea of making a read vs readinto separation of
>files. If this works by, e.g., raising IOError on attempt to use the
>wrong one, the use case you proposed will be filtering out a ton of
>expected exceptions, but it's easy to understand the behavior.
>
>If it works by removing the wrong method from the object, then we've
>got two different file-like object types returned from the same
>function based on the value of an argument (but a better LBYL check
>available). Of course since we currently have two different types
>returned from a method based on a value passed to its constructor,
>this may be no worse.
>
>I'm not sure which way makes it easier to add new file-like-objects,
>either; they'll have the same problems.

They'll have the same problems *anyway*.  In fact, having different 
methods will simply force people creating such objects to decide what 
they're really trying to do.

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to