Re: [Python-Dev] deprecating string module?
Skip Montanaro wrote:
It has nothing to do with 11k worth of disk space and everything to do with "there's one (best) way to do it".
Hi! String method's are really nice! (By the way: I miss a length() method) But in some cases the old-school string module yields the more readable code. So the "one (best) way" is not always the clearest to read and understand. I cannot see/understand why it's the "best" way to write for example fromaddr = " ".join(map(lambda x: x[0] , email.Header.decode_header(fromaddr[1]))) with this (IMHO not intuitive empty string " ") instead of fromaddr = string.join(map(lambda x: x[0] , email.Header.decode_header(fromaddr[1]))) It's much cleaner to read and understand with string instead of " " - at least for beginners, or? Tino
I find the big reason for deprecating string has to be the evolution toward methods and away from modules. e.g.:
String method's are really nice! (By the way: I miss a length() method)
Deprecation of string is not confusing for new users of Python, they will start with string methods, having no use for the module. It is not confusing for experienced users, they know what deprecation is, and can probably work through the rationale for moving away from the old module technique and toward the new class/type technique. Somewhere in the middle there might be some people who figured the string module out, but never got a grip on string methods. I don't think this is the majority. The true majority are the "yet to start" users, for whom the String class will be the only thing they ever use; irrespective of the deprecation state of string. ===== -- S. Lott, CCP :-{) S_LOTT@YAHOO.COM http://www.mindspring.com/~slott1 Buccaneer #468: KaDiMa Macintosh user: drinking upstream from the herd. __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
Steven Lott wrote:
The true majority are the "yet to start" users, for whom the String class will be the only thing they ever use; irrespective of the deprecation state of string.
you mean we should burn all existing python books, and start over from scratch? </F>
Yes.
Seriously. As these tools evolve, there is much that
is new and good and much that is old that should be (gracefully)
deprecated for a few years and then retired.
Some modules are interesting only for backward compatibility.
Also, the organization of modules in the LIB manual makes very
little sense to new users. Clearly, this organization evolved
organically with the language, but perhaps it is time to
refactor that module tree.
Reaching back a few decades - I read in my history books that
the Algol 68 effort fragmented into a flame war after the very
successful Algol 60 effort. The flame war lead to three
parallel efforts that eventually gave us Algol 68 (any users?),
PL/1 and Pascal. Which had the biggest user base? I think it
was Pascal, the one that went for the fewest-best features.
(Or possibly it was the French mathematician after whom it was
named, hard to say for sure.)
I do not suggest that Python usage will fragment; rather I
suggest that a focus on a few important features is the most
beneficial.
--- Fredrik Lundh
Steven Lott wrote:
The true majority are the "yet to start" users, for whom the String class will be the only thing they ever use; irrespective of the deprecation state of string.
you mean we should burn all existing python books, and start over from scratch?
</F>
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev
===== -- S. Lott, CCP :-{) S_LOTT@YAHOO.COM http://www.mindspring.com/~slott1 Buccaneer #468: KaDiMa Macintosh user: drinking upstream from the herd. __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
On Wednesday 29 May 2002 03:05 pm, Steven Lott wrote: ...
parallel efforts that eventually gave us Algol 68 (any users?), PL/1 and Pascal. Which had the biggest user base? I think it was Pascal, the one that went for the fewest-best features.
(Or possibly it was the French mathematician after whom it was named, hard to say for sure.)
As the small user bases (compared to their merits) of Haskell and Eiffel show, naming languages after either mathematicians OR Frenchmen is no guarantee of big user bases. Maybe you do need both. I guess we could try inventing a language named "Cauchy" or "Fermat" to double-check. Alex
On Wednesday 29 May 2002 02:35 pm, Fredrik Lundh wrote:
Steven Lott wrote:
The true majority are the "yet to start" users, for whom the String class will be the only thing they ever use; irrespective of the deprecation state of string.
you mean we should burn all existing python books, and start over from scratch?
All author of Python books should heartily second this recommendation -- unless the book is right in the sweet spot of its lifecycle curve, where it's selling well without needing any edits and updates, of course (so, please let's do it AT ONCE, before the Cookbook and Nutshell come out, or better wait a hopefully long while for their sales to get on a downward slope). After all, in terms of editing work, moving any reference to the string module to an appendix on "old deprecated stuff that you only need to know when migrating old code to new Python releases" is pretty modest, and yet it will let us make "new importantly updated editions" and sell a bunch more to suck^H^H^H^H discerning book buyers who _know_ they must always have fully updated tomes. Then when THAT sales boost has died down, we can make another killing by introducing, say, a boolean type with two constants True and False that act just about the same as 1 and 0 but also let us make another crucially updated edition (with a gain in readability for our prose, too). Hmmm, maybe _this_ one is a bit too obvious as a ploy to sell new updated editions. But I'm sure we can come up with something. Seriously for a sec: I'd _love_ not to have to explain why most but not all string methods are ALSO in a string module without making it sound as if Python's so encrusted with "needless but backwards-compatible cruft" to make it a match for C++ -- which it isn't, by a long shot, but that ain't easy to communicate. On the other hand, using False and True in explanations instead of 0 and 1 _does_ enhance prose readability -- interesting side effect I guess:-). I'd just love it if old cruft could be removed, but each time that is mooted, there's an uproar. So I guess we just have to live with a slow accumulation of "more than one way to do it" (at least until the mythical will-never-come backwards-incompatible Python 3000, of course) despite the obvious costs (each time two coders get used to different idioms for the same task, they will have a slightly harder time maintaining each other's code). The costs always look small (for each single issue -- there are many small things...), and are spread over time; the benefits always appear more obvious (don't break MY code, let me keep some backwards compatibility with 1.5.2, let me keep my own habits...) and immediate. So, no matter what the actual value of the cruft-removing proposal might be, the uproar against it is inevitably loud, and cruft stays and keeps piling up. Languages always grow, never shrink. I love it when Python manages to do otherwise once in a while (e.g., xrange's cleanup), but I doubt it can happen often enough to make a difference. Oh well. Alex
"SL" == Steven Lott
writes:
SL> The true majority are the "yet to start" users, for whom the SL> String class will be the only thing they ever use; SL> irrespective of the deprecation state of string. Remember that there's a lot more of them ("yet to start" users) than there are of us ("dinosaurs" :).
"TL" == Tino Lange
writes:
TL> I cannot see/understand why it's the "best" way to write for TL> example | fromaddr = " ".join(map(lambda x: x[0] , | email.Header.decode_header(fromaddr[1]))) TL> with this (IMHO not intuitive empty string " ") instead of | fromaddr = string.join(map(lambda x: x[0] , | email.Header.decode_header(fromaddr[1]))) TL> It's much cleaner to read and understand with string instead TL> of " " - at least for beginners, or? We've been down this road so many times it hurts. I kind of suspect that it's secretly string.join() keeping the string module alive more than anything else <wink>. Personally, I really like ''.join() -- which I spell EMPTYSTRING.join() -- but then I like Rush, uni, and Uncle Timmy's Farm Report. All are acquired tastes. So let's write that join() builtin and be done with it!
"PF" == Peter Funk
writes:
PF> In my opponion the string module is one such situation and PF> another one is the '<>' operator. Most of my employees work PF> with Modula-2 a lot and we have a huge code base. So they PF> prefer to use '<>' over '!=' in Python also and they will not PF> stop to do so, although the use of '<>' is discouraged in the PF> Python documentation. The one difference is that <> is favored by some people close to Guido's heart. He'd never piss off his brother or his sysadmin. :) -Barry
The one difference is that <> is favored by some people close to Guido's heart. He'd never piss off his brother or his sysadmin. :)
But in Python 3, only != will be supported. Fortunately, it's a simple mechanical translation to fix this. --Guido van Rossum (home page: http://www.python.org/~guido/)
Premise 1:
The one difference is that <> is favored by some people close to Guido's heart. He'd never piss off his brother or his sysadmin. :)
Premise 2:
But in Python 3, only != will be supported.
Conclusion: Python 3 will never happen. Humph!
On Wed, May 29, 2002 at 11:16:55AM -0400, Raymond Hettinger wrote:
Premise 1:
The one difference is that <> is favored by some people close to Guido's heart. He'd never piss off his brother or his sysadmin. :)
Premise 2:
But in Python 3, only != will be supported.
Conclusion: Python 3 will never happen.
Agree :) I don't understand what is wrong with <> syntax. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
Agree :) I don't understand what is wrong with <> syntax.
It's cumbersome to have to support two different spellings for no good reason. (It's different for "..." and '...' strings, where there's a good reason to have both, namely embedding the other type of quote.) Even people who are used to <> can learn to type !=. --Guido van Rossum (home page: http://www.python.org/~guido/)
On Wed, May 29, 2002 at 11:28:02AM -0400, Guido van Rossum wrote:
Even people who are used to <> can learn to type !=.
Then why not the other way? :) Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
Hi, Guido van Rossum:
Agree :) I don't understand what is wrong with <> syntax.
It's cumbersome to have to support two different spellings for no good reason. (It's different for "..." and '...' strings, where there's a good reason to have both, namely embedding the other type of quote.)
People want keep both. I believe this is a very good reason to keep both. Since it was there for over a decade, I can't see anything "cumbersome".
Even people who are used to <> can learn to type !=.
Of course. But people don't want to change their habits. On Oct 20th, 1991 you decided to put '!=' in as an alternative to '<>'. I guess you did this to please people coming from C to feel more familar and to attract them to Python. That was fine. Using <> mixed != together didn't hurt readability much during the past decade. After all Python is still a very clean language and what lately was called "piled cruft" here in python-dev is largely overestimated. The complexity introduced by the deprecation warning stuff just to deal with future feature removal stuff can also be seen as "cruft" or "bloat" on its own: nnorwitz just fixed a >>> dir(__builtin__) screen shot in the Python tutorial to add 'PendingDeprecationWarning' there. I always tend to mispell this as depreciation... Is it really good PR for Python to point new users noses in the Tutorial to anything they learn may pend to deprecation? These deprecation warnings seem to fullfill one main purpose: to have some lame excuse, that when some dump user installs a new Python version somewhere and breaks a system deployed 4 years ago, that wasn't updated since than. In the industry people tend to run systems a lot longer than two, three or four of your releases cycles. Regards, Peter -- Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260 office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen, Germany)
From: "Peter Funk"
nnorwitz just fixed a >>> dir(__builtin__) screen shot in the Python tutorial to add 'PendingDeprecationWarning' there.
I built a patch to fill the tp_iter slot for lists. Right away, the regression test test_descrtut.py failed because __iter__ showed up on the dir(list) example. I think everytime we use a dir() example in the docs or in the testsuite, we're creating unnecessary dependencies. It's not a big deal, but if the example or test can make its point without the dir(), it would lower the PITA factor. Raymond Hettinger
I think everytime we use a dir() example in the docs or in the testsuite, we're creating unnecessary dependencies.
It's not a big deal, but if the example or test can make its point without the dir(), it would lower the PITA factor.
+1 --Guido van Rossum (home page: http://www.python.org/~guido/)
"RH" == Raymond Hettinger
writes:
RH> Python 3 will never happen. Oh, I'm sure it will happen one day, but it'll be cool 'cause I'll be in retirement touring the country in my Mr. Neutron powered DeLorean, and my hack-pr0n-drinkmountaindew clone will get to do the upgrade! -Barry
participants (9)
-
Alex Martelli
-
barry@zope.com
-
Fredrik Lundh
-
Guido van Rossum
-
Oleg Broytmann
-
pf@artcom-gmbh.de
-
Raymond Hettinger
-
Steven Lott
-
Tino Lange