Re: Limitation of os.walk

2010-05-12 Thread Patrick Maupin
On May 12, 2:04 pm, kj no.em...@please.post wrote: petpeeveIt seems that a similar simplicity argument was invoked to strip the cmp option from sort in Python 3.  G.  Simplicity is great, but when the drive for it starts causing useful functionality to be thrown out, then it is going too

Re: Picking a license

2010-05-12 Thread Patrick Maupin
On May 12, 5:41 pm, Paul Boddie p...@boddie.org.uk wrote: Ahh, well done.  You've sucked me into a meaningless side debate.  If I'm not distributing readline, then legally the license distribution terms don't apply to me.  End of story.  (Morally, now we might get into how trivial it is or

Re: Picking a license

2010-05-12 Thread Patrick Maupin
On May 12, 6:15 pm, Paul Boddie p...@boddie.org.uk wrote: On 12 Mai, 20:29, Patrick Maupin pmau...@gmail.com wrote: But nobody's whining about the strings attached to the software.  Just pointing out why they sometimes won't use a particular piece of software, and pointing out that some

Re: Picking a license

2010-05-12 Thread Patrick Maupin
On May 12, 10:48 pm, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: In message mailman.121.1273693278.32709.python-l...@python.org, Ed Keith wrote: ... but to claim that putting more restrictions on someone give them more freedom is pure Orwellian double speak. What about

Re: Picking a license

2010-05-11 Thread Patrick Maupin
On May 11, 5:24 am, Paul Boddie p...@boddie.org.uk wrote: On 10 Mai, 17:01, Patrick Maupin pmau...@gmail.com wrote: I'll be charitable and assume the fact that you can make that statement without apparent guile merely means that you haven't read the post I was referring to: http

Re: Picking a license

2010-05-11 Thread Patrick Maupin
On May 11, 5:34 am, Paul Boddie p...@boddie.org.uk wrote: On 10 Mai, 20:36, Patrick Maupin pmau...@gmail.com wrote: I've addressed this before.  Aahz used a word in an accurate, but to you, inflammatory, sense, but it's still accurate -- the man *would* force you to pay for the chocolate

Re: Picking a license

2010-05-11 Thread Patrick Maupin
On May 11, 9:00 am, Paul Boddie p...@boddie.org.uk wrote: On 11 Mai, 15:00, Lie Ryan lie.1...@gmail.com wrote: Come on, 99%  of the projects released under GPL did so because they don't want to learn much about the law; they just need to release it under a certain license so their users

Re: Picking a license

2010-05-11 Thread Patrick Maupin
On May 11, 6:18 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Last time I came home with chocolate, I tried that excuse on my wife. She didn't believe it for a second. Next time, I'll try claiming that I was obliged to eat the chocolate because of the GPL. Good luck with

Re: Picking a license

2010-05-10 Thread Patrick Maupin
On May 10, 6:01 am, Paul Boddie p...@boddie.org.uk wrote: On 10 Mai, 03:09, Patrick Maupin pmau...@gmail.com wrote: On May 9, 6:39 pm, Paul Boddie p...@boddie.org.uk wrote: but if they aren't pitching it directly at you, why would you believe that they are trying to change your behaviour

Re: Picking a license

2010-05-10 Thread Patrick Maupin
On May 10, 12:37 pm, Paul Boddie p...@boddie.org.uk wrote: On 10 Mai, 17:06, a...@pythoncraft.com (Aahz) wrote: In article 074b412a-c2f4-4090-a52c-4d69edb29...@d39g2000yqa.googlegroups.com, Paul Boddie  p...@boddie.org.uk wrote: Actually, the copyleft licences don't force anyone to give

Re: Picking a license

2010-05-09 Thread Patrick Maupin
On May 9, 12:19 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Sat, 08 May 2010 16:39:33 -0700, Carl Banks wrote: GPL is about fighting a holy war against commercial software. Much GPL software *is* commercial software. Given that you're so badly misinformed about the

Re: Picking a license

2010-05-09 Thread Patrick Maupin
On May 9, 1:03 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Sat, 08 May 2010 13:05:21 -0700, Patrick Maupin wrote: [...] certainly the risk of discovery if you just use a small portion of GPL code and don't distribute your source must be very small

Re: Picking a license

2010-05-09 Thread Patrick Maupin
On May 9, 1:02 pm, Paul Boddie p...@boddie.org.uk wrote: On 8 Mai, 22:05, Patrick Maupin pmau...@gmail.com wrote: On May 8, 2:38 pm, Steven D'Aprano st...@remove-this- No, you don't *owe* them anything, but this brings us back to Ben's original post. If you care about the freedoms

