[ANN] HDF5 for Python 1.3 beta

2010-02-24 Thread Andrew Collette
HDF5 for Python (h5py) 1.3.0 BETA = I'm pleased to announce that HDF5 for Python 1.3 is now available! This is a significant release introducing a number of new features, including support for soft/external links as well as object and region references. I

Introduction to Python with @dabeaz, March 16-18, 2010 in Chicago

2010-02-24 Thread David Beazley
* * Introduction to Python Programming * * with David Beazley, author Python Essential Reference March 16-18, 2010 Chicago, Illinois http://www.dabeaz.com/chicago Join Python book author and developer

ANN: Pyrex 0.9.8.6

2010-02-24 Thread Greg Ewing
Pyrex 0.9.8.6 is now available: http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/ Numerous bug fixes and a few improvements. See the CHANGES page on the web site for details. What is Pyrex? -- Pyrex is a language for writing Python extension modules. It lets you freely

Re: Is this secure?

2010-02-24 Thread Paul Rubin
Steven D'Aprano ste...@remove.this.cybersource.com.au writes: Given a random six character password taken out of an alphabet of 52 characters, it takes over nine billion attempts to brute force it. Reducing the alphabet by 50% cuts that down to less than 200 million. To make up for that

Re: MODULE FOR I, P FRAME

2010-02-24 Thread DANNY
On Feb 24, 3:11 am, Rhodri James rho...@wildebst.demon.co.uk wrote: On Tue, 23 Feb 2010 10:39:21 -, DANNY danijel.gv...@gmail.com wrote: @James I am thinkinhg about effect of errors that are within the sequence of P frames. Where the P frames have only the information about the changes

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

2010-02-24 Thread Baptiste Lepilleur
I stumbled uppon this and find it somewhat odd: some class methods of TarFile and TarInfo do not appears in either the online documentation or search while they have a doc string: http://docs.python.org/search.html?q=gzopen

Re: Use eval() safely?

