PEP 312 (and thus 308) implemented with a black magic trick

Michele Simionato mis6 at pitt.edu
Tue Mar 18 09:56:46 EST 2003


"Sean Ross" <sross at connectmail.carleton.ca> wrote in message news:<GLuda.3364$544.325182 at news20.bellglobal.com>...
> Hi.
> 
> "Erik Max Francis" <max at alcyone.com> wrote in message
> news:3E766255.5D06489A at alcyone.com...
> >
> > How does this suggestion different from the use of a single colon in PEP
> 312, ...
> 
> 
> Actually, it wasn't a suggestion, it was merely a hack. The OP was just
> trying to see if it could be done,
> as they stated in their post...
> 
> "Michele Simionato" <mis6 at pitt.edu> wrote...
> > I am not suggesting it. This is simply a proof of concept.
> 
> They were not suggesting an alternative syntax to PEP312, they were playing
> around with code.
> '~' just happens to be easier than ':' to intelligently isolate and replace
> in Python code because it
> has fewer possible uses/meanings.
> 

Beside that, there is the problem that ":x" is not a valid Python
expression,
whereas "~x" is grammatically correct. Using ":x" would give a syntax
error,
using "~x" makes happy the interpreter, instead. At this point my
truly evil metaclass can fool it ;)

continuing-to-explore-Python-dark-side-ly yours,

                                                          Michele




More information about the Python-list mailing list