Symbols as parameters?

MRAB python at mrabarnett.plus.com
Fri Jan 22 03:42:55 CET 2010


Steven D'Aprano wrote:
[snip]
> An example from the standard library: the re module defines constants I, 
> L, M, etc. representing flags that are passed to the re.compile. They are 
> implemented as integers so they can easily be combined with &, but 
> another implementation might use symbols. You will notice that they're 
> not limited to the re.compile function itself.
> 
> The caller may very well want to do something like this:
> 
> # Get some flags for compile:
> flags = re.I & re.M
[snip]

That should be:

     flags = re.I | re.M

of course. :-)




More information about the Python-list mailing list