Fredrik Lundh wrote: > christian wrote: > > >>>I usually mention "import" in the first hour (before methods), >>>and nobody has ever had any problem with that... >> >>Well, same here, but that might change, since the string >>module is nearly obsolete. You can show reasonably >>powerful stuff(*) without a single import. >> >>(*) and that's what you need to get people interested. > > > I usually start out with something web-oriented (which means > urllib). how about adding a "get" method to strings? or an "L" > prefix character that causes Python to wrap it up in a simple > URL container: > > print url"http://www.python.org".read() *puke* > but in practice, if you really want people to get interested, > make sure you have a domain-specific library installed on the > training machines. why care about string fiddling when your > second python program (after print "hello world") can be: Yes, I know. I didn't want to make a point, just to point out that it is possible to show neat stuff without import. Sure, the next thing I show is COM stuff or formatted stock market reports, using urllib, xml... -- no point. --- the rest below is not to Fredrik but the whole thread --- I'd like to express my opinion at this place (which is as good as any other place in such a much-too-fast growing thread): The following statements are ordered by increasing hate. 1 - I do hate the idea of introducing a "$" sign at all. 2 - giving "$" special meaning in strings via a module 3 - doing it as a builtin function 4 - allowing it to address local/global variables Version 4 as worst comes visually quite close to languages like Perl. In another post, Guido answered such objection with "grow up". While my emotional reaction would be to reply with "wake up!", I have some rationale reasons why I don't like this: I have to read and sometimes write lots of Perl code. The massive use of "$" gives me true headache. I don't want Python to remind me of headaches. One argument was that "$" and the unembraced usage in "$name" is so common and therefore easy to sell to Python newbies. Fine, but no reason to adopt this overly abused character. Instead, I'm happy that exactly "$" is nowhere used in formatting. I don't want to make Python similar to something, but to keep it different in this aspect. Like the triple quotes, the percent formatting exists rather seldom in other languages, and I love to use templates for makefiles, scripts and whatsoever, where I don't have to care too much about escaping the escapes. With an upcoming "$" feature, I fear that "%" might get abandoned in some future, and I loose this benefit. I agree with any sensible extension/refinement of the "%" sign. I disagree on using "$" for anything frequent in Python. I don't want to see variable names as placeholder inside of strings. Placeholders should be dictionary string keys, but this dictionary must be obtained explicitly. I do like the allvars() proposal. crap-py -ly - chris -- Christian Tismer :^) <mailto:tismer@tismer.com> Mission Impossible 5oftware : Have a break! Take a ride on Python's Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/ 14109 Berlin : PGP key -> http://wwwkeys.pgp.net/ work +49 30 89 09 53 34 home +49 30 802 86 56 pager +49 173 24 18 776 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4