Re: Picking a license

2010-05-08 Thread Paul Rubin
Patrick Maupin 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 it clear he doesn't mean that in a religious sense. -- http://mail.python.org/mailma

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread Steven D'Aprano
On Sat, 08 May 2010 14:27:32 -0700, dasacc22 wrote: > U presume entirely to much. I have a preprocessor that normalizes > documents while performing other more complex operations. Theres > nothing buggy about what im doing I didn't *presume* anything, I took your example code and ran it and dis

Re: Kindly show me a better way to do it

2010-05-08 Thread Steven D'Aprano
On Sat, 08 May 2010 14:06:33 -0700, Oltmans wrote: > On May 9, 1:53 am, superpollo wrote: > >> add = lambda a,b: a+b >> for i in reduce(add,a): >>      print i > > This is very neat. Thank you. Sounds like magic to me. Can you please > explain how does that work? Many thanks again. Don't use t

Re: Picking a license

2010-05-08 Thread Patrick Maupin
On May 9, 12:19 am, Steven D'Aprano 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 GPL that you think it can't be com

Re: Picking a license

2010-05-08 Thread Paul Rubin
Patrick Maupin writes: > hybrid models that the GPL doesn't support. See, for example, Apple's > support of BSD, Webkit, and LLVM. Apple is not a "do no evil" > corporation, and their contributions back to these packages are driven > far more by hard-nosed business decisions than by any expectat

Re: Kindly show me a better way to do it

2010-05-08 Thread Lie Ryan
On 05/09/10 07:09, Günther Dietrich wrote: > > Why not this way? > a = [[1,2,3,4], [5,6,7,8]] for i in a: > for j in i: > print(j) > > 1 > 2 > 3 > 4 > 5 > 6 > 7 > 8 > > Too simple? IMHO that's more complex due to the nested loop, though I would personally d

Re: Picking a license

2010-05-08 Thread Steven D'Aprano
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 GPL that you think it can't be commercial, why should we pay any attention to your

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread Steven D'Aprano
On Sat, 08 May 2010 13:46:59 -0700, Mark Dickinson wrote: >> However, s[:-len(t)] should be both faster and correct. > > Unless len(t) == 0, surely? Doh! The hazards of insufficient testing. Thanks for catching that. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Picking a license

2010-05-08 Thread Patrick Maupin
On May 8, 11:36 pm, Paul Rubin 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 with something lik

Re: Picking a license

2010-05-08 Thread Patrick Maupin
On May 8, 11:29 pm, Paul Rubin 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 proprietary software y

Re: [ANN] Leipzig Python User Group - Meeting, May 11, 2010, 08:00pm

2010-05-08 Thread Eric Stechmann
On May 7, 2010, at 11:00 AM, Stefan Schwarzer wrote: === Leipzig Python User Group === We will meet on Tuesday, May 11, 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). Julian Moritz will give a talk about CouchDB. Food

Re: Cross-platform file paths

2010-05-08 Thread Wolfgang Rohdewald
On Sonntag 09 Mai 2010, Tim Roberts wrote: > No. On Linux, you need to mount the share in some empty > directory (using mount or smbmount), then read the files from > that directory. actually the mount directory does not have to be empty - whatever it contains is invisible while someting is mount

Openings at Aspire Systems, Chennai. (Product Dev. Company)

2010-05-08 Thread Nathas
Hi All, Please find below the openings at Aspire Systems, Chennai (www.aspiresys.com) 1. Testing - Selenium, TestComplete, RFT, Manual - SSE and Engineers - 2 + years 2. Java, Swings - Project Leader Position – 5+ years 3. Java, J2EE – Enngineer, SSE, Tech Arch – 2+ Yrs 4. .NET - SSE and Tech

Re: Picking a license

