Re: scope of generators, class variables, resulting in global na

2010-02-25 Thread Arnaud Delobelle
dontspamleo writes: > Hi Arnaud et al, > > Here is the link to the bug report from which the discussion in PEP > 289 was extracted: > > http://bugs.python.org/issue872326 > > It looks like they were fixing a bunch of bugs and that this > discussion was one of the many in that thread. > > Here is

Hi, I know it's stupid, but does your foreigner do a lot of OT work?

2010-02-25 Thread Gao
I'm Chinese, I'm working in a famous vendor company which let employee do a lot of OT work, 2 more hours per day, and sometime work in weekend. Is that the same in USA and European? -- http://mail.python.org/mailman/listinfo/python-list

Re: staticmethod and namespaces

2010-02-25 Thread Steven D'Aprano
On Thu, 25 Feb 2010 21:07:55 -0800, darnzen wrote: > Having an odd problem that I solved, but wondering if its the best > solution (seems like a bit of a hack). > > First off, I'm using an external DLL that requires static callbacks, but > because of this, I'm losing instance info. [...] > How ca

staticmethod and namespaces

2010-02-25 Thread darnzen
Having an odd problem that I solved, but wondering if its the best solution (seems like a bit of a hack). First off, I'm using an external DLL that requires static callbacks, but because of this, I'm losing instance info. It could be import related? It will make more sense after I diagram it: #Mo

staticmethod and namespaces

2010-02-25 Thread darnzen
Having an odd problem that I solved, but wondering if its the best solution (seems like a bit of a hack). First off, I'm using an external DLL that requires static callbacks, but because of this, I'm losing instance info. It will make more sense after I diagram it: #Module main.py class App:

Re: taking python enterprise level?...

2010-02-25 Thread D'Arcy J.M. Cain
On Fri, 26 Feb 2010 01:12:00 +0100 "Diez B. Roggisch" wrote: > > That better way turned out to asynchronous update transactions. All we > > did was keep feeding updates to the remote site and forget about ACKS. > > We then had a second process which handled ACKS and tracked which > > packets had

Re: Executable problem - socket?

2010-02-25 Thread Gib Bogle
MRAB wrote: You could try Dependency Walker: http://dependencywalker.com/ I have (belatedly) read the py2exe tutorial: http://www.py2exe.org/index.cgi/Tutorial#Step522 and learned about the msvcr90.dll issue. I haven't finished sorting this out yet, but I did find that running vcredist_x86.

Re: When will Java go mainstream like Python?

2010-02-25 Thread Steven D'Aprano
On Thu, 25 Feb 2010 17:00:32 -0800, Mensanator wrote: > Is that really considered a leak, a single instance of an uncollected > global as opposed to a function that is called millions of times, and > each time it's called creates uncollected temporary variables? I think it's generally called "gar

Re: When will Java go mainstream like Python?

2010-02-25 Thread Mensanator
On Feb 25, 6:41 pm, "Alf P. Steinbach" wrote: > * Chris Gray: > > > Lawrence D'Oliveiro writes: > > >> 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 >

Re: When will Java go mainstream like Python?

2010-02-25 Thread Steven D'Aprano
On Thu, 25 Feb 2010 17:11:32 -0700, Chris Gray wrote: > I'm by no means an expert, but how does reference counting deal with > arbitrary long cycles of references (btw I've *written* a simple > reference counter for a programming language)? It doesn't, or at least the CPython one doesn't. In CPy

Re: How would I do a continuous write over a pipe in the following code...

2010-02-25 Thread Aahz
In article <9d0f6456-97c7-4bde-8e07-9576b02f9...@t31g2000prh.googlegroups.com>, chad wrote: > >import subprocess as s > >broadcast = s.Popen("echo test | wall", shell=True,stdout=s.PIPE) > >out = broadcast.stdout >while 1: >out >broadcast.wait() > >broadcast.stdout.close() > > >The code o

Re: When will Java go mainstream like Python?

2010-02-25 Thread Alf P. Steinbach
* Chris Gray: Lawrence D'Oliveiro writes: 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 I'm by no means an expert, but how does reference counting deal with

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

2010-02-25 Thread Robert Kern
On 2010-02-25 18:29 PM, r wrote: On Feb 25, 7:00 am, fat bold cyclop wrote: why (1, 2, 3)> [1, 2, 3] is true? It's simple, Everything must have a value! That is not at all an explanation, much less a true one. Please read the other posts in this thread; they have explained the situation r

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