Re: Picking a license

2010-05-09 Thread Patrick Maupin
On May 9, 1:42 am, Paul Rubin no.em...@nospam.invalid wrote: Patrick Maupin pmau...@gmail.com writes: I certainly agree that RMS's language is couched in religious rhetoric. I would say political movement rhetoric.  He's not religious.  He uses the word spiritual sometimes but has made

Re: Picking a license (an atempt to give real advice)

2010-05-09 Thread Patrick Maupin
On May 9, 8:58 am, Ed Keith e_...@yahoo.com wrote: Stepping back from the political/philosophical/religious arguments, I'd like to give some real advice based on my own perspective. How you license your software should be based on how you want it to be used. If you are releasing an end user

Re: Picking a license

2010-05-09 Thread Patrick Maupin
On May 9, 12:08 pm, Paul Boddie p...@boddie.org.uk wrote: On 9 Mai, 09:05, Carl Banks pavlovevide...@gmail.com wrote: Bottom line is, GPL hurts everyone: the companies and open source community.  Unless you're one of a handful of projects with sufficient leverage, or are indeed a petty

Re: Picking a license

2010-05-09 Thread Patrick Maupin
On May 9, 4:21 pm, Paul Boddie p...@boddie.org.uk wrote: (Lots of good and balanced commentary snipped...) I didn't say that you personally argued that way, but people do argue that way. In fact, it's understandable that this is how some people attempt to understand the GPL - the software

Re: Picking a license

2010-05-09 Thread Patrick Maupin
On May 9, 6:39 pm, Paul Boddie p...@boddie.org.uk wrote: On 10 Mai, 00:02, Patrick Maupin pmau...@gmail.com wrote: If this is code that you would consider using in an existing project, Well, in a few cases I'm talking about, I wouldn't consider using the code -- I just stumbled across it when

Re: Picking a license

2010-05-09 Thread Patrick Maupin
On May 9, 5:05 pm, Paul Boddie p...@boddie.org.uk wrote: On 9 Mai, 21:55, Patrick Maupin pmau...@gmail.com wrote: On May 9, 12:08 pm, Paul Boddie p...@boddie.org.uk wrote: Oh sure: the GPL hurts everyone, like all the companies who have made quite a lot of money out of effectively

Re: Picking a license

2010-05-08 Thread Patrick Maupin
On May 7, 6:44 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: Patrick Maupin pmau...@gmail.com writes: On May 7, 5:33 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: Since no-one is forcing anyone to take any of the actions permitted in the license, and since those actions would

Re: Picking a license

2010-05-08 Thread Patrick Maupin
On May 8, 3:37 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Fri, 07 May 2010 23:40:22 -0700, Patrick Maupin wrote: Personally, I believe that if anything is false and misleading, it is the attempt to try to completely change the discussion from MIT vs. GPL to GPL vs

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread Patrick Maupin
On May 8, 12:19 pm, dasacc22 dasac...@gmail.com wrote: Hi This is a simple question. I'm looking for the fastest way to calculate the leading whitespace (as a string, ie '    '). Here are some different methods I have tried so far --- solution 1 a = '    some content\n' b = a.strip() c

Re: Picking a license

2010-05-08 Thread Patrick Maupin
On May 8, 2:38 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: most of the discussion about moral hazard snipped I don't think you understand what a moral hazard is. Under no circumstances is it a moral hazard to say If you do X, I will do Y -- in this case, If you obey these

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread Patrick Maupin
On May 8, 1:16 pm, dasacc22 dasac...@gmail.com wrote: On May 8, 12:59 pm, Patrick Maupin pmau...@gmail.com wrote: On May 8, 12:19 pm, dasacc22 dasac...@gmail.com wrote: Hi This is a simple question. I'm looking for the fastest way to calculate the leading whitespace (as a string

Re: Picking a license

2010-05-08 Thread Patrick Maupin
On May 8, 8:41 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: Patrick Maupin pmau...@gmail.com writes: On May 8, 2:38 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Which brings us back full circle to Ben's position, which you took exception to. […] To me

Re: Picking a license

2010-05-08 Thread Patrick Maupin
On May 8, 11:29 pm, Paul Rubin no.em...@nospam.invalid wrote: No it doesn't (not like the above).  You, the licensee under the GPL, can make those combinations and use them as much as you want on your own computers.  You just can't distribute the resulting derivative to other people.  With

Re: Picking a license

