473,383 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

If the string module is deprecated...

.... what will become of the module-level constants, such as uppercase,
digits, hexdigits, etc.? Will they become class-level constants of the str
class?

-- Paul
Jul 18 '05 #1
2 1763
"Paul McGuire" <pt***@austin.rr._bogus_.com> writes:
... what will become of the module-level constants, such as uppercase,
digits, hexdigits, etc.? Will they become class-level constants of the str
class?


I don't see why not.

One design decision I don't understand, though (which doesn't crop up
in the particular cases you list above):

staticmethods can be invoked through a class instance:
class Foo: .... @staticmethod
.... def bar():
.... print 'bar'
.... f = Foo()
f.bar() bar


This is the issue that turned list.sorted() into builtin sorted() in
2.4 -- people would get confused expecting that [3,2,1].sorted() to
return [1,2,3], rather than raise TypeError.

Seems there is some disagreement amongst language desingers on whether
polymorphism is a good thing in static methods.
John
Jul 18 '05 #2
Paul McGuire <pt***@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
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rob McCrea | last post by:
Hi all, On windows98SE, running Python 2.3.4 (#53, May 25 2004, 21:17:02) on win32, the built-in help() function gives me a deprecation warning when used on my docstrings. just help() start...
8
by: jlowery | last post by:
I'm looking through the tools/scripts folder from the python install, trying to get reacquanted with the language. Got a question on the following classfix.py snippet: # This expression doesn't...
5
by: chris_doran | last post by:
/COMMENT has been removed from the linker that comes with VS2005, and use in source code of: #pragma comment(exestr, "this is a string") gives the message: warning LNK4224: /COMMENT is no...
12
by: Anoop | last post by:
Hi All Can any one help me out with the various depricated string functions that is followed in Python. For example how will be string.lower depricated. As far as string.lower('PYTHON') is...
3
by: Hitesh | last post by:
Hi, In python doc -- 4.1.4 Deprecated string functions -- I read that "The following list of functions are also defined as methods of string and Unicode objects; see ``String Methods'' (section...
4
by: Anoop | last post by:
Hi All, I am getting the following error while trying to use deprecation Please help 'a.b.mpilgrim.z' Traceback (most recent call last): File "<interactive input>", line 1, in ?...
2
bartonc
by: bartonc | last post by:
>>> import string >>> help(string) Help on module string: NAME string - A collection of string operations (most are no longer used). FILE d:\python25\lib\string.py
11
by: Johny | last post by:
Is there a good way how to use string.find function to find a substring if I need to you case insensitive substring? Thanks for reply LL
4
by: John K Masters | last post by:
>From what I have read the string module is obsolete and should not be used but I am working on a project that parses printable files created in a DOS program and creates a web page for each file....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.