Re: What's the word on using """ to comment-out?

2010-02-25 Thread Paul Rudin
kj writes: > I think I remember, early in my learning of Python, coming across > the commandment "THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT > LINES OF CODE", or something to that effect. But now I can't find > it! No idea, but it would be nice to have some multiline comment syntax (other

Re: When will Java go mainstream like Python?

2010-02-25 Thread Paul Rubin
"sjdevn...@yahoo.com" writes: > IMO, Python would be well-served by making the ref-counting semantics it > currently has a guaranteed part of the language spec... > I could be convinced otherwise, but I _think_ that that change would > offer an alternative to all of the interesting cases of where

Re: When will Java go mainstream like Python?

2010-02-25 Thread Paul Rubin
Lawrence D'Oliveiro writes: > Pointer-chasing is a cache- hostile activity. Garbage collection > involves a lot of pointer-chasing, particularly of dead objects that > have long since been flushed from the cache, compared with reference > counting of recently-accessed objects. Therefore garbage c

Re: Regular expression issue

2010-02-25 Thread Peter Otten
Ashok Prabhu wrote: > The following is a sample of my problem. I get input from user and > store it in variable 'b'. I want to match the user input with the > contents of another variable 'a'. However I m not able to get the > exact match. Could someone help? > print a > c > c+ > b > '

Re: Creating variables from dicts

2010-02-25 Thread alex goretoy
The problem i see with using globals() is that it can overwrite a previously defined function or key within the global namespace, making the code potentially dangerous and wild with exploits. my $0.02 -Alex Goretoy -- http://mail.python.org/mailman/listinfo/python-list

Re: When will Java go mainstream like Python?

2010-02-25 Thread Gregory Ewing
Lawrence D'Oliveiro wrote: And then there’s caching. Modern CPUs owe most of their speed to assumptions that programs will obey locality of reference. Pointer-chasing is a cache- hostile activity. Another thing to consider is the rate at which garbage is created. Java's fundamental types (ints

Re: When will Java go mainstream like Python?

2010-02-25 Thread Alf P. Steinbach
* sjdevn...@yahoo.com: On Feb 24, 8:05 pm, Lawrence D'Oliveiro wrote: In message , Wanja Gayk wrote: Reference counting is about the worst technique for garbage collection. It avoids the need for garbage collection. That's like saying that driving a VW Beetle avoids the need for an automob

Why born like human? Read Ramayana & Follow Rama.

2010-02-25 Thread Sree Rama
Why born like human? Read Ramayana & Follow Rama. Once in a life you should read this great story, read this story in simple language at http://ramayanastory-rama.blogspot.com/2010/02/sri-rama-prince-of-ayodhya.html -- http://mail.python.org/mailman/listinfo/python-list

Re: pydoc errors

2010-02-25 Thread Diez B. Roggisch
Am 25.02.10 08:54, schrieb john maclean: python version is 2.6.2 does any one else have this issue? Seen a few closed tickets for various Linux Distros but it is obvoiusly still my problem. help> modules Please wait a moment while I gather a list of all available modules... dm.c: 1640: not r

Re: When will Java go mainstream like Python?

2010-02-25 Thread Chris Rebert
On Wed, Feb 24, 2010 at 11:03 PM, sjdevn...@yahoo.com wrote: > On Feb 24, 8:05 pm, Lawrence D'Oliveiro central.gen.new_zealand> wrote: >> In message , Wanja Gayk wrote: >> >> > Reference counting is about the worst technique for garbage collection. >> >> It avoids the need for garbage collection.

Re: When will Java go mainstream like Python?

2010-02-25 Thread Paul Rubin
"Alf P. Steinbach" writes: > So I think there's no really good solution: the price for simplicity > in one dimension is some complexity in another dimension, You could look at the way Cyclone (http://cyclone.thelanguage.org) does region inference, and maybe combine that with a tracing gc. There

Re: Spam from gmail

2010-02-25 Thread Arnaud Delobelle
Steven D'Aprano wrote: > (That last response is aimed at a generic You, not Ben specifically. > Stupid English language, why can't we have a word for generic you?) I thought the word was "one". -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list

taking python enterprise level?...

