Symbols as parameters?
python at mrabarnett.plus.com
Fri Jan 22 03:42:55 CET 2010
Steven D'Aprano wrote:
> 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
That should be:
flags = re.I | re.M
of course. :-)
More information about the Python-list