2010-02-25 Thread r
On Feb 25, 7:00 am, fat bold cyclop wrote: > why (1, 2, 3) > [1, 2, 3] is true? It's simple, Everything must have a value! -- http://mail.python.org/mailman/listinfo/python-list

Re: Renaming identifiers & debugging

2010-02-25 Thread Ethan Furman
Luca wrote: [snippety] Maybe you are right, but being italian myself i can remember when i was a middle schooler (no computer before that) and the hours spent on my MSX figuring out how the thing worked. I learned all the commands as "brandnames" without really understanding them. I had _no_

Re: taking python enterprise level?...

2010-02-25 Thread Diez B. Roggisch
That better way turned out to asynchronous update transactions. All we did was keep feeding updates to the remote site and forget about ACKS. We then had a second process which handled ACKS and tracked which packets had been properly transferred. The system had IDs on each update and retries hap

Re: When will Java go mainstream like Python?

2010-02-25 Thread Chris Gray
Lawrence D'Oliveiro writes: > 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 I'm by no means an expert, but how does reference counting deal with arbitr

Re: Compiling and running 32-bit Python on 64-bit server?

2010-02-25 Thread Aahz
In article , Mikko Ohtamaa wrote: > >How one could create 32-bit Python run-time enviroment, preferable >virtualenv, on 64-bit Linux (VPS), reducing memory usage? This >environment could actually beat 64-bit in performance, due to better >memory cache use. > >I assume this involves having lib32 l

Re: Renaming identifiers & debugging

2010-02-25 Thread Diez B. Roggisch
On a related note, did you investigate SUGAR of the OLPC? I'd say these guys certainly tried to create something that appealed to children, and AFAIK it comes with a Python interpreter. I'm don't know anything about that, nor if it comes with learning material. Might be worth checking out. Die

Re: Renaming identifiers & debugging

2010-02-25 Thread Luca
News123 wrote: a pragmatic approach might be to preprocess the source code and keep the original version as comments above the translated line. (for debugging) Not very nice to see though. This change should be transparent to the kid, he/she should not be aware of this "translation". or to

Re: Renaming identifiers & debugging

2010-02-25 Thread Diez B. Roggisch
And also I don't think that your concerns are valid in general. Keywords are like brandnames or other things - the stand for a concept, and people immediatly accept them when they want them. Maybe you are right, but being italian myself i can remember when i was a middle schooler (no computer be

Re: Renaming identifiers & debugging

2010-02-25 Thread Luca
MRAB wrote: Perhaps you could use a different extension, eg ".pyn", so existing ".py" files are handled as-is but ".pyn" files are read through a translator. This could be a good idea... especially since i could make my own extension since we are talking of a special-purpose application that

Re: Renaming identifiers & debugging

2010-02-25 Thread News123
Hi Luca, 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 young kids that might be

Re: Renaming identifiers & debugging

2010-02-25 Thread Luca
Diez B. Roggisch wrote: You could use import-hooks for importing your code. There was a python-magazine article a while ago that showed how to use that + a parser to import seamlessly a DSL. I will look into this, right now i don't know what import-hooks are nor if i can use them from embedde

Re: compiling python question

2010-02-25 Thread Diez B. Roggisch
Am 25.02.10 01:55, schrieb Mag Gam: sorry for the vague answer. Its Linux. The configure build does not say anything actually. This is for SAGE. I managed to have it pick it up by compiling/installing tcl and tk and then recompile python Then most probably installing the tk-dev packages would

Re: scope of generators, class variables, resulting in global na

2010-02-25 Thread dontspamleo
Hi Arnaud et al, Here is the link to the bug report from which the discussion in PEP 289 was extracted: http://bugs.python.org/issue872326 It looks like they were fixing a bunch of bugs and that this discussion was one of the many in that thread. Here is another post which points to the core of

Re: Docstrings considered too complicated

2010-02-25 Thread John Roth
On Feb 24, 1:23 pm, Andreas Waldenburger wrote: > Hi all, > > a company that works with my company writes a lot of of their code in > Python (lucky jerks). I've seen their code and it basically looks like > this: > > """Function that does stuff""" > def doStuff(): >     while not wise(up): >      

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

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: 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: 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: 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

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: 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

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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: >>

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: 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

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: 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: 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: 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.

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: 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

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: 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: 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: 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: 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

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: 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

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: 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 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

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: 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

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: 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

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: 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: 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: 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 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: 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: 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: 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: 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: 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: 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: 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 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: 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: 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: 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: 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: 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,

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: 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

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: 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: 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: 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: 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,

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: 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

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: 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: 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:

  1   2   >