2010-02-25 Thread simn_stv
hello people, i have been reading posts on this group for quite some time now and many, if not all (actually not all!), seem quite interesting. i plan to build an application, a network based application that i estimate (and seriously hope) would get as many as 100, 000 hits a day (hehe,...my dad a

Re: Signature-based Function Overloading in Python

2010-02-25 Thread Jean-Michel Pichavant
Michael Rudolf wrote: First: Thanks for all the replies so far, they really helped me. Am 24.02.2010 11:28, schrieb Jean-Michel Pichavant: >>> def a(x=None): if x is None: pass else: pass This is the way to do it python, and it has its advantages: 1 docstring, 1 way do

Re: What's the word on using """ to comment-out?

2010-02-25 Thread Tim Chase
Paul Rudin wrote: kj writes: I think I remember, early in my learning of Python, coming across the commandment "THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT LINES OF CODE", or something to that effect. But now I can't find it! No idea, but it would be nice to have some multiline comment

Re: When will Python go mainstream like Java?

2010-02-25 Thread Stefan Behnel
mk, 24.02.2010 18:30: > On 2010-02-24 03:26, George Sakkis wrote: >>> Well I for one wouldn't want Python to go exactly Java way, see this: >>> >>> http://www.itjobswatch.co.uk/charts/permanent-demand-trend.aspx?s=jav... >>> >>> This is the percentage of job offers in UK where the keyword "Java" >>

Re: Signature-based Function Overloading in Python

2010-02-25 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Michael Rudolf wrote: First: Thanks for all the replies so far, they really helped me. Am 24.02.2010 11:28, schrieb Jean-Michel Pichavant: >>> def a(x=None): if x is None: pass else: pass This is the way to do it python, and it has its adva

Using mock library (written by Michael Foord)

2010-02-25 Thread Lacrima
Hello! I use mock library http://www.voidspace.org.uk/python/mock/. There is no user group for the library, so I post in comp.lang.python and hope that people who use it will help me. The library allows to patch objects, using patch decorator. Patching is done only within the scope of the functio

Re: taking python enterprise level?...

2010-02-25 Thread Steve Holden
simn_stv wrote: > hello people, i have been reading posts on this group for quite some > time now and many, if not all (actually not all!), seem quite > interesting. > i plan to build an application, a network based application that i > estimate (and seriously hope) would get as many as 100, 000 hi

Re: taking python enterprise level?...

2010-02-25 Thread Martin P. Hellwig
On 02/25/10 10:26, simn_stv wrote: what i am concerned about is scalability and efficiency, well, as far as the 'core' is concerned. would python be able to manage giving me a solid 'core' and will i be able to use python provide any API i would like to implement?... Python isn't the most eff

Re: taking python enterprise level?...

2010-02-25 Thread Tim Wintle
On Thu, 2010-02-25 at 02:26 -0800, simn_stv wrote: > i plan to build an application, a network based application that i > estimate (and seriously hope) would get as many as 100, 000 hits a day > (hehe,...my dad always told me to 'AIM HIGH' ;0), not some 'facebook' > or anything like it, its mainly

Re: Can't Access ANY url from python (errno 61)

2010-02-25 Thread Lie Ryan
On 02/24/10 17:07, MattB wrote: > All -- problem solved. Following Lie's suggestions, and the links > from those pages, I went hunting around in my /library/preferences/ > SystemConfiguration/. I opened all of the 6 or 7 files that were in > there, and all looked as if they contained info directl

A more pythonish code

2010-02-25 Thread prasad_chand
Hi, I use python to do simple math problems as a hobby. I have made a program that finds the number of divisors(factors) of a given number. I am hoping to improve my language skills, specifically I would like to re-write the function "prime_factors" more gracefully. While the program works right,

Re: Pure virtual functions in Python?

2010-02-25 Thread lallous
On Feb 21, 11:21 am, Lie Ryan wrote: > On 02/21/10 19:27,lallouswrote: > > > > If the base defines the method and it was empty, then my C++ code > > would still call the function. This is not optimal because I don't > > want to go from C++ to Python if the _derived_ class does not > > implement t

Re: Pure virtual functions in Python?

2010-02-25 Thread lallous
On Feb 22, 12:42 am, Gregory Ewing wrote: > lallouswrote: > > If the base defines the method and it was empty, then my C++ code > > would still call the function. This is not optimal because I don't > > want to go from C++ to Python if the _derived_ class does not > > implement the cb. > > I would

Walking lists

2010-02-25 Thread lallous
Hello I am still learning Python, and have a question, perhaps I can shorten the code: L = ( (1, 2, 3), (4,), (5,), (6, 7) ) for x in L: print x What I want, is to write the for loop, something like this: for (first_element, the_rest) in L: print first_element for x in the_res

Re: When will Java go mainstream like Python?

2010-02-25 Thread Lie Ryan
On 02/25/10 07:40, Wanja Gayk wrote: > Am 24.02.2010, 00:22 Uhr, schrieb Lawrence D'Oliveiro > : > >>> Java - The JVM code been hacked to death by Sun engineers (optimised) >>> Python - The PVM code has seen speed-ups in Unladen or via Pyrex.. >>> ad-infinitum but nowhere as near to JVM >> >> Pyth

Re: Walking lists

2010-02-25 Thread Peter Otten
lallous wrote: > I am still learning Python, and have a question, perhaps I can shorten > the code: > > L = ( > (1, 2, 3), > (4,), > (5,), > (6, 7) > ) > > for x in L: > print x > > What I want, is to write the for loop, something like this: > > for (first_element, the_rest) in L:

Re: taking python enterprise level?...

2010-02-25 Thread simn_stv
On Feb 25, 12:13 pm, Steve Holden wrote: > simn_stv wrote: > > hello people, i have been reading posts on this group for quite some > > time now and many, if not all (actually not all!), seem quite > > interesting. > > i plan to build an application, a network based application that i > > estimate

Re: What's the word on using """ to comment-out?

2010-02-25 Thread Lie Ryan
On 02/25/10 05:18, kj wrote: > I think I remember, early in my learning of Python, coming across > the commandment "THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT > LINES OF CODE", or something to that effect. But now I can't find > it! I've never heard of it, though I can think of a few reasons

Re: Walking lists

2010-02-25 Thread Tim Chase
lallous wrote: L = ( (1, 2, 3), (4,), (5,), (6, 7) ) What I want, is to write the for loop, something like this: for (first_element, the_rest) in L: print first_element for x in the_rest: # now access the rest of the elements Python 3 introduced a variable tuple assignment whi

why (1, 2, 3) > [1, 2, 3] is true?

2010-02-25 Thread fat bold cyclop
I tired to google for comparison of tuple to list but i failed. Could anyone explain it to me? Best regards, fat bold cyclop -- http://mail.python.org/mailman/listinfo/python-list

RE: What's the word on using """ to comment-out?

2010-02-25 Thread macbeth
> From: Lie Ryan > > On 02/25/10 05:18, kj wrote: > > I think I remember, early in my learning of Python, coming across > > the commandment "THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT > > LINES OF CODE", or something to that effect. But now I can't find > > it! > > I've never heard of it,

Re: taking python enterprise level?...

2010-02-25 Thread Tim Chase
simn_stv wrote: i plan to build an application, a network based application that i estimate (and seriously hope) would get as many as 100, 000 hits a day (hehe,...my dad always told me to 'AIM HIGH' ;0), not some 'facebook' or anything like it, its mainly for a financial transactions which gets p

Re: How to monitor memory usage within Python? (Linux)

2010-02-25 Thread Giampaolo Rodola'
On 24 Feb, 23:35, kj wrote: > Is there some standard module for getting info about the process's > memory usage, in a Linux/Unix system? > > (I want to avoid hacks that involve, e.g., scraping ps's output.) > > Thanks! > > ~K http://code.google.com/p/psutil >>> import psutil >>> p = psutil.Proce

