Obnoxious postings from Google Groups

Roy Smith roy at panix.com
Wed Nov 7 07:04:44 CET 2012

In article <afub8iFbvftU1 at mid.individual.net>,
 Gregory Ewing <greg.ewing at canterbury.ac.nz> wrote:

> Steven D'Aprano wrote:
> > The downside is that if spaces are not argument separators, then you need 
> > something else to be an argument separator. Or you need argument 
> > delimiters. Or strings need to be quoted. Programming languages do these 
> > things because they are designed to be correct. Shell do not because they 
> > are designed for lazy users and merely aim to be "good enough".
> That's overly judgemental. In the environment where shells originated,
> not being able to easily put spaces in file names wasn't considered a
> problem. File names weren't thought of as names in the natural language
> sense, but as identifiers in the programming sense.
> You don't complain that you can't put spaces in identifiers in a
> Python program, do you? No, because that would require all identifiers
> to be quoted somehow, which would drive you crazy. In the same way,
> requiring all filenames to be quoted would drive shell users crazy.

On the other hand, if you *wanted* to put a space in a Python 
identifier, you just can't.  If you want to put a space in a file name 
in the shell, all you need do is put spaces around the name.  Or, if you 
prefer, escape the space with a backslash.

Oh, wait.  This blows my mind...

>>> f = Foo()
>>> setattr(f, "x y", "xyz")
>>> dir(f)
['__doc__', '__module__', 'x y']

I did not expect this to work.  Not quite sure what I've created here.

More information about the Python-list mailing list