On Thu, 09 May 2013 23:09:55 -0400, Roy Smith wrote: > In article <[email protected]>, > Steven D'Aprano <[email protected]> wrote: > >> I must admit I am astonished at how controversial the opinion "if your >> object is useless until you call 'start', you should automatically call >> 'start' when the object is created" has turned out to be. > > I'm sorry. I thought you were here for an argument.
No, I'm here for the abuse. > I think where things went pear shaped is when you made the statement: > >>> There is no sensible use-case for creating a file OBJECT unless it >>> initially wraps an open file pointer. > > That's a pretty absolute point of view. Life is rarely so absolute. So far the only counter-examples given aren't counter-examples. One involves opening the file. The other involves something which isn't a file, but a string instead. If there are any counter-examples, they are impossible in Python and C: you cannot create a file object in Python without opening it, and you cannot create a file descriptor in C without opening it. But not in Pascal, which actually supports my claim that this is an anti-pattern: while some Pascal implementations do allow you to create a non-open file, you cannot do *anything* with it until you open it, except generate bugs. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
