Re: If the string module is deprecated...
From: Alex Martelli (aleaxit_at_yahoo.com)
Date: 08/30/04
- Next message: Ian Boisvert: "PyInstance_New in C++ class factory"
- Previous message: Alex Martelli: "Re: Generator expressions v/s list comprehensions"
- In reply to: Paul McGuire: "If the string module is deprecated..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 30 Aug 2004 09:05:13 +0200
Paul McGuire <ptmcg@austin.rr._bogus_.com> wrote:
> ... what will become of the module-level constants, such as uppercase,
> digits, hexdigits, etc.? Will they become class-level constants of the str
> class?
That would seem the most natural solution, yes. Taking advantage of
that change, it might be good to have in classes str (and unicode) only
real constants, independent of locale, and move locale-dependent stuff
to module locale. Other related issues were debated in the relatively
recent past on python-dev -- e.g., if we have str.digits, how do we
discourage beginners from (most likely incorrectly) testing 'if c in
str.digits' where they should be coding 'if c.isdigit()' instead? Or do
we? Or should we perhaps make str.digits (&c) instances of a funky
black-magic subclass of str with a __contains__ method whose semantics
are quite different from str's own implementation of that method? It is
definitely true that beginners just love coding tests such as 'if c in
str.digits' &c... they're doing so in droves today with string.digits...
I don't recall a consensus being reached, which may be why nothing much
has happened yet on this score.
Alex
- Next message: Ian Boisvert: "PyInstance_New in C++ class factory"
- Previous message: Alex Martelli: "Re: Generator expressions v/s list comprehensions"
- In reply to: Paul McGuire: "If the string module is deprecated..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|