2010-02-24 Thread Dieter Maurer
Steven D'Aprano ste...@remove.this.cybersource.com.au writes on 22 Feb 2010 06:07:05 GMT: ... It's *especially* not safe if you put nothing in the globals dict, because Python kindly rectifies that by putting the builtins into it: eval(__builtins__.keys(), {}, {}) ['IndexError', 'all',

Re: Pure virtual functions in Python?

2010-02-24 Thread Jean-Michel Pichavant
Arnaud Delobelle wrote: lallous elias.bachaal...@gmail.com writes: Hello How can I do something similar to pure virtual functions in C++ ? Let us consider this: class C1: # Pure virtual def cb(self, param1, param2): This is a callback @param param1: ...

while loop with the condition used in the body

2010-02-24 Thread Ulrich Eckhardt
Hi! I'm looking for a way to write code similar to this C code: while(rq = get_request(..)) { handle_request(rq); } Currently I'm doing while True: rq = get_request(...) if not rq: break handle_request(rq) in Python 2.6. Any suggestions how to rewrite

Re: while loop with the condition used in the body

2010-02-24 Thread Arnaud Delobelle
Ulrich Eckhardt wrote: Hi! I'm looking for a way to write code similar to this C code: while(rq = get_request(..)) { handle_request(rq); } Currently I'm doing while True: rq = get_request(...) if not rq: break handle_request(rq) in Python

Re: while loop with the condition used in the body

2010-02-24 Thread Peter Otten
Ulrich Eckhardt wrote: I'm looking for a way to write code similar to this C code: while(rq = get_request(..)) { handle_request(rq); } Currently I'm doing while True: rq = get_request(...) if not rq: break handle_request(rq) in Python 2.6.

Re: Signature-based Function Overloading in Python

2010-02-24 Thread Jean-Michel Pichavant
Michael Rudolf wrote: Just a quick question about what would be the most pythonic approach in this. In Java, Method Overloading is my best friend, but this won't work in Python: def a(): pass def a(x): pass a() Traceback (most recent call last): File pyshell#12, line 1, in

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

2010-02-24 Thread Lars Gustäbel
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 the online documentation or search while they have a doc string: http://docs.python.org/search.html?q=gzopen

Re: while loop with the condition used in the body

2010-02-24 Thread Duncan Booth
Peter Otten __pete...@web.de wrote: Ulrich Eckhardt wrote: I'm looking for a way to write code similar to this C code: while(rq = get_request(..)) { handle_request(rq); } Assuming get_request(...) is called with the same arguments on each iteration and uses None to signal

Re: while loop with the condition used in the body

2010-02-24 Thread Peter Otten
Duncan Booth wrote: Peter Otten __pete...@web.de wrote: Ulrich Eckhardt wrote: I'm looking for a way to write code similar to this C code: while(rq = get_request(..)) { handle_request(rq); } Assuming get_request(...) is called with the same arguments on each iteration and

Re: Creating variables from dicts

2010-02-24 Thread Luis M . González
On Feb 24, 4:08 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Tue, 23 Feb 2010 20:44:10 -0800, Luis M. González wrote: On Feb 24, 1:15 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Tue, 23 Feb 2010 19:47:22 -0800, Luis M. González wrote: On Feb

Re: Creating variables from dicts

2010-02-24 Thread Luis M . González
On Feb 24, 7:44 am, Luis M. González luis...@gmail.com wrote: On Feb 24, 4:08 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Tue, 23 Feb 2010 20:44:10 -0800, Luis M. González wrote: On Feb 24, 1:15 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote:

selma blair salma hayek salma hayek hot salma hayek wallpapers hollywood sexiest scenes hollywood blue films hollywood movies free download on http://sexyandpretty-girls.blogspot.com/

2010-02-24 Thread Naeem
selma blair salma hayek salma hayek hot salma hayek wallpapers hollywood sexiest scenes hollywood blue films hollywood movies free download on http://sexyandpretty-girls.blogspot.com/ selma blair salma hayek salma hayek hot salma hayek wallpapers hollywood sexiest scenes hollywood blue films

Re: Creating variables from dicts

2010-02-24 Thread Bruno Desthuilliers
Luis M. González a écrit : (snip) Alright, this is what the docs say about locals: Note The built-in functions globals() and locals() return the current global and local dictionary, respectively, which may be useful to pass around for use as the second and third argument to exec(). Note The

scope of generators, class variables, resulting in global na

2010-02-24 Thread Nomen Nescio
Hello, Can someone help me understand what is wrong with this example? class T: A = range(2) B = range(4) s = sum(i*j for i in A for j in B) It produces the exception: type 'exceptions.NameError': global name 'j' is not defined The exception above is especially confusing since the

WANTED: Regular expressions for breaking TeX/LaTeX document into tokens

2010-02-24 Thread Jonathan Fine
Hi Does anyone know of a collection of regular expressions that will break a TeX/LaTeX document into tokens? Assume that there is no verbatim or other category code changes. Thanks Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating variables from dicts

2010-02-24 Thread Bruno Desthuilliers
Luis M. González a écrit : On Feb 23, 5:53 pm, vsoler vicente.so...@gmail.com wrote: Hi, I have two dicts n={'a', 'm', 'p'} v={1,3,7} and I'd like to have a=1 m=3 p=7 that is, creating some variables. How can I do this? You are probably coming from another language and you're not used

Re: Signature-based Function Overloading in Python

2010-02-24 Thread Michael Rudolf
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 do it, 1 interface.

Re: while loop with the condition used in the body

2010-02-24 Thread Ulrich Eckhardt
Peter Otten wrote: Duncan Booth wrote: for rq in incoming_requests(...): handle_request(rq) ...and a likely implementation would be def incoming_requests(...): while True: rq = ... # inlined version of get_request() if not rq: break yield rq

Re: Creating variables from dicts

2010-02-24 Thread Bruno Desthuilliers
Luis M. González a écrit : On Feb 23, 10:41 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Tue, 23 Feb 2010 15:41:16 -0800, Luis M. González wrote: By the way, if you want the variables inside myDict to be free variables, you have to add them to the local namespace. The

Re: Fascism is coming to Internet

2010-02-24 Thread Joan Miller
On 23 feb, 20:16, D'Arcy J.M. Cain da...@druid.net wrote: On Tue, 23 Feb 2010 20:30:03 +0100 Olof Bjarnason olof.bjarna...@gmail.com wrote: Even if this is Off Topic (which I think it really isn't in any open source / free software-oriented mailing list), I want to agree with Joan. It

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