2010-05-08 Thread Paul Rubin
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 with something like Linux (I don't know what happens if you add all

Re: Picking a license

2010-05-08 Thread Paul Rubin
Carl Banks writes: > If a commercial developer has a EULA that prevents users from > combining their tools with tools from (say) their competitors, Do you mean something like a EULA that stops you from buying a copy of Oracle and combining it with tools from IBM on the computer that you install

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread dasacc22
On May 8, 2:46 pm, Steven D'Aprano wrote: > On Sat, 08 May 2010 12:15:22 -0700, Wolfram Hinderer wrote: > > On 8 Mai, 20:46, Steven D'Aprano > > wrote: > > >> def get_leading_whitespace(s): > >>     t = s.lstrip() > >>     return s[:len(s)-len(t)] > > >> >>> c = get_leading_whitespace(a) > >> >>>

Re: Picking a license

2010-05-08 Thread Aahz
In article <7xtyqhu5sg@ruckus.brouhaha.com>, Paul Rubin wrote: > >I don't know if it counts as a moral hazard but some programmers simply >don't want to do proprietary product development for free. That's why >Linux (GPL) has far more developers (and consequentially far more >functionality a

Re: Picking a license

2010-05-08 Thread Carl Banks
On May 8, 7:58 pm, Paul Rubin wrote: > Carl Banks writes: > > People who esteem their users give them freedom to use software > > however they see fit, including combining it with proprietary > > software. > > Huh  That makes no sense at all.  Why should a standard like that be > expected fro

Re: Picking a license

2010-05-08 Thread Paul Rubin
Martin wrote: >>> I fail to see what is morally wrong with it. When I ,as the author, >>> share my work to the public, I should have made peace with the fact >>> that I, for all intends and purposes, lost control over its use. Robert Kern writes: > Martin is not saying that you *ought* to release

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread dasacc22
On May 8, 5:18 pm, Patrick Maupin wrote: > On May 8, 1:16 pm, dasacc22 wrote: > > > > > > > On May 8, 12:59 pm, Patrick Maupin wrote: > > > > On May 8, 12:19 pm, dasacc22 wrote: > > > > > Hi > > > > > This is a simple question. I'm looking for the fastest way to > > > > calculate the leading wh

Re: accessing superclass methods from subclass

2010-05-08 Thread Chris Rebert
> On May 8, 7:05 pm, Chris Rebert wrote: >> On Sat, May 8, 2010 at 4:50 PM, ben wrote: >> > Why doesn't this work: >> >> > class C1: >> >    def f1(self): >> >        print("f1") >> >> > class C2(C1): >> >    f1() >> >> > It throws this error: >> >> > Traceback (most recent call last): >> >  File

Re: Picking a license

2010-05-08 Thread Robert Kern
On 2010-05-08 22:12 , Paul Rubin wrote: Steven D'Aprano writes: For the record, I've published software under an MIT licence because I judged the cost of the moral hazard introduced by encouraging freeloaders to be less than the benefits of having a more permissive licence that encourages freel

Re: Picking a license

2010-05-08 Thread Robert Kern
On 2010-05-08 22:03 , Paul Rubin wrote: "Martin P. Hellwig" writes: I fail to see what is morally wrong with it. When I ,as the author, share my work to the public, I should have made peace with the fact that I, for all intends and purposes, lost control over its use. Does the same thing appl

A more general solution

2010-05-08 Thread 3Jane
You could interpret [[1,2,3,4],[5,6,7,8]] as a tree and your task as traversal of its leaves. All solutions before would not work with trees with bigger height. Here is how to traverse such trees recursively: def eventualPrint(x): for v in x: if isinstance(v, list): eventualPrint(x)

Re: accessing superclass methods from subclass

2010-05-08 Thread ben
Ok, thanks for the info. What would be a better way to do this? What I'm trying to do is treat things in a reasonable OOP manner (all fairly new to me, esp. in Python). Here's a made-up example with a little more context. Let's say you're making a drawing program that can draw various shapes.

Re: Picking a license

2010-05-08 Thread Paul Rubin
Steven D'Aprano writes: > For the record, I've published software under an MIT licence because I > judged the cost of the moral hazard introduced by encouraging freeloaders > to be less than the benefits of having a more permissive licence that > encourages freeloading and therefore attracts mo

Re: Picking a license

2010-05-08 Thread Paul Rubin
"Martin P. Hellwig" writes: > I fail to see what is morally wrong with it. When I ,as the author, > share my work to the public, I should have made peace with the fact > that I, for all intends and purposes, lost control over its use. Does the same thing apply to Microsoft? If I get a copy of MS

Re: Picking a license

2010-05-08 Thread Paul Rubin
Carl Banks writes: > People who esteem their users give them freedom to use software > however they see fit, including combining it with proprietary > software. Huh That makes no sense at all. Why should a standard like that be expected from free software developers, when it isn't expected

Re: Cross-platform file paths

2010-05-08 Thread Tim Roberts
utabintarbo wrote: > >Until now, I have used the UNC under Windows (XP) to allow my program >to access files located on a Samba-equipped *nix box (eg. >os.path.normpath(r"\\serverFQDN\sharename\dir\filename")). When I try >to open this file under Linux (Red Hat 5), I get a file not found >error. >

Re: Picking a license

2010-05-08 Thread Patrick Maupin
On May 8, 8:41 pm, Ben Finney wrote: > Patrick Maupin writes: > > On May 8, 2:38 pm, Steven D'Aprano > cybersource.com.au> wrote: > > > Which brings us back full circle to Ben's position, which you took > > > exception to. > > […] > > > To me, the clear implication of the blanket statement that

Re: Picking a license

2010-05-08 Thread Ben Finney
a...@pythoncraft.com (Aahz) writes: > In article , > Carl Banks wrote: > > > >GPL is about fighting a holy war against commercial software. > > And really, that's a Good Thing. We wouldn't have Python, to some > extent, were it not for Stallman and his crusade. That doesn't mean we > should slav

Re: Picking a license

2010-05-08 Thread Ben Finney
Patrick Maupin writes: > On May 8, 2:38 pm, Steven D'Aprano cybersource.com.au> wrote: > > Which brings us back full circle to Ben's position, which you took > > exception to. […] > To me, the clear implication of the blanket statement that you have to > use the GPL if you care at all about use

Re: Picking a license

2010-05-08 Thread Aahz
In article , Carl Banks wrote: > >GPL is about fighting a holy war against commercial software. And really, that's a Good Thing. We wouldn't have Python, to some extent, were it not for Stallman and his crusade. That doesn't mean we should slavishly worship him, though. -- Aahz (a...@pythoncr

Re: accessing superclass methods from subclass

2010-05-08 Thread MRAB
ben wrote: Why doesn't this work: class C1: def f1(self): print("f1") class C2(C1): f1() It throws this error: Traceback (most recent call last): File "./c1.py", line 7, in class C2(C1): File "./c1.py", line 8, in C2 f1() NameError: name 'f1' is not defined f1(

Re: accessing superclass methods from subclass

2010-05-08 Thread Chris Rebert
On Sat, May 8, 2010 at 4:50 PM, ben wrote: > Why doesn't this work: > > class C1: >    def f1(self): >        print("f1") > > class C2(C1): >    f1() > > > It throws this error: > > Traceback (most recent call last): >  File "./c1.py", line 7, in >    class C2(C1): >  File "./c1.py", line 8, in C

accessing superclass methods from subclass

2010-05-08 Thread ben
Why doesn't this work: class C1: def f1(self): print("f1") class C2(C1): f1() It throws this error: Traceback (most recent call last): File "./c1.py", line 7, in class C2(C1): File "./c1.py", line 8, in C2 f1() NameError: name 'f1' is not defined f1() is an attri

Re: Picking a license

2010-05-08 Thread Carl Banks
On May 6, 4:56 pm, Ben Finney wrote: > a...@pythoncraft.com (Aahz) writes: > > In article <4be05d75.7030...@msn.com>, > > Rouslan Korneychuk   wrote: > > > >The only question I have now is what about licensing? Is that > > >something I need to worry about? Should I go with LGPL, MIT, or > > >somet

Re: how to play a sound file repeatedly in loop

2010-05-08 Thread MRAB
varnikat t wrote: How to run sound file repeatedly in loop ? When I do this, it does nothing and terminates: import pygst pygst.require("0.10") import gst, gtk n=0 while n<10: player = gst.element_factory_make("playbin2", "player") player.set_property("uri", "file:/home/varnika/hell

Re: Kindly show me a better way to do it

2010-05-08 Thread Nathan Rice
itertools is also written in c, so if you're working with a big nested list is long it will be a lot faster. On Sat, May 8, 2010 at 5:40 PM, Tycho Andersen wrote: > On Sat, May 8, 2010 at 4:09 PM, Günther Dietrich > wrote: > [snip] > > Too simple? > > No, not at all. I really only intended to p

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread Patrick Maupin
On May 8, 1:16 pm, dasacc22 wrote: > On May 8, 12:59 pm, Patrick Maupin wrote: > > > > > On May 8, 12:19 pm, dasacc22 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 dif

Re: Kindly show me a better way to do it

2010-05-08 Thread Tycho Andersen
On Sat, May 8, 2010 at 4:09 PM, Günther Dietrich wrote: [snip] > Too simple? No, not at all. I really only intended to point the OP to itertools, because it does lots of useful things exactly like this one. \t -- http://mail.python.org/mailman/listinfo/python-list

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread dasacc22
U presume entirely to much. I have a preprocessor that normalizes documents while performing other more complex operations. Theres nothing buggy about what im doing On May 8, 1:46 pm, Steven D'Aprano wrote: > On Sat, 08 May 2010 10:19:16 -0700, dasacc22 wrote: > > Hi > > > This is a simple quest

Re: Kindly show me a better way to do it

2010-05-08 Thread Günther Dietrich
Tycho Andersen wrote: >On Sat, May 8, 2010 at 3:41 PM, Oltmans wrote: >> Hi, I've a list that looks like following >> >> a = [ [1,2,3,4], [5,6,7,8] ] >> >> Currently, I'm iterating through it like >> >> for i in [k for k in a]: >>        for a in i: >>                print a >> >> but I was wond

Re: Kindly show me a better way to do it

2010-05-08 Thread superpollo
Oltmans ha scritto: On May 9, 1:53 am, superpollo wrote: add = lambda a,b: a+b for i in reduce(add,a): print i This is very neat. Thank you. Sounds like magic to me. Can you please explain how does that work? Many thanks again. here: http://tinyurl.com/3xp and here: http://tin

Re: Kindly show me a better way to do it

2010-05-08 Thread Oltmans
On May 9, 1:53 am, superpollo wrote: > add = lambda a,b: a+b > for i in reduce(add,a): >      print i This is very neat. Thank you. Sounds like magic to me. Can you please explain how does that work? Many thanks again. -- http://mail.python.org/mailman/listinfo/python-list

Re: Kindly show me a better way to do it

2010-05-08 Thread Tycho Andersen
On Sat, May 8, 2010 at 3:41 PM, Oltmans wrote: > Hi, I've a list that looks like following > > a = [ [1,2,3,4], [5,6,7,8] ] > > Currently, I'm iterating through it like > > for i in [k for k in a]: >        for a in i: >                print a > > but I was wondering if there is a shorter, more el

Re: Kindly show me a better way to do it

2010-05-08 Thread Alain Ketterlin
Oltmans writes: > a = [ [1,2,3,4], [5,6,7,8] ] > > Currently, I'm iterating through it like > > for i in [k for k in a]: > for a in i: > print a I would prefer: for i in a: for v in i: print v i.e., not messing with a and avoiding an additional list. > but I wa

Re: Kindly show me a better way to do it

2010-05-08 Thread superpollo
superpollo ha scritto: Oltmans ha scritto: Hi, I've a list that looks like following a = [ [1,2,3,4], [5,6,7,8] ] Currently, I'm iterating through it like for i in [k for k in a]: for a in i: i think you used te a identifier for two meanings... print a but I was wondering if

Re: Kindly show me a better way to do it

2010-05-08 Thread Chris Rebert
On Sat, May 8, 2010 at 1:41 PM, Oltmans wrote: > Hi, I've a list that looks like following > > a = [ [1,2,3,4], [5,6,7,8] ] > > Currently, I'm iterating through it like > > for i in [k for k in a]: >        for a in i: >                print a > > but I was wondering if there is a shorter, more el

Re: Kindly show me a better way to do it

2010-05-08 Thread superpollo
Oltmans ha scritto: Hi, I've a list that looks like following a = [ [1,2,3,4], [5,6,7,8] ] Currently, I'm iterating through it like for i in [k for k in a]: for a in i: i think you used te a identifier for two meanings... print a but I was wondering if there is a s

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread Mark Dickinson
On May 8, 8:46 pm, Steven D'Aprano wrote: > On Sat, 08 May 2010 12:15:22 -0700, Wolfram Hinderer wrote: > > On 8 Mai, 20:46, Steven D'Aprano > > wrote: > > >> def get_leading_whitespace(s): > >>     t = s.lstrip() > >>     return s[:len(s)-len(t)] > > >> >>> c = get_leading_whitespace(a) > >> >>>

Kindly show me a better way to do it

2010-05-08 Thread Oltmans
Hi, I've a list that looks like following a = [ [1,2,3,4], [5,6,7,8] ] Currently, I'm iterating through it like for i in [k for k in a]: for a in i: print a but I was wondering if there is a shorter, more elegant way to do it? -- http://mail.python.org/mailman/listinfo/

Re: ConfigParser.get() defaults?

2010-05-08 Thread Tim Chase
On 05/08/2010 01:58 PM, Steven D'Aprano wrote: If your patch doesn't attract the interest of a Python-Dev developer, you might need to give them a prod occasionally. Their time for reviewing bugs and patches is always in short supply. - where (or to whom) to I submit the patch (and possibly tes

Re: Picking a license

2010-05-08 Thread Patrick Maupin
On May 8, 2:38 pm, Steven D'Aprano wrote: > 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 restrictions on redistribution, I'll > licence this copyrighted work to you". Pe

[ANN] Pyspread 0.1.1 released

2010-05-08 Thread Martin Manns
Pyspread 0.1.1 released === I am pleased to announce the new release 0.1.1 of pyspread. About: -- Pyspread is a cross-platform Python spreadsheet application. It is based on and written in the programming language Python. Instead of spreadsheet formulas, Python expre

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread Steven D'Aprano
On Sat, 08 May 2010 12:15:22 -0700, Wolfram Hinderer wrote: > On 8 Mai, 20:46, Steven D'Aprano > wrote: > >> def get_leading_whitespace(s): >>     t = s.lstrip() >>     return s[:len(s)-len(t)] >> >> >>> c = get_leading_whitespace(a) >> >>> assert c == leading_whitespace >> >> Unless your string

Re: Need help with my 1st python program

2010-05-08 Thread Vincent Davis
I think what is not clear by what is being said is that you have passed in pressure and not 'pressure'. The first is undefined, pressure = 1 would define it. Where as 'pressure' is a string type. On Sat, May 8, 2010 at 1:35 PM, Walter Brameld IV < wb4remove_this_t...@wbrameld4.name> wrote: > Dave

how to play a sound file repeatedly in loop

2010-05-08 Thread varnikat t
How to run sound file repeatedly in loop ? When I do this, it does nothing and terminates: import pygst pygst.require("0.10") import gst, gtk n=0 while n<10: player = gst.element_factory_make("playbin2", "player") player.set_property("uri", "file:/home/varnika/hello.ogg") player.se

Re: Need help with my 1st python program

2010-05-08 Thread Steven D'Aprano
On Sat, 08 May 2010 19:13:12 +, Dave Luzius wrote: >> What is pressure? It is an undefined name. Where does pressure get its >> value from? > > Pressure is a term for barometric pressure, and is understood by Conky, > which this program is designed to work with, and is understood by > weather

Re: Need help with my 1st python program

2010-05-08 Thread Benjamin Kaplan
On Sat, May 8, 2010 at 3:13 PM, Dave Luzius wrote: > > Pressure is a term for barometric pressure, and is understood by Conky, > which this program is designed to work with, and is understood by > weather.com. But the value it passes to conky is metric, and I want it to > display in imperial. > >

Re: Picking a license

2010-05-08 Thread Steven D'Aprano
On Sat, 08 May 2010 10:14:18 -0700, Patrick Maupin wrote: > On May 8, 3:37 am, Steven D'Aprano 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 c

Re: Need help with my 1st python program

2010-05-08 Thread Walter Brameld IV
Dave Luzius wrote: On Sat, 08 May 2010 19:02:42 +, Steven D'Aprano wrote: On Sat, 08 May 2010 18:52:33 +, Dave Luzius wrote: Pleaser help me with this. Here's a copy of the program, but it keeps calling for me to define pressure. That's because you haven't defined pressure. When Pyt

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread Wolfram Hinderer
On 8 Mai, 20:46, Steven D'Aprano wrote: > def get_leading_whitespace(s): >     t = s.lstrip() >     return s[:len(s)-len(t)] > > >>> c = get_leading_whitespace(a) > >>> assert c == leading_whitespace > > Unless your strings are very large, this is likely to be faster than any > other pure-Python

Re: Need help with my 1st python program

2010-05-08 Thread Dave Luzius
On Sat, 08 May 2010 19:02:42 +, Steven D'Aprano wrote: > On Sat, 08 May 2010 18:52:33 +, Dave Luzius wrote: > >> Pleaser help me with this. Here's a copy of the program, but it keeps >> calling for me to define pressure. > > That's because you haven't defined pressure. > > When Python t

Re: Need help with my 1st python program

2010-05-08 Thread Steven D'Aprano
On Sat, 08 May 2010 18:52:33 +, Dave Luzius wrote: > Pleaser help me with this. Here's a copy of the program, but it keeps > calling for me to define pressure. That's because you haven't defined pressure. When Python tells you there is a bug in your program, it is almost always correct. >

Re: ConfigParser.get() defaults?

2010-05-08 Thread Steven D'Aprano
On Fri, 07 May 2010 20:46:47 -0500, Tim Chase wrote: > On 05/07/2010 07:56 PM, Steven D'Aprano wrote: >> On Fri, 07 May 2010 15:05:53 -0500, Tim Chase wrote: >>> With a normal dictionary, I can specify a default fallback value in >>> the event the requested key isn't present: >> [...] >>> However,

[RELEASED] Python 2.7 beta 2

2010-05-08 Thread Benjamin Peterson
On behalf of the Python development team, I'm elated to announce the second beta release of Python 2.7. Python 2.7 is scheduled (by Guido and Python-dev) to be the last major version in the 2.x series. 2.7 will have an extended period of bugfix maintenance. 2.7 includes many features that were f

Need help with my 1st python program

2010-05-08 Thread Dave Luzius
Pleaser help me with this. Here's a copy of the program, but it keeps calling for me to define pressure. # A small program to fetch local barometer reading from weather.com # and convert the value from metric to imperial. # My

Re: shortcut for large amount of global var declarations?

2010-05-08 Thread Steven D'Aprano
On Sat, 08 May 2010 10:08:08 -0400, Alex Hall wrote: > Hi all, > I am sorry if this is the second message about this you get; I typed > this and hit send (on gmail website) but I got a 404 error, so I am not > sure if the previous message made it out or not. Anyway, I have about > fifteen vars in

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread Steven D'Aprano
On Sat, 08 May 2010 10:19:16 -0700, dasacc22 wrote: > Hi > > This is a simple question. I'm looking for the fastest way to calculate > the leading whitespace (as a string, ie ''). Is calculating the amount of leading whitespace really the bottleneck in your application? If not, then trying

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread dasacc22
On May 8, 12:59 pm, Patrick Maupin wrote: > On May 8, 12:19 pm, dasacc22 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 > > --- sol

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread Patrick Maupin
On May 8, 12:19 pm, dasacc22 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 = ' '*(l

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread Daniel Skinner
sorry, my mistake it runs faster (looking at the wrong line of code). But the first two solutions are still faster. On Sat, May 8, 2010 at 12:48 PM, Daniel Skinner wrote: > That solution actually runs slower then the generator method. > > > On Sat, May 8, 2010 at 12:33 PM, Shashank Singh < > sha

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread Daniel Skinner
That solution actually runs slower then the generator method. On Sat, May 8, 2010 at 12:33 PM, Shashank Singh < shashank.sunny.si...@gmail.com> wrote: > > > On Sat, May 8, 2010 at 10:49 PM, dasacc22 wrote: > >> Hi >> >> This is a simple question. I'm looking for the fastest way to >> calculate t

Re: Fastest way to calculate leading whitespace

2010-05-08 Thread Shashank Singh
On Sat, May 8, 2010 at 10:49 PM, dasacc22 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(

Fastest way to calculate leading whitespace

2010-05-08 Thread dasacc22
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 = ' '*(len(a)-len(b)) --- solution 2 a = 'some content\n'

Re: Picking a license

2010-05-08 Thread Patrick Maupin
On May 8, 3:37 am, Steven D'Aprano 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. no license (and thus very few r

Re: shortcut for large amount of global var declarations?

2010-05-08 Thread Jon Clements
On 8 May, 16:03, Alex Hall wrote: > On 5/8/10, Jon Clements wrote: > > > On 8 May, 15:08, Alex Hall wrote: > >> Hi all, > >> I am sorry if this is the second message about this you get; I typed > >> this and hit send (on gmail website) but I got a 404 error, so I am > >> not sure if the previous

Re: ActivePython - how to configure portable framework?

2010-05-08 Thread Sridhar
Copy all the files in the ZIP to your USB stick and run INSTALLDIR\python.exe -srid On 5/7/2010 3:24 AM, balzer wrote: I downloaded ActivePython-2.6.5.12-win32-x86.zip, it contains two folders and 3 files: SystemFolder INSTALLDIR sh2.py install.bat _install.py Anyone know how to configure t

Re: shortcut for large amount of global var declarations?

2010-05-08 Thread James Mills
On Sun, May 9, 2010 at 12:08 AM, Alex Hall wrote: > Hi all, > I am sorry if this is the second message about this you get; I typed > this and hit send (on gmail website) but I got a 404 error, so I am > not sure if the previous message made it out or not. > Anyway, I have about fifteen vars in a f

Re: shortcut for large amount of global var declarations?

2010-05-08 Thread Alex Hall
On 5/8/10, Jon Clements wrote: > On 8 May, 15:08, Alex Hall wrote: >> Hi all, >> I am sorry if this is the second message about this you get; I typed >> this and hit send (on gmail website) but I got a 404 error, so I am >> not sure if the previous message made it out or not. >> Anyway, I have ab

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-08 Thread Giampaolo Rodolà
2010/5/8 Antoine Pitrou : > On Sat, 8 May 2010 13:47:53 +0200 > Giampaolo Rodolà wrote: >> >> Assuming loop() function does something like this: >> >>      ... >>      select.select(r, w, e, timeout) >>      scheduler()  # checks for scheduled calls to be fired >>      ... >> >> ...imagine a case

Re: Picking a license

2010-05-08 Thread Aahz
In article <4be522ac$0$27798$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: > >For the record, I've published software under an MIT licence because I >judged the cost of the moral hazard introduced by encouraging freeloaders >to be less than the benefits of having a more permissive licence

Re: shortcut for large amount of global var declarations?

2010-05-08 Thread Jon Clements
On 8 May, 15:08, Alex Hall wrote: > Hi all, > I am sorry if this is the second message about this you get; I typed > this and hit send (on gmail website) but I got a 404 error, so I am > not sure if the previous message made it out or not. > Anyway, I have about fifteen vars in a function which ha

Re: shortcut for large amount of global var declarations?

2010-05-08 Thread MRAB
Alex Hall wrote: Hi all, I am sorry if this is the second message about this you get; I typed this and hit send (on gmail website) but I got a 404 error, so I am not sure if the previous message made it out or not. Anyway, I have about fifteen vars in a function which have to be global. Is there

Re: fast regex

2010-05-08 Thread MRAB
Bryan wrote: Tim Chase wrote: James wrote: [Tim had written:] If the keys in your word_list are more than just words, then the regexp may not find them all, and thus not replace them all. In that case you may have to resort to my 2nd regexp which builds the 5k branch regexp from your actual d

Re: Python is cool!!

2010-05-08 Thread lkcl
On Mar 25, 3:01 pm, Bruno Desthuilliers wrote: > Jose Manuel a écrit : > > > I have been learning Python, and it is amazing I am using the > > tutorial that comes with the official distribution. > > > At the end my goal is to develop applied mathematic in engineering > > applications to be pu

Re: fast regex

2010-05-08 Thread Bryan
Tim Chase wrote: > James wrote: > > [Tim had written:] > If the keys in your word_list are more than just words, then the > regexp may not find them all, and thus not replace them all.  In > that case you may have to resort to my 2nd regexp which builds > the 5k branch regexp from your actual dicti

shortcut for large amount of global var declarations?

2010-05-08 Thread Alex Hall
Hi all, I am sorry if this is the second message about this you get; I typed this and hit send (on gmail website) but I got a 404 error, so I am not sure if the previous message made it out or not. Anyway, I have about fifteen vars in a function which have to be global. Is there a faster and more s

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-08 Thread exarkun
On 11:47 am, g.rod...@gmail.com wrote: 2010/5/7 Antoine Pitrou : Le Fri, 07 May 2010 21:55:15 +0200, Giampaolo Rodol� a �crit�: Of course, but 30 seconds look a little bit too much to me, also because (I might be wrong here) I noticed that a smaller timeout seems to result in better performan

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-08 Thread exarkun
On 07:48 am, l...@geek-central.gen.new_zealand wrote: In message , exar...@twistedmatrix.com wrote: This is a good example of why it's a bad idea to use select on Windows. Instead, use WaitForMultipleObjects. How are you supposed to write portable code, then? With WaitForMultipleObjects on

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-08 Thread Antoine Pitrou
On Sat, 8 May 2010 13:47:53 +0200 Giampaolo Rodolà wrote: > > Assuming loop() function does something like this: > > ... > select.select(r, w, e, timeout) > scheduler() # checks for scheduled calls to be fired > ... > > ...imagine a case where there's a connection (aka a di

[PATCH] Re: ConfigParser.get() defaults?

2010-05-08 Thread Tim Chase
On 05/07/2010 07:56 PM, Steven D'Aprano wrote: On Fri, 07 May 2010 15:05:53 -0500, Tim Chase wrote: With a normal dictionary, I can specify a default fallback value in the event the requested key isn't present: [...] However, with the ConfigParser object, there doesn't seem to be any way to do

Re: py3 tkinter acceps bytes. why?

2010-05-08 Thread Martin v. Loewis
Matthias Kievernagel wrote: > Me: >>> If I don't want bytes to get passed to tkinter >>> I just have to raise an exception in AsObj, no? >>> Or is it even sufficient to just remove the bytes case? > Martin v. Loewis wrote: >> But why would you want that? There are commands which legitimately >> re

Re: Cross-platform file paths

2010-05-08 Thread News123
Hi TIA, utabintarbo wrote: > Until now, I have used the UNC under Windows (XP) to allow my program > to access files located on a Samba-equipped *nix box (eg. > os.path.normpath(r"\\serverFQDN\sharename\dir\filename")). When I try > to open this file under Linux (Red Hat 5), I get a file not found

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-08 Thread Giampaolo Rodolà
2010/5/7 Antoine Pitrou : > Le Fri, 07 May 2010 21:55:15 +0200, Giampaolo Rodolà a écrit : >> Of course, but 30 seconds look a little bit too much to me, also because >> (I might be wrong here) I noticed that a smaller timeout seems to result >> in better performances. > > That's probably bogus. P

Re: Picking a license

2010-05-08 Thread Martin P. Hellwig
On 05/08/10 09:37, Steven D'Aprano wrote: If encouraging third parties to take open source code and lock it up behind proprietary, closed licences *isn't* a moral hazard, then I don't know what one is. I fail to see what is morally wrong with it. When I ,as the author, share my work to the pu

Re: Picking a license

2010-05-08 Thread Steven D'Aprano
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. no license (and thus very few rights for the software users), > after first tryin

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-08 Thread Lawrence D'Oliveiro
In message , exar...@twistedmatrix.com wrote: > This is a good example of why it's a bad idea to use select on Windows. > Instead, use WaitForMultipleObjects. How are you supposed to write portable code, then? -- http://mail.python.org/mailman/listinfo/python-list