Re: When will Java go mainstream like Python?

2010-02-25 Thread Silvio
"Lawrence D'Oliveiro" wrote in message news:hm4icr$q4...@lust.ihug.co.nz... In message , Wanja Gayk wrote: Reference counting is about the worst technique for garbage collection. It avoids the need for garbage collection. It means I can write things like contents = open(filename, "r"

Re: Walking lists

2010-02-25 Thread Arnaud Delobelle
lallous wrote: > Hello > > > I am still learning Python, and have a question, perhaps I can shorten > the code: > > L = ( > (1, 2, 3), > (4,), > (5,), > (6, 7) > ) > > for x in L: > print x > > What I want, is to write the for loop, something like this: > > for (first_element, the_res

Re: Using mock library (written by Michael Foord)

2010-02-25 Thread Peter Otten
Lacrima wrote: > I use mock library http://www.voidspace.org.uk/python/mock/. There is > no user group for the library, so I post in comp.lang.python and hope > that people who use it will help me. > > The library allows to patch objects, using patch decorator. Patching > is done only within the

The best way to check if two lists have identical values

2010-02-25 Thread mk
Hello everyone, I have stumbled upon this seemingly trivial problem: the answer is not there in http://www.python.org/doc/faq/programming/, and googling does not return many references really (at least for me). I have come up with this: def qips_identical(q, oldq): qips = map(operator.it

Re: Walking lists

2010-02-25 Thread lallous
Thank you all for the replies. The solution using Python 3's syntax look very intuitive. Thanks Tim, Arnaud for the idea (I am using 2.x) -- Elias On Feb 25, 1:28 pm, lallous wrote: > Hello > > I am still learning Python, and have a question, perhaps I can shorten > the code: > > L = ( >   (1,

Re: Easter Eggs

2010-02-25 Thread mk
On 2010-02-25 03:04, Gabriel Genellina wrote: Also try: import antigravity Is this Py3 egg? My 2.6 doesn't seem to get it. Regards, mk -- http://mail.python.org/mailman/listinfo/python-list

Re: Spam from gmail (Was: fascism)

2010-02-25 Thread BJ Swope
> > If you like, but I tend to interpret "meta-" as idempotent. It's easier on > my aspirin budget. > > -- > Robert Kern And here I thought it was little blue pills for idempotentcy... Life is a sexually transmitted disease with a 100% fatality rate. -- brazzy Auburn fans are like slinkys

Re: why (1, 2, 3) > [1, 2, 3] is true?

2010-02-25 Thread Stefan Behnel
fat bold cyclop, 25.02.2010 14:00: > I tired to google for comparison of tuple to list but i failed. > > Could anyone explain it to me? Both are not equal, so the comparison returns an arbitrary result in Py2. Note that this was fixed in Py3: Python 3.1.1+ (r311:74480, Nov 2 2009, 15:45:00) [G

Re: Signature-based Function Overloading in Python

2010-02-25 Thread Michael Rudolf
Am 25.02.2010 11:58, schrieb Jean-Michel Pichavant: You said it yourself: "simply make two or three functions and name them appropiately" :-) When 2 methods of a class were to have the same name for doing completely different things like you said, there's a design flaw to my opinion. JM I wond

Re: The best way to check if two lists have identical values

2010-02-25 Thread Peter Otten
mk wrote: > I have stumbled upon this seemingly trivial problem: the answer is not > there in http://www.python.org/doc/faq/programming/, and googling does > not return many references really (at least for me). > > I have come up with this: > > def qips_identical(q, oldq): > qips = map(ope

Re: taking python enterprise level?...

2010-02-25 Thread D'Arcy J.M. Cain
On Thu, 25 Feb 2010 02:26:18 -0800 (PST) simn_stv wrote: > i plan to build an application, a network based application that i > estimate (and seriously hope) would get as many as 100, 000 hits a day That's nothing. I ran a financial type app on Python that sometimes hit 100,000 transactions an h

Re: The best way to check if two lists have identical values

2010-02-25 Thread Arnaud Delobelle
mk wrote: > Hello everyone, > > I have stumbled upon this seemingly trivial problem: the answer is not > there in http://www.python.org/doc/faq/programming/, and googling does > not return many references really (at least for me). > > I have come up with this: > > def qips_identical(q, oldq): >

Re: why (1, 2, 3) > [1, 2, 3] is true?

2010-02-25 Thread fat bold cyclop
> Both are not equal, so the comparison returns an arbitrary result in Py2. Thanks, Stefan. If I understand you correctly the comparison is not valid. But I wonder if there is any logic behind this (in 2.x). Is it possible to predict result of this comparison? Thanks again, fbc -- http://mail.pyt

Re: Is this secure?

2010-02-25 Thread mk
On 2010-02-25 02:07, Steven D'Aprano wrote: On Wed, 24 Feb 2010 18:23:17 +0100, mk wrote: Anyway, the passwords for authorized users will be copied and pasted from email into in the application GUI which will remember it for them, so they will not have to remember and type them in. So to brea

Re: Pure virtual functions in Python?

2010-02-25 Thread Jean-Michel Pichavant
lallous wrote: I still prefer not to call at all, even if it was an empty function. Regards, Elias Is there any way we could convince you that there is no point caring about this ? Even if you were trying to optimize speed, it would still require proof that an empty function is part of th

Re: why (1, 2, 3) > [1, 2, 3] is true?

2010-02-25 Thread Richard Thomas
On Feb 25, 2:03 pm, fat bold cyclop wrote: > > Both are not equal, so the comparison returns an arbitrary result in Py2. > > Thanks, Stefan. If I understand you correctly the comparison is not > valid. > But I wonder if there is any logic behind this (in 2.x). > Is it possible to predict result of

Re: why (1, 2, 3) > [1, 2, 3] is true?

2010-02-25 Thread Iain King
On Feb 25, 2:03 pm, fat bold cyclop wrote: > > Both are not equal, so the comparison returns an arbitrary result in Py2. > > Thanks, Stefan. If I understand you correctly the comparison is not > valid. > But I wonder if there is any logic behind this (in 2.x). > Is it possible to predict result of

Re: The best way to check if two lists have identical values

2010-02-25 Thread Daniel Stutzbach
On Thu, Feb 25, 2010 at 7:30 AM, mk wrote: > There's a number of complications here, depending on definition of 'lists > with identical values', like whether the same value can be repeated > different number of times in two lists, or whether the order of values > matters. > Order and repetitions

Re: Walking lists

2010-02-25 Thread Jean-Michel Pichavant
lallous wrote: Thank you all for the replies. The solution using Python 3's syntax look very intuitive. Thanks Tim, Arnaud for the idea (I am using 2.x) -- Elias On Feb 25, 1:28 pm, lallous wrote: Hello I am still learning Python, and have a question, perhaps I can shorten the code: L =

Re: The best way to check if two lists have identical values

2010-02-25 Thread mk
On 2010-02-25 14:55, Arnaud Delobelle wrote: Your code checks if the two lists have the same length and the same elements, but not necessarily the same number of each elements. E.g. qips = [1, 1, 2] oldqips = [1, 2, 2] will return True If you want to check if each value has the same

Re: why (1, 2, 3) > [1, 2, 3] is true?

2010-02-25 Thread Stefan Behnel
fat bold cyclop, 25.02.2010 15:03: >> Both are not equal, so the comparison returns an arbitrary result in Py2. > Thanks, Stefan. If I understand you correctly the comparison is not > valid. > But I wonder if there is any logic behind this (in 2.x). > Is it possible to predict result of this compar

Re: Is this secure?

2010-02-25 Thread mk
On 2010-02-25 02:31, Paul Rubin wrote: It might be helpful if you could say what your application does, or anyway give an idea of what its actual security requirements are. Generating and emailing someone a random password is a fairly standard method for (e.g.) web forums to verify that the perso

Re: What's the word on using """ to comment-out?

2010-02-25 Thread Grant Edwards
On 2010-02-25, Paul Rudin wrote: > kj writes: > >> I think I remember, early in my learning of Python, coming across >> the commandment "THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT >> LINES OF CODE", or something to that effect. But now I can't find >> it! > > No idea, but it would be nice t

Renaming identifiers & debugging

2010-02-25 Thread Luca
Hello, i am trying to develop an application to teach programming to young kids in a similar way as Logo did in the past. I would like to use an embedded Python as underlying language but this raises a problem. The target of my app are very young kids that might be unfamiliar with english, so

Re: taking python enterprise level?...

2010-02-25 Thread Martin P. Hellwig
On 02/25/10 13:58, D'Arcy J.M. Cain wrote: On Thu, 25 Feb 2010 02:26:18 -0800 (PST) Our biggest problem was in a network heavy element of the app and that was low level TCP/IP stuff that rather than being Python's problem was something we used Python to fix. Out off interest, could you elabo

round() function

2010-02-25 Thread Tracubik
hi all, i've this sample code: >>> n = 4.499 >>> str(round(n,2)) '4.5' that's right, but what i want is '4.50' to be displayed instead of '4.5'. Off course i know that 4.5 = 4.50, still i'ld like to have 4.50. How can I solve this? Thanks in advance Nico -- http://mail.python.org/mailman/listi

Re: round() function

2010-02-25 Thread Tim Chase
Tracubik wrote: n = 4.499 str(round(n,2)) '4.5' that's right, but what i want is '4.50' to be displayed instead of '4.5'. Off course i know that 4.5 = 4.50, still i'ld like to have 4.50. Use string formatting: >>> "%0.2f" % round(4.499, 2) '4.50' -tkc -- http://mail.python.org/mailma

Re: round() function

2010-02-25 Thread mailing list
On 25.2.2010. 16:39, Tracubik wrote: hi all, i've this sample code: n = 4.499 str(round(n,2)) '4.5' that's right, but what i want is '4.50' to be displayed instead of '4.5'. Off course i know that 4.5 = 4.50, still i'ld like to have 4.50. How can I solve this? Thanks in advanc

Re: round() function

2010-02-25 Thread Stefan Behnel
Tracubik, 25.02.2010 16:39: > hi all, i've this sample code: > n = 4.499 str(round(n,2)) > '4.5' > > that's right, but what i want is '4.50' to be displayed instead of '4.5'. > Off course i know that 4.5 = 4.50, still i'ld like to have 4.50. > > How can I solve this? Format the number

Re: What's the word on using """ to comment-out?

2010-02-25 Thread Michael Rudolf
Am 25.02.2010 16:07, schrieb Grant Edwards: On 2010-02-25, Paul Rudin wrote: No idea, but it would be nice to have some multiline comment syntax (other than # at the beginning of each line). Particularly one that can be nested. if 0: Seriously, that's what I generally do: mark the block of c

Can I specify regex group to return float or int instead of string?

2010-02-25 Thread Jeremy
I have a regular expression that searches for some numbers and puts them into a dictionary, i.e. '(?P\d+)\s+(?P\d+\.\d+)' Is it possible to have the results of the matches returned as int or float objects instead of strings? Thanks, Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommended "new" way for config files

2010-02-25 Thread Nicola Larosa (tekNico)
Peter wrote: > There seems to be several strategies to enhance the old ini-style config > files with real python code > [...] > Is there a strategy that should be prefered for new projects ? 5) Use ConfigObj , by Michael Foord and yours truly. It

Re: When will Java go mainstream like Python?

2010-02-25 Thread Mel
sjdevn...@yahoo.com wrote: > You're right that ref counting in many implementations is more > deterministic than other common forms of garbage collection; IMO, > Python would be well-served by making the ref-counting semantics it > currently has a guaranteed part of the language spec--or at least

Re: round() function

2010-02-25 Thread Michael Rudolf
Am 25.02.2010 16:39, schrieb Tracubik: hi all, i've this sample code: n = 4.499 str(round(n,2)) '4.5' that's right, but what i want is '4.50' to be displayed instead of '4.5'. Off course i know that 4.5 = 4.50, still i'ld like to have 4.50. How can I solve this? Thanks in advance Nico Thi

Re: A more pythonish code

2010-02-25 Thread nn
prasad_chand wrote: > Hi, > > I use python to do simple math problems as a hobby. > > I have made a program that finds the number of divisors(factors) of a > given number. I am hoping to improve my language skills, specifically > I would like to re-write the function "prime_factors" more graceful

Re: taking python enterprise level?...

2010-02-25 Thread D'Arcy J.M. Cain
On Thu, 25 Feb 2010 15:29:34 + "Martin P. Hellwig" wrote: > On 02/25/10 13:58, D'Arcy J.M. Cain wrote: > > On Thu, 25 Feb 2010 02:26:18 -0800 (PST) > > > Our biggest problem was in > > a network heavy element of the app and that was low level TCP/IP stuff > > that rather than being Python's p

Re: Signature-based Function Overloading in Python

2010-02-25 Thread Bruno Desthuilliers
Michael Rudolf a écrit : (snip) (pseudocode - this is *not* python ;) class Machines (Object): @classmethod def shutdown(cls, Machine, emergency=False): try: if Machine is instanceof(Fileservers): if not emergency: Machine.unmount_raid_first

hs.py = run an exec and pipe back the result as a member of a list

2010-02-25 Thread '2+
did this for hascillator01 that i ghc-ed from hascillator01.hs into ./ import popen2 wave = [] for frame in range(890, 1010): wave.append(int(popen2.Popen3('./hascillator01 ' + str(frame)).fromchild.readline())) print wave hascillator01 takes int and returns another int so yes this became a [int

Re: hs.py = run an exec and pipe back the result as a member of a list

2010-02-25 Thread '2+
oops the code was wrong .. sorry import popen2 wave = [] for frame in range(890, 1010): wave.append(int(popen2.Popen3('./hascillator01 ' + str(frame)).fromchild.readline())) print wave On Fri, Feb 26, 2010 at 1:22 AM, '2+ wrote: > did this for hascillator01 that i ghc-ed from hascillator01.

Re: Is this secure?

2010-02-25 Thread Robert Kern
On 2010-02-25 09:03 AM, mk wrote: 2. The app will have GUI and it will be locally installed; it's not going to be web app, it will just be online in the sense of downloading data frequently from the net. If you are storing the password instead of making your user remember it, most platforms h

Re: Easter Eggs

2010-02-25 Thread Aahz
In article , mk wrote: >On 2010-02-25 03:04, Gabriel Genellina wrote: >> >> Also try: >> import antigravity > >Is this Py3 egg? My 2.6 doesn't seem to get it. Maybe 2.7 will have it; 3.0.1 does. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Many customs in t

Re: Trouble with ftplib uploading to an FTP server

2010-02-25 Thread Sky Larking
On Feb 25, 1:10 am, Dennis Lee Bieber wrote: > On Wed, 24 Feb 2010 17:21:58 -0800 (PST), Sky Larking > declaimed the following in > gmane.comp.python.general: > > > For instance I just ran the script and os.rename() renamed it to: > > > TestMachine.local @ 02-24-2010 2020.txt > > > in that .txt f

Re: taking python enterprise level?...

2010-02-25 Thread Aahz
In article <5cd38064-34d6-40d3-b3dc-2c853fc86...@i39g2000yqm.googlegroups.com>, simn_stv wrote: > >i plan to build an application, a network based application that i >estimate (and seriously hope) would get as many as 100, 000 hits a day >(hehe,...my dad always told me to 'AIM HIGH' ;0), not some

CGI File Upload Problem with Python 3.1 on IIS 7

2010-02-25 Thread huseyin
I am trying to upload files through cgi script written in python 3.1 on a Windows IIS 7 server. The server time out when I write in usual way that is form=cgi.cgi.FieldStorage() fileitem = form['filename'] fn = os.path.basename(fileitem.filename) open('/tmp/' + fn, 'wb').write(fileitem.file.read()

Re: What's the word on using """ to comment-out?

2010-02-25 Thread Grant Edwards
On 2010-02-25, Michael Rudolf wrote: > Am 25.02.2010 16:07, schrieb Grant Edwards: >> On 2010-02-25, Paul Rudin wrote: >>> No idea, but it would be nice to have some multiline comment syntax >>> (other than # at the beginning of each line). Particularly one that can >>> be nested. >> >> if 0: >>

Re: Can I specify regex group to return float or int instead of string?

2010-02-25 Thread Steven D'Aprano
On Thu, 25 Feb 2010 07:48:44 -0800, Jeremy wrote: > I have a regular expression that searches for some numbers and puts them > into a dictionary, i.e. > > '(?P\d+)\s+(?P\d+\.\d+)' > > Is it possible to have the results of the matches returned as int or > float objects instead of strings? No. Ju

Re: Renaming identifiers & debugging

2010-02-25 Thread Steven D'Aprano
On Thu, 25 Feb 2010 16:26:32 +0100, Luca wrote: > Hello, i am trying to develop an application to teach programming to > young kids in a similar way as Logo did in the past. I would like to use > an embedded Python as underlying language but this raises a problem. > > The target of my app are ver

Re: Why tarfile.TarFile.gzopen is not in the online documentation?

2010-02-25 Thread Lars Gustäbel
On Wed, Feb 24, 2010 at 04:29:18PM -0500, Terry Reedy wrote: > On 2/24/2010 5:14 AM, Lars Gustäbel wrote: >> On Wed, Feb 24, 2010 at 09:37:19AM +0100, Baptiste Lepilleur wrote: >>> I stumbled uppon this and find it somewhat odd: some class methods of >>> TarFile and TarInfo do not appears in either

Re: Can I specify regex group to return float or int instead of string?

2010-02-25 Thread Jeremy
On Feb 25, 9:41 am, Steven D'Aprano wrote: > On Thu, 25 Feb 2010 07:48:44 -0800, Jeremy wrote: > > I have a regular expression that searches for some numbers and puts them > > into a dictionary, i.e. > > > '(?P\d+)\s+(?P\d+\.\d+)' > > > Is it possible to have the results of the matches returned as

Re: taking python enterprise level?...

2010-02-25 Thread Roy Smith
In article , "D'Arcy J.M. Cain" wrote: > The problem had to do with the way TCP/IP works, especially closer to > the core. Our provider was collecting data and sending it only after > filling a buffer or after a timeout. The timeout was short so it > wouldn't normally be noticed and in most ca

Re: Renaming identifiers & debugging

2010-02-25 Thread Luca
Chris Rebert wrote: On Thu, Feb 25, 2010 at 7:26 AM, Luca wrote: Hello, i am trying to develop an application to teach programming to young kids in a similar way as Logo did in the past. I would like to use an embedded Python as underlying language but this raises a problem. The target of my a

Re: Pedantic pickling error after reload?

2010-02-25 Thread Diez B. Roggisch
Am 25.02.10 18:08, schrieb Robert: After (intended/controlled) reload or similar action on a module/class the pickle/cPickle.dump raises errors like pickle.PicklingError: Can't pickle : it's not the same object as somemodule.SomeClass Cause in pickle.py (and cPickle) is a line "if klass is not

Best auto insurance company

2010-02-25 Thread coolboy8
Find the Best auto insurance company here please visit http://autoinsurancerathere.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Why tarfile.TarFile.gzopen is not in the online documentation?

2010-02-25 Thread Terry Reedy
On 2/25/2010 11:51 AM, Lars Gustäbel wrote: On Wed, Feb 24, 2010 at 04:29:18PM -0500, Terry Reedy wrote: On 2/24/2010 5:14 AM, Lars Gustäbel wrote: On Wed, Feb 24, 2010 at 09:37:19AM +0100, Baptiste Lepilleur wrote: I stumbled uppon this and find it somewhat odd: some class methods of TarFile

Re: taking python enterprise level?...

2010-02-25 Thread Martin P. Hellwig
On 02/25/10 16:18, D'Arcy J.M. Cain wrote: Very interesting, I had a similar kind of problem (a network balancer that doesn't balance small tcp packages too well) and solved it by wrapping the TCP package in UDP. UDP was treated differently, although in overall switch and router manager it has

Re: Renaming identifiers & debugging

2010-02-25 Thread Chris Rebert
On Thu, Feb 25, 2010 at 7:26 AM, Luca wrote: > Hello, i am trying to develop an application to teach programming to young > kids in a similar way as Logo did in the past. I would like to use an > embedded Python as underlying language but this raises a problem. > > The target of my app are very yo

Re: When will Java go mainstream like Python?

2010-02-25 Thread Wanja Gayk
Am 25.02.2010, 02:05 Uhr, schrieb Lawrence D'Oliveiro : In message , Wanja Gayk wrote: Reference counting is about the worst technique for garbage collection. It avoids the need for garbage collection. It means I can write things like contents = open(filename, "r").read() and know

Re: Renaming identifiers & debugging

2010-02-25 Thread MRAB
Luca wrote: Chris Rebert wrote: On Thu, Feb 25, 2010 at 7:26 AM, Luca wrote: Hello, i am trying to develop an application to teach programming to young kids in a similar way as Logo did in the past. I would like to use an embedded Python as underlying language but this raises a problem. The

Re: Artificial Neural Networks recommendation wanted

2010-02-25 Thread Gereon Kaiping
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, >> - - PyNN (just a builder, requires external simulator) >> –http://neuralensemble.org/trac/PyNN/ >> - - Con-x (part of pyro) –http://pyrorobotics.org/?page=Conx >> - - PyNeurGen (includes genetic algorithms) >> –http://pyneurgen.sourceforge.ne

Re: Walking lists

2010-02-25 Thread Mensanator
On Feb 25, 7:02 am, Tim Chase wrote: > Python 3 introduced a variable tuple assignment which I > suspect[*] would work in this context: > >    for first, *rest in L: # note the asterisk >      print first >      for x in rest: >        do_stuff(x) > > [*] not having py3 on this machine, I can't re

Re: Renaming identifiers & debugging

2010-02-25 Thread Diez B. Roggisch
Am 25.02.10 20:27, schrieb Luca: Chris Rebert wrote: On Thu, Feb 25, 2010 at 7:26 AM, Luca wrote: Hello, i am trying to develop an application to teach programming to young kids in a similar way as Logo did in the past. I would like to use an embedded Python as underlying language but this rai

Re: why (1, 2, 3) > [1, 2, 3] is true?

2010-02-25 Thread Terry Reedy
On 2/25/2010 9:21 AM, Richard Thomas wrote: On Feb 25, 2:03 pm, fat bold cyclop wrote: Both are not equal, so the comparison returns an arbitrary result in Py2. Thanks, Stefan. If I understand you correctly the comparison is not valid. But I wonder if there is any logic behind this (in 2.x).

Re: Can I specify regex group to return float or int instead of string?

2010-02-25 Thread nn
On Feb 25, 12:20 pm, Steven D'Aprano wrote: > On Thu, 25 Feb 2010 09:00:07 -0800, Jeremy wrote: > > On Feb 25, 9:41 am, Steven D'Aprano > cybersource.com.au> wrote: > >> On Thu, 25 Feb 2010 07:48:44 -0800, Jeremy wrote: > >> > I have a regular expression that searches for some numbers and puts >

Re: os.pipe() + os.fork()

2010-02-25 Thread Aahz
In article <256926de-e175-4fa2-aa24-dbd5f9675...@u20g2000yqu.googlegroups.com>, sebastian.no...@googlemail.com wrote: >On Feb 20, 8:13=A0pm, Gary Herron wrote: >> >> Here's a thought: =A0Consider the subprocess module. =A0 It can do thefor= >k >> and any necessary pipes and can do so in an OS ind

Re: Pure virtual functions in Python?

2010-02-25 Thread Aahz
In article <38ddd614-583c-430d-b998-214bd6360...@b2g2000yqi.googlegroups.com>, lallous wrote: >On Feb 22, 12:42=A0am, Gregory Ewing >wrote: >> lallouswrote: >>> >>> If the base defines the method and it was empty, then my C++ code >>> would still call the function. This is not optimal because I

  1   2   >