orrectly as
it is. Leave it to the experts and use a library.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
g the relative resume to me. I hope of to have made what appreciate
postando this announcement. In contrary case, I make excuses myself for the
disturbance.
Salutes,
Giandomenico Sica
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.pyt
won't work</EM>")
In JavaScript, this code can be expressed legally by hiding the ETAGO
delimiter before an SGML name start character:
document.write ("<EM>This will work<\/EM>")
Guess you learn something new every day. Too bad the
is
> redundant since I think find searches breadth-first by default.
??? maxdepth determines how deep the search will look, not the order the
search occurs. Your search only find things within 3 levels of the root,
unless your directory tree goes no deeper than that (very unlikely) the
maxdep
Ten wrote:
> Sorry for the rant, good luck to the guy if he's solved his problem,
> but damn, that "90% so let's not bother doing things properly" stuff makes
> my blood boil.
You must really hate browsing the web then. :)
--
Edward Elliott
UC Berkeley School of La
Flash. Usability problems
aren't just an artifact of the implementation, they're part of Flash's
design.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
bruno at modulix wrote:
> Edward Elliott wrote:
>> You mean like this:
>>
>> s = "foo" + "bar"
>> s = 'foo' + 'bar'
>> s = 'foo' 'bar'
>> s = '%s%s' % ('foo', 'bar')
t; at least in the simple cases i've tried)
>
> Frankly, the case for tab usage is not that compelling...
Quoting usenet posts is like hunting buffalo: only take what you need.
http://www.xs4all.nl/~wijnands/nnq/nquote.html#Q2
--
Edward Elliott
UC Berkeley School of Law (Boalt Ha
#x27;re website starts winning design awards, be afraid. Be very
afraid."
Unfortunately I can't locate proper attribution. It may have been Jakob
Nielsen.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
is feature can be used for a web-based CMS! It would blow-away
> anything (non-Java) now available for managing and uploading assets.
> - Show quoted text -
Ugh, definitely astroturf.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
Roy Smith wrote:
> Edward Elliott <[EMAIL PROTECTED]> wrote:
>> This is why the C++ STL has independent forward and backward iterator
>> types.
>
> Let me see if I can paraphrase the difference between the Python design
> philosophy and the C++ design philosophy a
ut it needs to be flexible. The proposed
syntax is short, intuitive, and consistent with comprehension/generator
syntax. I'd say it's entirely in keeping with a number of rules which
trump 'one way':
Beautiful is better than ugly.
Flat is better than nested.
Readability
But there's still the problem of
overcounting string literals.
Line counts are simple to compute and it's easier to agree on which lines to
count. Thus their popularity.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
are different from iterating in reverse.
Namely, the former let's you move back and forth at will in a sequence,
while the latter is just a one-way street from back to front.
My knowledge of Python's iterators is kind of sketchy, so I may have missed
something.
--
Edward Elliott
UC Berkel
To
avoid parsing ambiguity, identifier can only contain (as the name implies)
alphanumerics and _. So your ! is limited not only to dicts but to certain
keys in certain dicts. More complicated than it's worth.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at ed
John Machin wrote:
> Use case?
quicksort! :)
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
gt;print "foo is not a string"
Another way:
if getattr (foo, 'isalpha', False):
print 'foo is a string'
Of course now string duck types must have an 'isalpha' and list ones can't,
but that shouldn't matter much.
--
Edward Elliott
UC Berkel
ch leads us to:
>>>> i
> 0
>>>> +i
> 0
>>>> +i
> 1
>>>> +i
> 1
>>>> +i
> 2
Now that is absolutely lovely. Looks like it's time to join the ranks of
Perl and C with an Obfuscated Python Contest. ;)
--
Edward Elliott
UC
the way you suggest. I'm all ears if you have another
metric I can test as easily.
> I understand what you are trying to say, but I can't support your
> conclusions as presented.
What would those be? I tried hard not draw any conclusions. I just want to
see how other people
course. It's
getting dangerously close to flaming at this point, which indicates it's
time to go offline.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
John Bokma wrote:
> Edward Elliott <[EMAIL PROTECTED]> wrote:
>
>> A little out-of-order execution seems useful here. ;)
>
> No, not interested in a pissing contest. Your statement that the Perl
> community encourages importing is *encouraged* (over using OO without
re all object types
without names to identify individual instances. "Ed's chair" and "John's
blue car" aren't names to me, just descriptions. It's like saying "that
temporary object on line 24 of function foo".
Really, how many things *do* have n
A little out-of-order execution seems useful here. ;)
John Bokma wrote:
> Edward Elliott <[EMAIL PROTECTED]> wrote:
>> I can readily believe that the "community" frequenting the newsgroups,
>> mailing lists, and blogs don't encourage it anymore. But t
John Bokma wrote:
> Edward Elliott <[EMAIL PROTECTED]> wrote:
>
>>>> like "from X import *" which are generally frowned on in python while
>>>> 'use MOD qw(id)' is encouraged in perl.
>>>
>>> Not by me, and I doubt it i
John Bokma wrote:
> Edward Elliott <[EMAIL PROTECTED]> wrote:
>
>> The question is how to count explicit names like module.class.func;
>> should that be 1 identifier or 3? Counting as 3 would reward things
>> like "from X import *" which are generally f
anguage to measure it. If anyone can provide such a beast, I'll
gladly run it against my code. In the meantime, line/char counts are the
best I've got.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
Terry Hancock wrote:
> Edward Elliott wrote:
>
>>For inquiries into real-world code, it's enough to
>>believe that I'm not lying
>>
> So I don't make assumptions about people without some kind
> of evidence. There *are* plenty of "bad guys&quo
us anything about typical code in the wild.
Producing more data points _will_ tell us that. If my data are an outlier,
they may be worthless anyway.
That's what I'm interested in. Others are interested in analyzing my code.
Which is fine, it's just not what I'm af
rt what they see.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
rt what they see.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
The
more people post their own experiences, the more patterns emerge and
testable hypotheses form, which can then be confirmed or debunked with
further study. The journey of 1000 miles starts with a single step, etc,
etc. Didn't your mother ever tell you how science works? It's not a
Christophe wrote:
> No, it's really easy : a simple precoomit hook which will refuse any .py
> file with the \t char in it and it's done ;)
$ echo \t
t
Why would you wan_ _o remove all _ee charac_ers? Isn'_ _ha_ a li__le
awkward?
--
Edward Elliott
UC Berkeley Scho
rse of available data.
No one's saying anecdotes are 100% reliable. But they aren't 0% reliable
either.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
statistics by
accumulating a vast number of such observations over time.
In any case, I never asked for scientific-quality data in the first place.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
;d asked about the best
way to club baby seals in here.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
7;t appreciate the benefits that tab indentation would bring to his
> own language - the only major language in which indentation levels
> actually have semantic significance.
Fate is a cruel mistress. Or maybe just a heartless bitch. Either way,
watch your back.
--
Edward Elliott
UC B
difference in the original
> editor.
Sure, mixed tabs and spaces were not part of my use case.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
William Studenmund wrote:
> The problem is that tabs take you to the next tab stop, they don't
> expand to a fixed number of spaces.
Got it. You're talking about using tabs other than for initial line
indentation on a source file. Yes, then tab expansion is not perfect.
--
E
y conclusions, but asking the questions is good.
> The real important question is: what has perl done in
> the last five years to make writing these scripts easier?
That's another very good question. One I can't answer.
--
Edward Elliott
UC Berkeley School of Law (Boalt Ha
thing to me isn't what could one do, it's what
are people actually doing in the real world?
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
ement (because he hardwired everything
> into a chip). That doesn't lead us to any greater understanding of
> anything though.
Of course. Extreme cases are just that.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
Dave Hansen wrote:
> On Wed, 17 May 2006 17:28:26 GMT in comp.lang.python, Edward Elliott
>>Just for the sake of completeness:
>>
>>cat file |sed 's/\t//g'
>
> That doesn't always work. If you don't see why, you don't understand
> my
John Bokma wrote:
> Edward Elliott <[EMAIL PROTECTED]> wrote:
>> Evaluating my experiences yes, relating your own no.
>
> What would the point be? Most important to me would be: am I happy with
> the result? And that rarely has to do with the number of lines of actual
&
That always has value, even when it's
wrong.
By the looks of it, this group is uninterested in the discussion. Which is
fine.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
enough. How much code is viewed with less and cat, and how much
> is viewed using smart viewers/editors? I think the majority is viewed
> using the latter.
Just for the sake of completeness:
cat file |sed 's/\t//g'
less -x4 file
vim ~/bin.cat
#!/bin/sh
cat "$@"
achates wrote:
> Jorge Godoy wrote
>
>>Emacs guess what's used in the file and allows me to use tabs all the
>>time, doing the correct thing...
>
> That sounds like useful behaviour.
vim can do it to.
http://www.vim.org/scripts/script.php?script_id=1171
--
Edwa
but a really really good idea).
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
tuation.
I'll grant you though, asking for non-value-judgement-laden anecdotes on
newsgroups may be asking too much.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
Carl J. Van Arsdall wrote:
> Well, we could call the perl camel Joe but I don't know if the perlcores
> (read: hardcore PERL users) would be down for that ;)
Hmmm. Perl is like smoking, it feels great and gives you cancer. Yes,
there's definitely potential here. ;)
--
E
John Machin wrote:
> Would you believe "steps 3 & 4"?
How about "two pops and a pass?"
Quick! Lower the cone of silence!
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
e to do" part, remember that Python's function calls are
> rather expansive...
Indeed, their expansiveness makes them great. Unfortunately they're
somewhat expensive too. ;)
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
n being forces you to get more clarity. And then later on,
you can maintain, modify, and port your programs to other platforms much
more easily. Even if your only audience is yourself, everything gets
better."
http://www-cs-faculty.stanford.edu/~knuth/
http://www-cs-faculty.stanford.edu/~uno/l
necessary. But I'd argue against it on grounds
of simplicity and readability instead of confusion.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
l namespace
yourself just as easily.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
John Bokma wrote:
> Edward Elliott <[EMAIL PROTECTED]> wrote:
>
>> This is just anecdotal, but I still find it interesting. Take it for
>> what it's worth. I'm interested in hearing others' perspectives, just
>> please don't turn this into a pi
if
any? I'm interested in properties of the code itself, not performance.
And just what is the question to the ultimate answer to life, the universe,
and everything anyway? ;)
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
achates wrote:
> With spaces for indentation, this just isn't possible, because I have
> to conform to your viewing preferences, and that makes me unhappy. Why
> would you want to make me unhappy?
+5 QOTW
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at
. Before you
object that modern languages don't use gotos, think again. Break and
continue are merely restricted forms of goto, as are exceptions. Don't
throw the baby out with the bathwater. Make better tools that allow the
good uses and prevent the bad.
--
Edward Elliott
UC Berkeley S
a line departs more than one tab indentation
level from its neighbors. It's not perfect, but it eliminates the worst
offenses. Good enough often is.
Not saying you should do this, just pointing out how tabs are viable.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
h you that the latter is way too much hassle to even attempt.
All I'm saying is that using tabs on their own is perfectly viable and a bit
cleaner. I'm not trying to force that preference on anyone else, just get
everyone to recognize that one is just as rational and salubr
Edward Elliott wrote:
> import smtpd
>
> class SMTPProxy (smtpd.SMTPServer):
> def process_message (self, peer, mailfrom, rcpttos, data):
> # my code here
>
> proxy = SMTPProxy (listen_addr, relay_addr)
> # now what?
Update: I think I've solved i
t;WTF?"
Sounds like the problem is your editor, not tabs. But I wouldn't rule out
PEBCAK either. ;)
> Undoubtedly adding the second spark to the holy war,
Undoubtedly. Let's keep it civil, shall we? And please limit the
cross-posting to a minimum. (directed at the group,
doesn't define its own init
either and it shows the same behavior as my class: binds to the port but
doesn't respond to connections.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
match of a comma separated list is
> lost, e.g:
> r"[a-zA-Z_]\w+[,[a-zA-Z_]\w+]"
That's why god invented % interpolation.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
ore/asynchat, but I didn't find
what I wanted there either.
import smtpd
class SMTPProxy (smtpd.SMTPServer):
def process_message (self, peer, mailfrom, rcpttos, data):
# my code here
proxy = SMTPProxy (listen_addr, relay_addr)
# now what?
--
Edward Elliott
UC Berkeley School of
idth font
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
arn to use pdb before
posting your code for the group to debug. this type of error is easily
catchable with a little effort. you'll learn more by investigating your
problems yourself before feeding them to the great distributed debugger
known as comp.lang.python.
--
Edward Elliott
UC Berkeley S
#x27;name's
instead? in either case, calling os.path.join with one argument is
pointless.
> # CODE 1 this does not work
> tx = infile.read(1000)
> if tx == "": break
> combined.write(tx)
> infile.close()
hint: where will break take you? therein
n.org/lib/module-md5.html
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
Flavio wrote:
> ImportError: /home/flavio/freeze/qt.so: undefined symbol:
> _ZNK9QSGIStyle9classNameEv
> So my question is: is there a way to find out exactly which lib is
> missing ?
yes - find the one with that symbol. wash, rinse, repeat. ;)
--
Edward Elliott
UC Berkeley S
ce.
Ok got it now. I'm sure it's doable but it sounds tricky. Wouldn't it be
easier to just have your function return a list of modules to the caller
and have the caller import them?
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
-
ot;-d" zip's parameter in man zip.
or change the working dir before calling unzip.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
glomde wrote:
> Tanks but that isn't what I am looking for.
> I really want a function that you can call and imports
> the module into the calling functions namespace.
>
> I dont want the caller to call import but a function.
come again?
>>> type (__builtins__.__im
ndard library. New modules aren't
just thrown in there willy-nilly.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
ol. So
rebinding/overshadowing a "constant" A would raise an error, but mutating
the underlying object A refers to would not (unless it too were immutable).
As far objects themselves, adding an ability to make any object immutable
regardless of type is exactly what he suggests.
--
ke the key scheduling routines, but that's
less likely. Until you know exactly what the original code does, your only
option is trial and error.
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
Dan Sommers wrote:
> Or even
>
> awk '/abc/,/xyz/' file.txt
>
> Excluding the abc and xyz lines is left as an exercise to the
> interested reader.
Once again, us completely disinterested readers get the short end of the
stick. :)
--
Edward Elliott
UC Berkel
bruno at modulix wrote:
> parts = s.replace(' ', '/').strip('/').split('/')
> branch = parts[parts.index('CHECKEDOUT') - 1]
>
> Edward Elliott wrote:
>>
>> marker = s.index('/CHECKEDOUT')
>> branch = s [s
Fredrik Lundh wrote:
> hint:
>
> $ python -c 'import sys; print sys.argv' 'else: print "no"'
>
>
Yeah the man page knows all.
About the only time I use python on the command line is with the timeit
module, which evals all arguments given.
e gets populated
>> again. Is this possible ?
>>
> Did you read the documentation for Queue methods?
>
> x = q.get(true) #blocks until data is available
Like a good lawyer, Dennis knows the answer before he asks the question.
--
Edward Elliott
UC Berkeley School of Law
Dennis Lee Bieber wrote:
> On Thu, 11 May 2006 20:12:55 GMT, Edward Elliott <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>> If putting the else in a separate arg unbinds it from the if, I would
>> expect a syntax error. If OTOH naked elses
AndyL wrote:
> Edward Elliott wrote:
>> And if the script runs somewhere that stderr is likely to disappear:
>>
>> prog1 = subprocess.Popen(['prog1'], stdout=file1,
>> stderr=subprocess.STDOUT)
>
> Forgot to mention before that the main motivation is
Serge Orlov wrote:
> Almad wrote:
>> OK, after some investigation...problem is in non-latin characters in
>> filenames on ftp.
>>
>> Yes, users should be killed for this,
>
> It's futile, users will always find a way to crash you program :) And
> you can't kill them all, there are too many of them
Bruno Desthuilliers wrote:
> don a écrit :
>> Also if there is a better way than using regex, please let me know.
>
> s ="/main/parallel_branch_1/release_branch_1.0/dbg_for_python/CHECKEDOUT
> from /main/parallel_branch_1/release_branch_1.0/4"
> parts = s.replace(' ', '/').strip('/').split('/')
Steven Bethard wrote:
> import subprocess
>
> file1 = open('file1', 'w')
> prog1 = subprocess.Popen(['prog1'], stdout=file1)
And if the script runs somewhere that stderr is likely to disappear:
prog1 = subprocess.Popen(['prog1'], stdout=file1, stderr=subprocess.STDOUT)
--
http://mail.python.or
[EMAIL PROTECTED] wrote:
> Call me crazy, but be careful when programming python in different text
> editors and in general, ie cutting and pasting, tabing and spacing.
> Loops can look fine and not work (try moving around test print
> statements for iterators), in this case try re-tabing your inde
Tim Daneliuk wrote:
> 'tdir' is a reimplementation and enhancement of the old 'xdir' CP/M
> utility from Ancient Times.
>
> 'tdir' is an advanced directory display utility written in Pure Python,
> and runs on both *nix and Win32 systems.\
>
> With 'tdir' you can display directories sorted by fi
James wrote:
> Wrong syntax is shown below. What should be the delimiter before else?
>
> python -c 'if 1==1: print "yes"; else print "no"'
Now this is interesting. I broke the line up into separate arguments and it
seemed to work fine:
$ python -c 'if 1==1: print "yes"' 'else: print "no"'
yes
XBello wrote:
> It's possible to work with php just with these single file? Maybe I'm
> doing the wrong thing, because to start to program I needed to install
> a web server too (a large bunch of files).
PHP can be run from the command line too. On ubuntu/debian it's available
by installing the
bruno at modulix wrote:
> From a readability/maintenance POV, Perl is a perfect nightmare.
It's certainly true that perl lacks the the eminently readable quality of
python. But then so do C, C++, Java, and a lot of other languages.
And I'll grant you that perl is more susceptible to the 'executa
Apologies to the group for getting so OT here. Thanks for your indulgence.
Ben Finney wrote:
>> I think both your goal and his (spreading free software at the
>> expense of non-free) are counterproductive.
>
> Huh? A goal is counterproductive? By what do you measure
> "counterproductive", if no
I'm replying to Ben because William's post is no longer on my news server.
<[EMAIL PROTECTED]> wrote:
> I would like to offer a couple of links to the kind of stuff I am talking
> about w.r.t. the "transparency" issue.
> First, some from Eclipse:
> http://www.eclipse.org/legal/ See especially the
I have no deep connections to any open source projects. I do however know
quite a few engineers. Bear that in mind.
[EMAIL PROTECTED] wrote:
> It seems to me that Open Source generally would be more pervasive if there
> was more transparency with respect to the practices observed within the
> p
[EMAIL PROTECTED] wrote:
> I agree with your point, which is why I asked the question. Risk cannot be
> eliminated, but it can be understood and managed so that useful work can
> still be done. If there is any way I can find out what the commiters do
> prior to reaching a decision to accept or reje
bruno at modulix wrote:
> Edward Elliott wrote:
>> Ah, well then, there's no need for a full-blown parser. It should
>> suffice to recognize a class definition and modify the parameter list of
>> every def indented one level further than that.
>
> won't
Michele Simionato wrote:
>> >>> A = [] # let's declare a "constant" here
>> >>> b = A # and let's assign the constant here
>> >>> b.append('1') # OOPS!
>
> But it makes no sense to use a mutable object for a constant!
> The user should use a tuple,
Sure. Now show me the builtin immutable equ
Bryan wrote:
> >>> keepchars = set(string.letters + string.digits + '-.')
Now that looks a lot better. Just don't forget the underscore. :)
--
http://mail.python.org/mailman/listinfo/python-list
John Machin wrote:
> [expletives deleted] and it was wrong anyway (according to your
> requirements);
> using \w would keep '_' which is *NOT* alphanumeric.
Actually the perl is correct, the explanation was the faulty part. When in
doubt, trust the code. Plus I explicitly allowed _ further down,
I'm looking for the "best" way to strip a large set of chars from a filename
string (my definition of best usually means succinct and readable). I
only want to allow alphanumeric chars, dashes, and periods. This is what I
would write in Perl (bless me father, for I have sinned...):
$filename =~
Ben Finney wrote:
> We must be reading different Python websites.
>
> walk(top[, topdown=True [, onerror=None]])
>
> walk() generates the file names in a directory tree, by walking
> the tree either top down or bottom up. For each directory in the
> tree rooted at directory top (
1 - 100 of 204 matches
Mail list logo