2010-02-24 Thread Alf P. Steinbach
* Nomen Nescio: Hello, Can someone help me understand what is wrong with this example? class T: A = range(2) B = range(4) s = sum(i*j for i in A for j in B) It produces the exception: type 'exceptions.NameError': global name 'j' is not defined Which Python implementation are you

Artificial Neural Networks recommendation

2010-02-24 Thread Gereon Kaiping
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I'd like to use ANNs in python, especially Simple Recurrent Networks. Ideally I'd like to find a quick, pythonic module that is able to simulate different styles of network architectures including some types of recurrent networks (must:

Re: Artificial Neural Networks recommendation

2010-02-24 Thread Paul Rudin
Gereon Kaiping gereon.kaip...@yahoo.de writes: Are there other modules for simulating ANNs? Fann http://leenissen.dk/fann/ has python bindings. -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating variables from dicts

2010-02-24 Thread Luis M . González
On Feb 24, 8:48 am, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote: Luis M. Gonz lez a crit : (snip) Alright, this is what the docs say about locals: Note The built-in functions globals() and locals() return the current global and local dictionary, respectively,

Re: When will Python go mainstream like Java?

2010-02-24 Thread Steve Holden
At 12.34 pm on November 13, 2011 regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/ Holden Web LLC http://www.holdenweb.com/ UPCOMING EVENTS:http://holdenweb.eventbrite.com/ --

Re: ANN: Leo 4.7 final released

2010-02-24 Thread Edward K Ream
On Tue, 23 Feb 2010 07:53:44 -0600, Edward K Ream edream...@gmail.com wrote: A critical bug has been reported against Leo 4.7 final, and indeed all previous versions of Leo 4.7. The bug can cause loss of data in @file nodes when Leo 4.7 saves .leo files created with older versions of Leo. This

Re: When will Python go mainstream like Java?

2010-02-24 Thread Steve Holden
Stefan Behnel wrote: Chris Rebert, 23.02.2010 06:45: Indeed. Python is at position 7, just behind C#, in the TIOBE Index: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html That index is clearly flawed. A language like PHP (whatever that is supposed to be comparable with)

Re: How to make an empty generator?

2010-02-24 Thread Steve Holden
John Posner wrote: On 2/19/2010 2:25 PM, Terry Reedy wrote: On 2/19/2010 12:44 PM, Stephen Hansen wrote: Much to my embarrassment, sometime last night I realized I was being a complete idiot, and the 'correct' way to handle this in my scenario is really just: def initialize(): # do one

Can't Connect To SMTP

2010-02-24 Thread Victor Subervi
Hi; I'm getting this error: A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred. /var/www/html/globalsolutionsgroup.vi/simplemail/mail2.py 52 /head 53 body''' 54 my_mail() 55 print ''' 56 /body my_mail

Re: Creating variables from dicts

2010-02-24 Thread Bruno Desthuilliers
Luis M. González a écrit : On Feb 24, 8:48 am, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote: Luis M. Gonz lez a crit : And what about the trick of updating globals? Is it legal? It's legal, but it's (usually) a very bad idea - at the top-level, it harms

Re: How to make an empty generator?

2010-02-24 Thread John Posner
On 2/24/2010 9:07 AM, Steve Holden wrote: John Posner wrote: Note that the Py2.6.4 documentation is inconsistent. AFAICT, it conforms to Terry's definitions above in most places. But the Glossary says: generator A function which returns an iterator more ... generator expression

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

2010-02-24 Thread b3ng0
On Feb 24, 5:52 am, Nomen Nescio nob...@dizum.com wrote: Hello, Can someone help me understand what is wrong with this example? class T:   A = range(2)   B = range(4)   s = sum(i*j for i in A for j in B) It produces the exception: type 'exceptions.NameError': global name 'j' is not

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

2010-02-24 Thread Jon Clements
On Feb 24, 12:21 pm, Alf P. Steinbach al...@start.no wrote: * Nomen Nescio: Hello, Can someone help me understand what is wrong with this example? class T:   A = range(2)   B = range(4)   s = sum(i*j for i in A for j in B) It produces the exception: type

Re: Spam from gmail (Was: fascism)

2010-02-24 Thread Robert Kern
On 2010-02-23 22:09 PM, Grant Edwards wrote: On 2010-02-24, Robert Kernrobert.k...@gmail.com wrote: comp.lang.python.spam_prevention_discussion Which doesn't exist and never will. Sorry, but meta-discussions about the group are typically on-topic for all groups with some few exceptions

Re: When will Python go mainstream like Java?

2010-02-24 Thread Peter Parker
Steve Holden wrote: At 12.34 pm on November 13, 2011 At December 21, 2012 at 11:11 am (according to the Maya calendar) -- http://mail.python.org/mailman/listinfo/python-list

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

2010-02-24 Thread Arnaud Delobelle
Nomen Nescio wrote: Hello, Can someone help me understand what is wrong with this example? class T: A = range(2) B = range(4) s = sum(i*j for i in A for j in B) It produces the exception: type 'exceptions.NameError': global name 'j' is not defined It's due to scoping rules for

Re: When will Python go mainstream like Java?

2010-02-24 Thread Martin P. Hellwig
On 02/24/10 16:05, Peter Parker wrote: Steve Holden wrote: At 12.34 pm on November 13, 2011 At December 21, 2012 at 11:11 am (according to the Maya calendar) On August 29, 1997, Java became mainstream. In a panic, Microsoft tried to embrace, extend and exterminate the system, prompting

parametrizing a sqlite query

2010-02-24 Thread Sebastian Bassi
c.execute(SELECT bin FROM bins WHERE qtl LIKE '%:keys%',{'keys':keywords}) This query returns empty. When it is executed, keywords = 'harvest'. To check it, I do it on the command line and it works as expected: sqlite SELECT bin FROM bins WHERE qtl LIKE '%harvest%'; 11C 11D 12F I guess there is

Re: SMTPServerDisconnected

2010-02-24 Thread Victor Subervi
On Tue, Feb 23, 2010 at 4:53 PM, Jonathan Gardner jgard...@jonathangardner.net wrote: On Tue, Feb 23, 2010 at 8:47 AM, Victor Subervi victorsube...@gmail.com wrote: Hi; I think the last main thing I have to do on my server is get a running email server up. Now that I've nuked sendmail

Re: SMTPServerDisconnected

2010-02-24 Thread Victor Subervi
On Tue, Feb 23, 2010 at 4:53 PM, Jonathan Gardner jgard...@jonathangardner.net wrote: On Tue, Feb 23, 2010 at 8:47 AM, Victor Subervi victorsube...@gmail.com wrote: Hi; I think the last main thing I have to do on my server is get a running email server up. Now that I've nuked sendmail

Re: How to make an empty generator?

2010-02-24 Thread John Posner
generator An iterator produced by a generator function or a generator expression. -John +1. Can someone submit a documentation patch, please? Will do. -John [sorry if this is a dup] Done: #8012 Revise generator-related Glossary entries -John --

Re: Is this secure?

2010-02-24 Thread mk
On 2010-02-24 03:50, Paul Rubin wrote: The stuff about converting 4 random bytes to a decimal string and then peeling off 2 digits at a time is pretty awful, and notice that since 2**32 is 4294967296, in the cases where you get 10 digits, the first 2-digit pair is never higher than 42. Yikes!

Re: parametrizing a sqlite query

2010-02-24 Thread Jon Clements
On Feb 24, 5:07 pm, Sebastian Bassi sba...@clubdelarazon.org wrote: c.execute(SELECT bin FROM bins WHERE qtl LIKE '%:keys%',{'keys':keywords}) This query returns empty. When it is executed, keywords = 'harvest'. To check it, I do it on the command line and it works as expected: sqlite SELECT

Re: parametrizing a sqlite query

2010-02-24 Thread Jon Clements
On Feb 24, 5:21 pm, Jon Clements jon...@googlemail.com wrote: On Feb 24, 5:07 pm, Sebastian Bassi sba...@clubdelarazon.org wrote: c.execute(SELECT bin FROM bins WHERE qtl LIKE '%:keys%',{'keys':keywords}) This query returns empty. When it is executed, keywords = 'harvest'. To check it, I

Re: When will Python go mainstream like Java?

2010-02-24 Thread mk
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 appears. Same for C#, it looks like C# is

Re: How to measure elapsed time under Windows?

2010-02-24 Thread Gabriel Genellina
En Sat, 13 Feb 2010 17:29:45 -0300, Tim Roberts t...@probo.com escribió: Gabriel Genellina gagsl-...@yahoo.com.ar wrote: The original problem was with the RDTSC instruction on multicore CPUs; different cores may yield different results because they're not synchronized at all times. Not true.

Re: Intra-package C extensions with freeze.py

2010-02-24 Thread mk
On 2010-01-13 20:52, Pascal Chambon wrote: I've managed to solve that by manually monkey patching sys.modules, before fusemodule's actual import. But this looks like an unsatisfying solution, to me. Geez.. Does anyone have a clue about how to freeze a python program cleanly, in case such

Re: WANTED: Regular expressions for breaking TeX/LaTeX document into tokens

2010-02-24 Thread Wes James
On Wed, Feb 24, 2010 at 5:03 AM, Jonathan Fine j.f...@open.ac.uk wrote: Hi Does anyone know of a collection of regular expressions that will break a TeX/LaTeX document into tokens?  Assume that there is no verbatim or other category code changes. I'm not sure how this does it, but it might

Re: A tool for find dependencies relationships behind Python projects

2010-02-24 Thread Victor Lin
On 2月23日, 上午12時32分, Hellmut Weber m...@hellmutweber.de wrote: Hi Victor, I would be intereseted to use your tool ;-) My system is Sabayon-5.1 on Lenovo T61. Trying for the first time easy_install I get the following error: r...@sylvester ~ # easy_install gluttony

Re: Is this secure?

2010-02-24 Thread Michael Rudolf
Am 24.02.2010 18:23, schrieb mk: Even then I'm not getting completely uniform distribution for some reason: d 39411 l 39376 f 39288 a 39275 s 39225 r 39172 p 39159 t 39073 k 39071 u 39064 e 39005 o 39005 n 38995 j 38993 h 38975 q 38958 c 38938 b 38906 g 38894 i 38847 m 38819 v 38712 z 35321 y

Noob raw_input question

2010-02-24 Thread Abigail
Yesterday I downloaded and installed Python 3.1 and working through some examples but I have hit a problem a = raw_input(Enter a number ) Traceback (most recent call last): File pyshell#6, line 1, in module a = raw_input(Enter a number ) NameError: name 'raw_input' is not defineda =

Re: Is this secure?

2010-02-24 Thread mk
On 2010-02-24 18:59, Steve Holden wrote: Aw shucks when will I learn to do the stuff in 3 lines well instead of 20, poorly. :-/ When you've got as much experience as Paul? And how much experience does Paul have? (this is mostly not a facile question) For my part, my more serious effort

Re: parametrizing a sqlite query

2010-02-24 Thread Diez B. Roggisch
Am 24.02.10 18:07, schrieb Sebastian Bassi: c.execute(SELECT bin FROM bins WHERE qtl LIKE '%:keys%',{'keys':keywords}) This query returns empty. When it is executed, keywords = 'harvest'. To check it, I do it on the command line and it works as expected: sqlite SELECT bin FROM bins WHERE qtl

Re: Noob raw_input question

2010-02-24 Thread Chris Rebert
On Wed, Feb 24, 2010 at 9:39 AM, Abigail s...@removethis.btinternet.com wrote: Yesterday I downloaded and installed Python 3.1 and working through some examples but I have hit a problem a = raw_input(Enter a number ) Traceback (most recent call last):  File pyshell#6, line 1, in module    a

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

2010-02-24 Thread kj
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! Is my memory playing me a trick? After all, from what I've seen since then, the practice of

Re: Noob raw_input question

2010-02-24 Thread Robert Kern
On 2010-02-24 11:39 AM, Abigail wrote: Yesterday I downloaded and installed Python 3.1 and working through some examples but I have hit a problem a = raw_input(Enter a number ) Traceback (most recent call last): File pyshell#6, line 1, inmodule a = raw_input(Enter a number )

Re: Noob raw_input question

2010-02-24 Thread John Posner
On 2/24/2010 12:39 PM, Abigail wrote: Yesterday I downloaded and installed Python 3.1 and working through some examples but I have hit a problem a = raw_input(Enter a number ) Traceback (most recent call last): File pyshell#6, line 1, inmodule a = raw_input(Enter a number ) NameError:

Re: Noob raw_input question

2010-02-24 Thread Steve Holden
Abigail wrote: Yesterday I downloaded and installed Python 3.1 and working through some examples but I have hit a problem a = raw_input(Enter a number ) Traceback (most recent call last): File pyshell#6, line 1, in module a = raw_input(Enter a number ) NameError: name 'raw_input'

Re: Noob raw_input question

2010-02-24 Thread Abigail
Thank You -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this secure?

2010-02-24 Thread mk
On 2010-02-24 18:56, Michael Rudolf wrote: The reason is 256 % 26 != 0 256 mod 26 equals 22, thus your code is hitting a-v about 10% (256/26 is approx. 10) more often than w-z. Barbie voicewriting secure code is hard... I'm going to switch to PHP: Python world wouldn't lose much, but PHP

Re: Is this secure?

2010-02-24 Thread Robert Kern
On 2010-02-24 12:35 PM, mk wrote: While with this: def gen_rand_word(n): with open('/dev/urandom') as f: return ''.join([chr(ord('a') + ord(x) % 26) for x in f.read(n) if ord(x) 235]) a 3852 ... 1. I'm systematically getting 'a' outlier: have no idea why for now. 2. This is somewhat

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

2010-02-24 Thread rantingrick
On Feb 24, 12:18 pm, kj no.em...@please.post 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! Your going to get many opinions on this

Re: Is this secure?

2010-02-24 Thread mk
On 2010-02-24 20:01, Robert Kern wrote: I will repeat my advice to just use random.SystemRandom.choice() instead of trying to interpret the bytes from /dev/urandom directly. Oh I hear you -- for production use I would (will) certainly consider this. However, now I'm interested in the problem

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

2010-02-24 Thread mk
Get a decent editor, like PyScripter, and press Ctrl-' (toggle comment). Regards, mk -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this secure?

2010-02-24 Thread mk
On 2010-02-24 20:01, Robert Kern wrote: I will repeat my advice to just use random.SystemRandom.choice() instead of trying to interpret the bytes from /dev/urandom directly. Out of curiosity: def gen_rand_string(length): prng = random.SystemRandom() chars = [] for i in

Re: Is this secure?

2010-02-24 Thread Robert Kern
On 2010-02-24 13:09 PM, mk wrote: On 2010-02-24 20:01, Robert Kern wrote: I will repeat my advice to just use random.SystemRandom.choice() instead of trying to interpret the bytes from /dev/urandom directly. Oh I hear you -- for production use I would (will) certainly consider this. However,

Re: Is this secure?

2010-02-24 Thread Paul Rubin
Robert Kern robert.k...@gmail.com writes: I will repeat my advice to just use random.SystemRandom.choice() instead of trying to interpret the bytes from /dev/urandom directly. SystemRandom is something pretty new so I wasn't aware of it. But yeah, if I were thinking more clearly I would have

Re: Spam from gmail

2010-02-24 Thread Aahz
In article 87sk8r5v2f@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: a...@pythoncraft.com (Aahz) writes: Joan Miller is a regular poster; this is off-topic, but it's not spam. Non sequitur. Spam is spam, not by who authors or posts it, but by its distribution (to many

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

2010-02-24 Thread Aahz
In article hm3qhi$2c...@reader2.panix.com, kj no.em...@please.post 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! Is my memory playing

Re: Is this secure?

2010-02-24 Thread Robert Kern
On 2010-02-24 13:16 PM, mk wrote: On 2010-02-24 20:01, Robert Kern wrote: I will repeat my advice to just use random.SystemRandom.choice() instead of trying to interpret the bytes from /dev/urandom directly. Out of curiosity: def gen_rand_string(length): prng = random.SystemRandom() chars =

Re: Is this secure?

2010-02-24 Thread Paul Rubin
mk mrk...@gmail.com writes: So I have little in the way of limitations of password length ... The main application will access the data using HTTP (probably), so the main point is that an attacker is not able to guess passwords using brute force. If it's HTTP instead of HTTPS and you're

Re: Is this secure?

2010-02-24 Thread Michael Rudolf
Am 24.02.2010 19:35, schrieb mk: On 2010-02-24 18:56, Michael Rudolf wrote: The reason is 256 % 26 != 0 256 mod 26 equals 22, thus your code is hitting a-v about 10% (256/26 is approx. 10) more often than w-z. Barbie voicewriting secure code is hard... So true. That's why one should stick

Re: Is this secure?

2010-02-24 Thread mk
On 2010-02-24 20:19, Robert Kern wrote: On 2010-02-24 13:09 PM, mk wrote: On 2010-02-24 20:01, Robert Kern wrote: I will repeat my advice to just use random.SystemRandom.choice() instead of trying to interpret the bytes from /dev/urandom directly. Oh I hear you -- for production use I would

Re: Is this secure?

2010-02-24 Thread mk
On 2010-02-24 20:30, Michael Rudolf wrote: The reason is 256 % 26 != 0 256 mod 26 equals 22, thus your code is hitting a-v about 10% (256/26 is approx. 10) more often than w-z. Barbie voicewriting secure code is hard... So true. That's why one should stick to standard libs when it comes to

Trouble with ftplib uploading to an FTP server

2010-02-24 Thread Sky Larking
This bit of code is designed to get the external IP address and hostname of a client , write it locally to a file, then upload to an FTP server. It works locally( one can see the IP number and hostname with a time stamp in /Users/admin/Documents) , but when the file is opened on the server after

Re: Is this secure?

2010-02-24 Thread Robert Kern
On 2010-02-24 14:02 PM, mk wrote: It would appear that SystemRandom().choice is indeed best (in terms of how much the counts stray from mean in std devs), but only after seeding it with os.urandom. Calling random.seed() does not affect SystemRandom() whatsoever. You are getting perfectly

Re: Artificial Neural Networks recommendation

2010-02-24 Thread Andrew Davison
On Feb 24, 1:49 pm, Gereon Kaiping gereon.kaip...@yahoo.de wrote: - - 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)

Re: Is this secure?

2010-02-24 Thread Paul Rubin
mk mrk...@gmail.com writes: def rand_str_custom(n): s = os.urandom(n) return ''.join([chr(ord('a') + ord(x) % 26) for x in s if ord(x) 234]) Note that simply throws away some of the chars. You have to replace them, not throw them away. rand_str_SystemRandom_seeding mean

Docstrings considered too complicated

2010-02-24 Thread Andreas Waldenburger
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): yield scorn Now my question is this: How do I kill these people

Re: When will Java go mainstream like Python?

2010-02-24 Thread Wanja Gayk
Am 24.02.2010, 00:22 Uhr, schrieb Lawrence D'Oliveiro l...@geek-central.gen.new_zealand: 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 Python is still faster,

Re: Trouble with ftplib uploading to an FTP server

2010-02-24 Thread MRAB
Sky Larking wrote: This bit of code is designed to get the external IP address and hostname of a client , write it locally to a file, then upload to an FTP server. It works locally( one can see the IP number and hostname with a time stamp in /Users/admin/Documents) , but when the file is opened

Re: Spam from gmail

2010-02-24 Thread Steve Holden
Aahz wrote: In article 87sk8r5v2f@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: a...@pythoncraft.com (Aahz) writes: Joan Miller is a regular poster; this is off-topic, but it's not spam. Non sequitur. Spam is spam, not by who authors or posts it, but by its distribution

Re: Is this secure?

2010-02-24 Thread Michael Rudolf
Am 24.02.2010 21:06, schrieb mk: I just posted a comparison with calculating std deviations for various methods - using os.urandom, SystemRandom.choice with seeding and without seeding. I saw them They all seem to have slightly different distributions. No they don't. Just run those tests

Re: Help with lambda

2010-02-24 Thread News123
Jonathan Gardner wrote: On Feb 18, 4:28 am, lallous elias.bachaal...@gmail.com wrote: f = [lambda x: x ** n for n in xrange(2, 5)] This is (pretty much) what the above code does. f = [] n = 2 f.append(lambda x: x**n) n = 3 f.append(lambda x: x**n) n = 4 f.append(lambda x: x**n) n =

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

2010-02-24 Thread Terry Reedy
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 the online documentation or search while they have a doc string:

Re: python dowload

2010-02-24 Thread Diez B. Roggisch
Am 24.02.10 00:08, schrieb monkeys paw: On 2/23/2010 3:17 PM, Tim Chase wrote: monkeys paw wrote: I used the following code to download a PDF file, but the file was invalid after running the code, is there problem with the write operation? import urllib2 url =

Re: Docstrings considered too complicated

2010-02-24 Thread Jonathan Gardner
On Wed, Feb 24, 2010 at 12:23 PM, Andreas Waldenburger use...@geekmail.invalid 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

Re: compiling python question

2010-02-24 Thread Diez B. Roggisch
Am 24.02.10 03:00, schrieb Mag Gam: I am trying to compile python with Tk bindings. Do I need to do anything special for python to detect and enable Tk? What OS? What does the configure/build process say? Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Spam from gmail

2010-02-24 Thread Arnaud Delobelle
a...@pythoncraft.com (Aahz) writes: In article 87sk8r5v2f@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: a...@pythoncraft.com (Aahz) writes: Joan Miller is a regular poster; this is off-topic, but it's not spam. Non sequitur. Spam is spam, not by who authors or posts it,

Re: Problem creating executable, with PyQwt

2010-02-24 Thread Gib Bogle
David Boddie wrote: On Tuesday 23 February 2010 05:32, Gib Bogle wrote: David Boddie wrote: I have previously referred people with py2exe/PyQt issues to this page on the PyQt Wiki: http://www.py2exe.org/index.cgi/Py2exeAndPyQt If you can somehow convince py2exe to include the QtSvg

Re: Files required for porting python

2010-02-24 Thread Gib Bogle
KIRAN wrote: I see lot of code with several files. I had to laugh at this. -- http://mail.python.org/mailman/listinfo/python-list

How to monitor memory usage within Python? (Linux)

2010-02-24 Thread kj
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://mail.python.org/mailman/listinfo/python-list

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

2010-02-24 Thread dontspamleo
Hi Folks, Thanks everyone for the great contributions! I understand this better now. The distinction between a shorthand for a function definition and a shorthand for a loop iteration is crucial. Also: thanks for pointing out the even the list comprehension doesn't work in py3. That was

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

2010-02-24 Thread CM
After all, from what I've seen since then, the practice of triple-quote-commenting (or TQC, pardon the TCA) is in fact quite common. Is TQC OK after all? If not, what's the case against it? I have no sense of how approved it is, and don't have a strong opinion on it, but I would think that

  1   2   >