[Baypiggies] hidden features of Python (stackoverflow)
Stephen Lacy
slacy at slacy.com
Wed Jul 14 19:15:21 CEST 2010
On Wed, Jul 14, 2010 at 9:49 AM, <akleider at sonic.net> wrote:
>
>
> .. another suggestion for a 'Newbie Nugget'
>
> What's happening here:
>
>
> > Python> from __future__ import braces
> > File "<stdin>", line 1
> > SyntaxError: not a chance
>
> i.e. how is this coded and perhaps a bit of history as to by whom and any
> other background. There's got to be an amusing story to go along with
> this.
>
Just looked at the source to see how this message is generated. Thought it
would be in __future__.py, but it isn't. There's some hacky code in
future.c that says:
} else if (strcmp(feature, "braces") == 0) {
PyErr_SetString(PyExc_SyntaxError,
"not a chance");
PyErr_SyntaxLocation(filename, s->lineno);
return 0;
} else {
No interesting comments there or anything. I think this was just a cute
addition, and not really something with a "history". :)
Steve
>
>
>
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20100714/d3b7f67b/attachment.html>
More information about the Baypiggies
mailing list