re.NONE

John Machin sjmachin at lexicon.net
Wed Jun 24 03:48:41 EDT 2009


On Jun 24, 5:18 pm, John Machin <sjmac... at lexicon.net> wrote:
> On Jun 23, 8:35 am, 1x7y2z9 <1x7y... at gmail.com> wrote:
>
> > I am currently using python v2.5.2.
>
> > Not sure if this is defined in a later version, but it would be nice
> > to define re.NONE = 0 in the re module.  This would be useful in cases
> > such as:
> > flags = re.DOTALL if dotall else re.NONE
>
> > Also useful for "building up" flags by ORing with other flags.
>
> -1
>
> 0 is even more useful. YAGNI.
>
> BTW everybody try typing NONE a few times fast ... if your fingers
> don't fight your brain and produce None anyway, you haven't been using
> Python long enough :-)

Oh and I forgot to mention that if this proposal goes ahead it will
need a one-letter version -- perhaps re.Z -- and maybe even a PEP. It
could end up rivalling the legendary IEFBR14 in the ratio-of-overhead-
to-functionality stakes.



More information about the Python-list mailing list