regex scanner question
mwh at python.net
Wed Jun 27 15:14:15 CEST 2001
Roman Suzi <rnd at onego.ru> writes:
> (After the PEP 260 I am not sure I can use anything less common
> than things with established use practice... So I better ask.)
Well, PEP 260 isn't accepted yet, but it's probably sensible in
general to avoid using undocumented functions...
> I've found SRE_Scanner object which gets birth from scanner()
> method of SRE_Pattern object.
... as here. It's my understanding that these features are
experimental, possibly buggy and certainly not documented.
OTOH, if you (or anyone else) think they're useful, can get them to
work and (especially) write some docs, there's every chance thay will
become a standard feature.
> Is it standard Python feature I could safely use or will it be dropped
> soon as it happened to xrange as a sequence type?
It might get binned if noone makes use of it. But if there's a move
to get rid of it, I'm sure it would be preceded by a "is anyone using
> Could use of .scanner be recommended or not recommended?
If it solves your problem, I'd recommend it. They're not going to go
away before 2.2, you can be sure <wink>.
> BTW, generators could be very useful if applied inside regex routines.
> They will make it easy to hop from ane finding to another without taking
> too much memory.
Well, yes. I don't think I'd put something like "penchant for anal
play" and "able to wield a buttplug" in a CV unless it was relevant
to the gig being applied for...
-- Matt McLeod, alt.sysadmin.recovery
More information about the Python-list