2010-05-08 Thread Patrick Maupin
On May 8, 11:36 pm, Paul Rubin no.em...@nospam.invalid wrote: a...@pythoncraft.com (Aahz) writes: What does your argument claim about Apache? No idea.  I don't have the impression the developer communities are really similar, and Apache httpd doesn't have all that many developers compared

Re: Picking a license

2010-05-07 Thread Patrick Maupin
On May 6, 6:56 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: a...@pythoncraft.com (Aahz) writes: In article 4be05d75.7030...@msn.com, Rouslan Korneychuk  rousl...@msn.com wrote: The only question I have now is what about licensing? Is that something I need to worry about? Should I go

Re: fast regex

2010-05-07 Thread Patrick Maupin
On May 6, 9:44 pm, james_027 cai.hai...@gmail.com wrote: On May 6, 11:33 pm, John Bokma j...@castleamber.com wrote: james_027 cai.hai...@gmail.com writes: I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or

Re: Picking a license

2010-05-07 Thread Patrick Maupin
On May 7, 5:33 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: Patrick Maupin pmau...@gmail.com writes: On May 6, 6:56 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: Er, no. Anyone who thinks that a copyleft license “forces” anyone to do anything is mistaken about copyright law

Re: Django as exemplary design

2010-05-06 Thread Patrick Maupin
On May 4, 5:34 pm, TomF tomf.sess...@gmail.com wrote: On 2010-05-04 07:11:08 -0700, alex23 said: (I also think there's value to be gained in studying _bad_ code, too...) True, although whether that's time well spent is another question. I don't know how this applies to reading other

Re: condition and True or False

2010-05-02 Thread Patrick Maupin
On May 2, 12:14 pm, Paul McGuire pt...@austin.rr.com wrote: While sifting through some code looking for old x and y or z code that might better be coded using y if x else z, I came across this puzzler:     x = boolean expression and True or False What is and True or False adding to this

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Patrick Maupin
On May 1, 7:13 am, Tim Chase t...@thechases.com wrote: On 05/01/2010 12:08 AM, Patrick Maupin wrote: +=, -=, /=, *=, etc.  conceptually (and, if lhs object supports in- place operator methods, actually) *modify* the lhs object. Your proposed .= syntax conceptually *replaces* the lhs

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Patrick Maupin
On May 1, 9:03 pm, Chris Rebert c...@rebertia.com wrote: In both cases, __iOP__ operator methods are being used, not vanilla __OP__ methods, so neither of your examples are relevant to Mr. Chase's point. Well, Tim's main assertion was: The += family of operators really do rebind the symbol,

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread Patrick Maupin
On Apr 30, 11:04 am, Jabapyth jabap...@gmail.com wrote: At least a few times a day I wish python had the following shortcut syntax: vbl.=func(args) this would be equivalent to vbl = vbl.func(args) example: foo = Hello world foo.=split( ) print foo # ['Hello', 'world'] and I guess

Re: pyjamas 0.7 released

2010-04-26 Thread Patrick Maupin
On Apr 26, 8:44 am, lkcl luke.leigh...@googlemail.com wrote:  the purpose of browsers is to isolate the application, restrict its access to the rest of the desktop and OS, so that random applications cannot go digging around on your private data. Well, I would agree that a requirement for the

Re: Completely Deleting A Directory

2010-04-26 Thread Patrick Maupin
On Apr 26, 4:09 am, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: It doesn’t seem to mention in the documentation for os.walk http://docs.python.org/library/os.html that symlinks to directories are returned in the list of directories, not the list of files. This will lead to an

Re: pyjamas 0.7 released

2010-04-26 Thread Patrick Maupin
On Apr 26, 4:12 pm, lkcl luke.leigh...@googlemail.com wrote:  and, given that you can use AJAX (e.g. JSONRPC) to communicate with a server-side component, installed on 127.0.0.1 and effectively do the exact same thing, nobody bothers. I suppose, but again, that pushes off the security thing.

Re: pyjamas 0.7 released

2010-04-25 Thread Patrick Maupin
On Apr 25, 8:49 am, Luke Kenneth Casson Leighton l...@lkcl.net wrote: pyjamas - the stand-alone python-to-javascript compiler, and separate GUI Widget Toolkit, has its 0.7 release, today.  this has been much delayed, in order to allow the community plenty of time between the 0.7pre2 release

Re: Confusing SyntaxError while entering non-indented code in interactive interpreter on continuation line.

2010-04-25 Thread Patrick Maupin
On Apr 25, 3:31 pm, Colin Howell colin.d.how...@gmail.com wrote: [I originally sent this to python-help; the volunteer who responded thought it was OK to repost it here.] I'm sure this has been discussed somewhere before, but I can't find it in the Python issue tracker. The following behavior

Re: Threading problem

2010-04-25 Thread Patrick Maupin
On Apr 25, 2:55 pm, sdistefano sdistef...@gmail.com wrote: I have the following issue: My program runs a thread called the MainThread, that loops trough a number of URLs and decides when it's the right time for one to be fetched.  Once a URL has to be fetched, it's added to a Queue object,

Re: Extracting an undefined number of items from a list

2010-04-12 Thread Patrick Maupin
On Apr 12, 3:05 pm, vsoler vicente.so...@gmail.com wrote: Hi everyone, say that 'db' is a list of values say 'i' is a list of indexes I'd like to get a list where each item is i-th element of db. For example: db=[10,20,30,40,50,60,70,80,90]      #undefined length i=[3,5,7]                

Re: Extracting an undefined number of items from a list

2010-04-12 Thread Patrick Maupin
On Apr 12, 9:26 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: # The obfuscated, fragile way map( itemgetter(0), sorted(      zip(db, range(1, len(db)+1)), key=lambda t: t[1] if t[1] in i else -1      )[-len(i):] ) I have to hand it to you that this might, in fact, be the

Re: Error Occurs: Replace a character in a String

2010-04-11 Thread Patrick Maupin
On Apr 11, 12:01 am, Jimbo nill...@yahoo.com wrote: Hello, I am getting an error in my python script when I try to change a character in a string. [b]But I dont know why or what to do to fix it?[/b] I have commented in my code where the error occurs [code] def format_file(filename):    

Re: SEC proposes the use of Python and XML

2010-04-11 Thread Patrick Maupin
On Apr 10, 11:13 pm, Ted Larson Freeman free...@alumni.stanford.org wrote: This week the SEC proposed new requirements for asset-backed securities that include the use of XML and Python: The asset-level information would be provided according to proposed standards and in a tagged data format

Re: Python and Regular Expressions

2010-04-11 Thread Patrick Maupin
On Apr 10, 1:05 pm, Stefan Behnel stefan...@behnel.de wrote: Running a Python program in CPython eventually boils down to a sequence of commands being executed by the CPU. That doesn't mean you should write those commands manually, even if you can. It's perfectly ok to write the program in

Re: SEC proposes the use of Python and XML

2010-04-11 Thread Patrick Maupin
On Apr 11, 3:12 am, Cameron Simpson c...@zip.com.au wrote: On 10Apr2010 23:05, Chris Rebert c...@rebertia.com wrote: | On Sat, Apr 10, 2010 at 9:13 PM, Ted Larson Freeman| free...@alumni.stanford.org wrote: | This week the SEC proposed new requirements for asset-backed | securities that

Re: Striving for PEP-8 compliance

2010-04-10 Thread Patrick Maupin
On Apr 10, 5:10 am, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: In message 18988a53-e88f-4abf- a83a-314b16653...@x12g2000yqx.googlegroups.com, Patrick Maupin wrote: I want nothing to do with any programmer who would mis-indent their code. But what happens when you’re

Re: On Class namespaces, calling methods

2010-04-10 Thread Patrick Maupin
On Apr 10, 9:26 am, vsoler vicente.so...@gmail.com wrote: class Uno:     a=1     def m():         print mouse ... I cannot write       Uno.m() By default (at least in Python 2.x), Python will pass any function which is accessed through getattr on class or instance (usually called a

Re: Python and Regular Expressions

2010-04-10 Thread Patrick Maupin
On Apr 8, 5:13 am, Nobody nob...@nowhere.com wrote: On Wed, 07 Apr 2010 18:25:36 -0700, Patrick Maupin wrote: Regular expressions != Parsers True, but lots of parsers *use* regular expressions in their tokenizers.  In fact, if you have a pure Python parser, you can often get huge

Re: Python and Regular Expressions

2010-04-10 Thread Patrick Maupin
On Apr 10, 11:35 am, Neil Cerutti ne...@norwich.edu wrote: On 2010-04-10, Patrick Maupin pmau...@gmail.com wrote: as Pyparsing.  Which is all well and good, except then the OP will download pyparsing, take a look, realize that it uses regexps under the hood, and possibly be very confused

Re: doctest.testfile fails on text files with Windows line endings

2010-04-10 Thread Patrick Maupin
On Apr 10, 10:16 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: After converting a text file containing doctests to use Windows line endings, I'm getting spurious errors: ValueError: line 19 of the docstring for examples.txt has inconsistent leading whitespace: '\r' I

Re: lambda with floats

2010-04-09 Thread Patrick Maupin
On Apr 9, 1:22 pm, monkeys paw mon...@joemoney.net wrote: On 4/9/2010 3:43 AM, Bas wrote: On Apr 7, 6:15 am, Patrick Maupinpmau...@gmail.com  wrote: I should stop making a habit of responding to myself, BUT.  This isn't quite an acre in square feet.  I just saw the 43xxx and assumed it

Re: Performance of list vs. set equality operations

2010-04-09 Thread Patrick Maupin
On Apr 9, 1:07 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Thu, 08 Apr 2010 21:02:23 -0300, Patrick Maupin pmau...@gmail.com   escribió: On Apr 8, 6:35 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: The CPython source contains lots of shortcuts like that. Perhaps

Re: Striving for PEP-8 compliance

2010-04-09 Thread Patrick Maupin
On Apr 9, 5:31 pm, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: Anybody who ever creates another indentation-controlled language should be beaten to death with a Guido van Rossum voodoo doll.     No ... Yes, because otherwise you wouldn’t have stupid problems like the one

Re: regex help: splitting string gets weird groups

2010-04-08 Thread Patrick Maupin
On Apr 8, 1:49 pm, gry georgeryo...@gmail.com wrote: [ python3.1.1, re.__version__='2.2.1' ] I'm trying to use re to split a string into (any number of) pieces of these kinds: 1) contiguous runs of letters 2) contiguous runs of digits 3) single other characters e.g.   555tHe-rain.in#=1234  

Re: Dynamically growing an array to implement a stack

2010-04-08 Thread Patrick Maupin
On Apr 8, 3:21 pm, M. Hamed mhels...@hotmail.com wrote: I have trouble with some Python concept. The fact that you can not assign to a non-existent index in an array. For example: a = [0,1] a[2] = Generates an error I can use a.append(2) but that always appends to the end. Sometimes

Re: regex help: splitting string gets weird groups

2010-04-08 Thread Patrick Maupin
On Apr 8, 3:40 pm, gry georgeryo...@gmail.com wrote:     s='555tHe-rain.in#=1234'     import re     r=re.compile(r'([a-zA-Z]+|\d+|.)')     r.findall(s)    ['555', 'tHe', '-', 'rain', '.', 'in', '#', '=', '1234'] This is nice and simple and has the invertible property that Patrick

Re: lambda with floats

2010-04-08 Thread Patrick Maupin
On Apr 8, 6:06 pm, monkeys paw mon...@joemoney.net wrote: On 4/7/2010 1:08 PM, Peter Pearson wrote: On Tue, 06 Apr 2010 23:16:18 -0400, monkeys pawmon...@joemoney.net  wrote: I have the following acre meter which works for integers, how do i convert this to float? I tried return float

Re: Performance of list vs. set equality operations

2010-04-08 Thread Patrick Maupin
On Apr 8, 6:35 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: The CPython source contains lots of shortcuts like that. Perhaps the   checks should be stricter in some cases, but I imagine it's not so easy to   fix: lots of code was written in the pre-2.2 era, assuming that internal  

Re: Dynamically growing an array to implement a stack

2010-04-08 Thread Patrick Maupin
On Apr 8, 3:54 pm, M. Hamed mhels...@hotmail.com wrote: Thanks Patrick, that is what I was exactly looking for. You're welcome! But I have to say, you should consider what Paul and Lie are saying. In general, when I use a stack, I just use append() and pop(), as they mention, and let the list

Re: The Regex Story

2010-04-08 Thread Patrick Maupin
On Apr 8, 9:32 pm, Dotan Cohen dotanco...@gmail.com wrote: Regexes do have their uses. It's a case of knowing when they are the best approach and when they aren't. Agreed. The problems begin when the when they aren't is not recognised. Arguing against this is like arguing against motherhood

Re: Regex driving me crazy...

2010-04-07 Thread Patrick Maupin
On Apr 7, 4:40 pm, J dreadpiratej...@gmail.com wrote: Can someone make me un-crazy? I have a bit of code that right now, looks like this: status = getoutput('smartctl -l selftest /dev/sda').splitlines()[6]         status = re.sub(' (?= )(?=([^]*[^]*)*[^]*$)', :,status)         print status

Re: Regex driving me crazy...

2010-04-07 Thread Patrick Maupin
On Apr 7, 4:47 pm, Grant Edwards inva...@invalid.invalid wrote: On 2010-04-07, J dreadpiratej...@gmail.com wrote: Can someone make me un-crazy? Definitely.  Regex is driving you crazy, so don't use a regex.   inputString = # 1  Short offline       Completed without error     00%      

Re: Regex driving me crazy...

2010-04-07 Thread Patrick Maupin
On Apr 7, 7:49 pm, Patrick Maupin pmau...@gmail.com wrote: On Apr 7, 4:40 pm, J dreadpiratej...@gmail.com wrote: Can someone make me un-crazy? I have a bit of code that right now, looks like this: status = getoutput('smartctl -l selftest /dev/sda').splitlines()[6]         status

Re: Python and Regular Expressions

2010-04-07 Thread Patrick Maupin
On Apr 7, 3:52 am, Chris Rebert c...@rebertia.com wrote: Regular expressions != Parsers True, but lots of parsers *use* regular expressions in their tokenizers. In fact, if you have a pure Python parser, you can often get huge performance gains by rearranging your code slightly so that you can

Re: Performance of list vs. set equality operations

2010-04-07 Thread Patrick Maupin
On Apr 7, 8:41 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Wed, 07 Apr 2010 10:55:10 -0700, Raymond Hettinger wrote: [Gustavo Nare] In other words: The more different elements two collections have, the faster it is to compare them as sets. And as a consequence, the

Re: Regex driving me crazy...

2010-04-07 Thread Patrick Maupin
On Apr 7, 9:02 pm, James Stroud nospamjstroudmap...@mbi.ucla.edu wrote: Patrick Maupin wrote: BTW, although I find it annoying when people say don't do that when that is a perfectly good thing to do, and although I also find it annoying when people tell you what not to do without telling

Re: Regex driving me crazy...

2010-04-07 Thread Patrick Maupin
On Apr 7, 9:36 pm, Grant Edwards inva...@invalid.invalid wrote: On 2010-04-08, Patrick Maupin pmau...@gmail.com wrote: On Apr 7, 4:47?pm, Grant Edwards inva...@invalid.invalid wrote: On 2010-04-07, J dreadpiratej...@gmail.com wrote: Can someone make me un-crazy? Definitely. ?Regex

Re: Regex driving me crazy...

2010-04-07 Thread Patrick Maupin
On Apr 7, 9:51 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Wed, 07 Apr 2010 18:03:47 -0700, Patrick Maupin wrote: BTW, although I find it annoying when people say don't do that when that is a perfectly good thing to do, and although I also find it annoying when

Re: Regex driving me crazy...

2010-04-07 Thread Patrick Maupin
On Apr 7, 9:51 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: This is one of the reasons we're so often suspicious of re solutions: s = '# 1  Short offline       Completed without error       00%' tre = Timer(re.split(' {2,}', s), ... import re; from __main__ import s)

Re: Regex driving me crazy...

2010-04-07 Thread Patrick Maupin
On Apr 7, 9:51 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: BTW, I don't know how you got 'True' here. re.split(' {2,}', s) == [x for x in s.split('  ') if x.strip()] True You must not have s set up to be the string given by the OP. I just realized there was an error in

Re: sum for sequences?

2010-04-06 Thread Patrick Maupin
On Apr 6, 8:39 am, Albert van der Horst alb...@spenarnc.xs4all.nl wrote: To a mathematician sum(set) suggest that the order of summation doesn't matter. (So I wouldn't use sum for concatenating lists.) Harshly, sum() should be used only for operator + both associative and commutative. That's

Re: s-expression parser in python

2010-04-06 Thread Patrick Maupin
On Apr 6, 7:02 pm, James Stroud nospamjstroudmap...@mbi.ucla.edu wrote: I have a parser/emitter I wrote about 4 years ago for EDIF. Take a look at the wikipedia article http://en.wikipedia.org/wiki/EDIF If that is close to you want, I can send it to you. The whole parser/ emitter/XML

Re: lambda with floats

2010-04-06 Thread Patrick Maupin
On Apr 6, 10:16 pm, monkeys paw mon...@joemoney.net wrote: I have the following acre meter which works for integers, how do i convert this to float? I tried return float ((208.0 * 208.0) * n)   def s(n): ...     return lambda x: (208 * 208) * n ...   f = s(1)   f(1) 43264   208 * 208

Re: lambda with floats

2010-04-06 Thread Patrick Maupin
On Apr 6, 11:04 pm, Patrick Maupin pmau...@gmail.com wrote: On Apr 6, 10:16 pm, monkeys paw mon...@joemoney.net wrote: I have the following acre meter which works for integers, how do i convert this to float? I tried return float ((208.0 * 208.0) * n)   def s(n): ...     return

Re: lambda with floats

2010-04-06 Thread Patrick Maupin
On Apr 6, 11:10 pm, Patrick Maupin pmau...@gmail.com wrote: On Apr 6, 11:04 pm, Patrick Maupin pmau...@gmail.com wrote: On Apr 6, 10:16 pm, monkeys paw mon...@joemoney.net wrote: I have the following acre meter which works for integers, how do i convert this to float? I tried

Re: passing command line arguments to executable

2010-04-05 Thread Patrick Maupin
On Apr 5, 11:22 am, mcanjo mca...@gmail.com wrote: On Apr 4, 6:32 am, Simon Brunning si...@brunningonline.net wrote: On 3 April 2010 18:20, mcanjo mca...@gmail.com wrote: I tried doing the following code: from subprocess import Popen from subprocess import PIPE, STDOUT exefile

Re: C-style static variables in Python?

2010-04-05 Thread Patrick Maupin
On Apr 5, 6:50 pm, Ethan Furman et...@stoneleaf.us wrote: (Posted some code with a timeit...) Well, I'm not going to debug this, but with the *original* thing you posted, and the thing I posted, with a call and everything (more realistic scenario), the exception version seems slower on my

Re: Splitting a string

2010-04-04 Thread Patrick Maupin
On Apr 4, 4:58 am, Peter Otten __pete...@web.de wrote: Personally, though, I prefer unit tests over assertions. IMO, the primary use cases for assertions and unit tests are not the same. When I have a well-defined, clearly understood specification that I am coding to and fully implementing

Re: Splitting a string

2010-04-04 Thread Patrick Maupin
On Apr 4, 2:37 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: In any case, the *right* test would be: a = 1 assert a == 1 and a*5==5 and str(a)=='1' and [None,a,None][a] is a You're right. I was very tired when I wrote that, and forgot the last 3 assertions... --

Re: Is there a standard name for this tree structure?

2010-04-04 Thread Patrick Maupin
On Apr 4, 9:06 am, Duncan Booth duncan.bo...@invalid.invalid wrote: Do you have any carniverous apes? If so it's a directed acyclic graph. Well, since he has a root node, he's really only described the *use* of this data structure implementation for a rooted tree. As you point out, the

Re: Is there a standard name for this tree structure?

2010-04-04 Thread Patrick Maupin
On Apr 4, 10:41 am, Patrick Maupin pmau...@gmail.com wrote: The primary differences between this structure and just haphazardly wiring up random objects into a directed graph are that (1) there may be some performance differences (but when the garbage collector has to figure out how to break

Re: off topic but please forgive me me and answer

2010-04-04 Thread Patrick Maupin
On Apr 4, 10:00 am, rantingrick rantingr...@gmail.com wrote: This is amazing, how can such an off topic post based completely on lunacy exist so long here? 54 posts and counting. I think i had this very argument in grade school. We have SD'A, Tim Chase, MSRB, and yes even Steve Holden again

Re: In disGuiodoise?

2010-04-04 Thread Patrick Maupin
On Apr 4, 11:14 am, Alf P. Steinbach al...@start.no wrote: He walks among you, and you don't recognize him - Old jungle proverb Hm, interesting Google results for that phrase. Interesting self-promotion :-)

Re: C-style static variables in Python?

2010-04-04 Thread Patrick Maupin
On Apr 4, 1:57 pm, John Nagle na...@animats.com wrote:     If you want functions with state, use an object. That's what they're for.  Don't muck with the internal representation of functions. While Don't muck with the internal representation of functions is excellent advice over 99% of the

Re: off topic but please forgive me me and answer

2010-04-03 Thread Patrick Maupin
On Apr 3, 9:43 am, Martin P. Hellwig IMHO, the crackpot in this regard is actually partially right, multiplication does mean that the number must get bigger, however for fractions you multiply four numbers, two numerators and two denominators. The resulting numerator and denominator by this

Re: off topic but please forgive me me and answer

2010-04-03 Thread Patrick Maupin
On Apr 3, 8:00 am, superpollo ute...@esempio.net wrote: sorry if I misunderstood. no no you understood prfectly *but* the thing is i am a regular in an italian language math ng which is haunted by a crackpot who insists that 1/2 * 1/2 cannot be 1/4, because multiplication means getting

Re: Splitting a string

2010-04-03 Thread Patrick Maupin
On Apr 3, 4:17 am, Peter Otten __pete...@web.de wrote: Patrick Maupin wrote: On Apr 2, 4:32 pm, Peter Otten __pete...@web.de wrote: _split = re.compile(r(\d+)).split def split(s):     if not s:         return ()     parts = _split(s)     parts[1::2] = map(int, parts[1::2

Re: passing command line arguments to executable

2010-04-03 Thread Patrick Maupin
On Apr 3, 11:09 am, mcanjo mca...@gmail.com wrote: I have an executable (I don't have access to the source code) that processes some data. I double click on the icon and a Command prompt window pops up. The program asks me for the input file, I hit enter, and then it asks me for and output

Re: off topic but please forgive me me and answer

2010-04-03 Thread Patrick Maupin
On Apr 3, 11:59 am, Emile van Sebille em...@fenx.com wrote: On 4/3/2010 8:46 AM Patrick Maupin said... On Apr 3, 9:43 am, Martin P. Hellwig  IMHO, the crackpot in this regard is actually partially right, multiplication does mean that the number must get bigger, however for fractions you

Re: passing command line arguments to executable

2010-04-03 Thread Patrick Maupin
On Apr 3, 12:20 pm, mcanjo mca...@gmail.com wrote: On Apr 3, 11:15 am, Patrick Maupin pmau...@gmail.com wrote: On Apr 3, 11:09 am, mcanjo mca...@gmail.com wrote: I have an executable (I don't have access to the source code) that processes some data. I double click on the icon

Re: off topic but please forgive me me and answer

2010-04-03 Thread Patrick Maupin
On Apr 3, 12:39 pm, MRAB pyt...@mrabarnett.plus.com wrote: Patrick Maupin wrote: On Apr 3, 11:59 am, Emile van Sebille em...@fenx.com wrote: On 4/3/2010 8:46 AM Patrick Maupin said... On Apr 3, 9:43 am, Martin P. Hellwig  IMHO, the crackpot in this regard is actually partially right

Re: off topic but please forgive me me and answer

2010-04-03 Thread Patrick Maupin
On Apr 3, 9:24 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: To put it another way, even though there are an infinite number of rationals, they are vanishingly rare compared to the irrationals. If you could choose a random number from the real number line, it almost

Re: Splitting a string

2010-04-03 Thread Patrick Maupin
On Apr 3, 10:00 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Tests which you know can't fail are called assertions, pre-conditions and post-conditions. We test them because if we don't, they will fail :) Well, yes, but that can get rather tedious at times: a = 1 assert 0 a

Re: Splitting a string

2010-04-02 Thread Patrick Maupin
On Apr 2, 6:24 am, Peter Otten __pete...@web.de wrote: Thomas Heller wrote: Maybe I'm just lazy, but what is the fastest way to convert a string into a tuple containing character sequences and integer numbers, like this: 'si_pos_99_rep_1_0.ita'  - ('si_pos_', 99, '_rep_', 1, '_', 0,

Re: C-style static variables in Python?

2010-04-02 Thread Patrick Maupin
On Apr 2, 1:21 pm, Ethan Furman et...@stoneleaf.us wrote: For this type of situation, my preference would be: class spam(object):      def __call__(self, x, y, z):          try:              mongo = self.mongo          except AttributeError:              mongo = self.mongo =

Re: off topic but please forgive me me and answer

2010-04-02 Thread Patrick Maupin
On Apr 2, 2:41 pm, Andreas Waldenburger use...@geekmail.invalid wrote: While everyone else is mocking you: Can you please elaborate on why you want to know and what kind of problem you're trying to solve with this? Also, don't you think you should have picked a maths forum for this kind of

Re: C-style static variables in Python?

2010-04-02 Thread Patrick Maupin
On Apr 2, 2:38 pm, Ethan Furman et...@stoneleaf.us wrote: Patrick Maupin wrote: On Apr 2, 1:21 pm, Ethan Furman et...@stoneleaf.us wrote: For this type of situation, my preference would be: class spam(object):      def __call__(self, x, y, z):          try:              mongo

Re: C-style static variables in Python?

2010-04-02 Thread Patrick Maupin
On Apr 2, 3:33 pm, Ethan Furman et...@stoneleaf.us wrote: My main point, though, was using __call__, and not some weird _ method.  ;) Yes, __call__ is good. In general, not naming things that don't need to be named is good (but if you have too many of them to keep track of, then, obviously,

<    1   2   3   4   >