Re: Python 2 or 3

2011-12-02 Thread Matt Joiner
2 without a doubt. On Dec 3, 2011 5:40 PM, "Andrew Berg" wrote: > On 12/3/2011 12:23 AM, Terry Reedy wrote: > > PyPy has a roadmap for 3.2 > > http://pypy.org/py3donate.html > > They definitely plan to do it one way or another. > I never said there were no plans, but at $2567 out of $60k, I don't

Re: Django ported to Python3!

2011-12-02 Thread Matt Joiner
As long as we can dump python 2, a big congrats to anyone who makes this possible. Thanks martin On Dec 3, 2011 5:51 PM, "Stefan Behnel" wrote: > Ron, 02.12.2011 22:47: > >> It looks like Vinay Sajip has succeeded in porting Django to Python3 >> (in a shared code base for Python 3.2 and Python 2.

Re: Django ported to Python3!

2011-12-02 Thread Stefan Behnel
Ron, 02.12.2011 22:47: It looks like Vinay Sajip has succeeded in porting Django to Python3 (in a shared code base for Python 3.2 and Python 2.7). This is an astoundingly good job, done very fast and is big news. See https://groups.google.com/forum/#!topic/django-developers/XjrX3FIPT-U and the ac

Re: Python 2 or 3

2011-12-02 Thread Andrew Berg
I accidentally quoted the wrong figure. I meant $4369 of $105000. -- CPython 3.2.2 | Windows NT 6.1.7601.17640 | Thunderbird 7.0 -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2 or 3

2011-12-02 Thread Andrew Berg
On 12/3/2011 12:23 AM, Terry Reedy wrote: > PyPy has a roadmap for 3.2 > http://pypy.org/py3donate.html > They definitely plan to do it one way or another. I never said there were no plans, but at $2567 out of $60k, I don't see it happening soon. Unless someone decides to donate a huge sum of money

Re: Python 2 or 3

2011-12-02 Thread Terry Reedy
On 12/2/2011 11:20 PM, Andrew Berg wrote: thing to note is that, at least AFAICT, Jython, IronPython and PyPy are not going to support Python 3 any time soon, PyPy has a roadmap for 3.2 http://pypy.org/py3donate.html They definitely plan to do it one way or another. -- Terry Jan Reedy -- htt

Re: Python 2 or 3

2011-12-02 Thread Dan Stromberg
On 12/2/11, Antti J Ylikoski wrote: > > I'm in the process of learning Python. I already can code > objet-oriented programs with the language. I have in my hands the > O'Reilly book by Mark Lutz, Programming Python, in two versions: the > 2nd Edition, which covers Python 2, and the 4th edition,

Re: Python 2 or 3

2011-12-02 Thread Roy Smith
In article , Antti J Ylikoski wrote: > I have in my hands the O'Reilly book by Mark Lutz, Programming > Python, in two versions: the 2nd Edition, which covers Python 2, and > the 4th edition, which covers Python 3. The engineer in me really has to wonder what the 3rd edition might have cover

Re: Python 2 or 3

2011-12-02 Thread Andrew Berg
On 12/2/2011 9:54 PM, Antti J Ylikoski wrote: > What is the opinion of the wizards here, shall I learm Python 2 or > Python 3? I'm posting this here because I feel that this point is > interesting to other students of Python. Unless you are tied to Python 2 in some way, go for Python 3 and don't l

Re: Python 2 or 3

2011-12-02 Thread Gnarlodious
If you are writing your own scripts, I would recommend Py3 for learning. But if you are studying existing scripts to learn, Py2 might be better. I have been doing Python for about 2 years and started learning Py3 with no regrets. Py2 is not going to be "obsolete" for quite a while. It is almost

Re: Referencing module.instance

2011-12-02 Thread Gnarlodious
To explain my reasoning, this scheme will allow me to run the script three ways, as shell, as one-shot CGI or as a persistent mod_wsgi module. So to be more exhaustive: In __init__ I can say: import Grid self.Grid = Grid.Grid self.Grid is now the instance of Grid inside the module Grid. then

Python 2 or 3

2011-12-02 Thread Antti J Ylikoski
I'm in the process of learning Python. I already can code objet-oriented programs with the language. I have in my hands the O'Reilly book by Mark Lutz, Programming Python, in two versions: the 2nd Edition, which covers Python 2, and the 4th edition, which covers Python 3. In the "official Pyth

Re: Referencing module.instance

2011-12-02 Thread Steven D'Aprano
On Fri, 02 Dec 2011 09:49:25 -0800, Gnarlodious wrote: > What I am doing is importing modules that have an identical instance > name. So I say: > > import Grid > > Grid has its instance: > > Grid.Grid() > > and this is the same for all modules of my webapp. allowedPages is a > list of modules

Re: order independent hash?

2011-12-02 Thread Steven D'Aprano
On Fri, 02 Dec 2011 10:18:12 -0800, 8 Dihedral wrote: [...] Dihedral, EVERY SINGLE ONE of your messages is double posted. You are sending to the newsgroup and the mailing list, but they are aliases for each other. Please stop double posting. -- Steven -- http://mail.python.org/mailman/

Django ported to Python3!

2011-12-02 Thread Ron
It looks like Vinay Sajip has succeeded in porting Django to Python3 (in a shared code base for Python 3.2 and Python 2.7). This is an astoundingly good job, done very fast and is big news. See https://groups.google.com/forum/#!topic/django-developers/XjrX3FIPT-U and the actual code is at Bitbucket

Re: order independent hash?

2011-12-02 Thread Terry Reedy
On 12/2/2011 4:53 AM, Hrvoje Niksic wrote: Chris Angelico writes: The hash can grow with (k,v) pairs accumulated in the run time. An auto memory management mechanism is required for a hash of a non-fixed size of (k,v) pairs. That's a hash table In many contexts "hash table" is shortened t

Re: Referencing module.instance

2011-12-02 Thread Ben Finney
Gnarlodious writes: > What I am doing is importing modules that have an identical instance > name. Best to fix that, then. > import Grid That's a poorly-named module. PEP 8 recommends module names be all lowercase. > Grid has its instance: > > Grid.Grid() And this is the reason: PEP 8 recomm

Re: Using the Python Interpreter as a Reference

2011-12-02 Thread Devin Jeanpierre
> In my opinion, if your code is indented four or more levels, you should > start to think about refactorising your code; if you reach six levels, > your code is probably a mess. Here's some code I encountered while grading assignments from first-year CS students: if 'not' in temp_holder:

RE: Using the Python Interpreter as a Reference

2011-12-02 Thread Sells, Fred
Steven, that's probably the most elegant explanation of the "pythonic" way I've ever seen. I'm saving it for the next time upper management want to use Java again. -Original Message- From: python-list-bounces+frsells=adventistcare@python.org [mailto:python-list-bounces+frsells=adventi

Re: Need some IPC pointers

2011-12-02 Thread bobicanprogram
On Nov 30, 4:03 pm, Andrew Berg wrote: > I've done some research, but I'm not sure what's most appropriate for my > situation. What I want to do is have a long running process that spawns > processes (that aren't necessarily written in Python) and communicates > with them. The children can be spaw

Re: python 2.5 and ast

2011-12-02 Thread Ian Kelly
On Fri, Dec 2, 2011 at 11:28 AM, 8 Dihedral wrote: > On Monday, November 28, 2011 7:45:57 PM UTC+8, Andrea Crotti wrote: >> I'm happily using the ast module to analyze some code, >> but my scripts need also to run unfortunately on python 2.5 >> >> The _ast was there already, but the ast helper

Re: order independent hash?

2011-12-02 Thread Dave Angel
On 12/01/2011 08:55 AM, Neal Becker wrote: Gelonida N wrote: On 11/30/2011 01:32 PM, Neal Becker wrote: I like to hash a list of words (actually, the command line args of my program) in such a way that different words will create different hash, but not sensitive to the order of the words. An

Install Python on Windows without Start Menu icons?

2011-12-02 Thread snorble
Is it possible to automate the Python installation on Windows using the MSI file so it does not add a Start Menu folder? I would like to push out Python to all of my office workstations, but I'd like for it to be relatively silent from the user's point of view. -- http://mail.python.org/mailman/li

Re: order independent hash?

2011-12-02 Thread Ian Kelly
On Fri, Dec 2, 2011 at 11:18 AM, 8 Dihedral wrote: > On Wednesday, November 30, 2011 8:32:39 PM UTC+8, Neal Becker wrote: >> I like to hash a list of words (actually, the command line args of my >> program) >> in such a way that different words will create different hash, but not >> sensitiv

Re: python 2.5 and ast

2011-12-02 Thread 88888 Dihedral
On Monday, November 28, 2011 7:45:57 PM UTC+8, Andrea Crotti wrote: > I'm happily using the ast module to analyze some code, > but my scripts need also to run unfortunately on python 2.5 > > The _ast was there already, but the ast helpers not yet. > Is it ok if I just copy over the source from the

Re: order independent hash?

2011-12-02 Thread 88888 Dihedral
On Wednesday, November 30, 2011 8:32:39 PM UTC+8, Neal Becker wrote: > I like to hash a list of words (actually, the command line args of my > program) > in such a way that different words will create different hash, but not > sensitive > to the order of the words. Any ideas? For each word of

Referencing module.instance

2011-12-02 Thread Gnarlodious
What I am doing is importing modules that have an identical instance name. So I say: import Grid Grid has its instance: Grid.Grid() and this is the same for all modules of my webapp. allowedPages is a list of modules to import, so they are quoted strings: for page in self.allowedPages: seta

Re: Clever hack or code abomination?

2011-12-02 Thread Chris Hulan
I'd just look a the unit tests for clarification/examples -- http://mail.python.org/mailman/listinfo/python-list

Re: order independent hash?

2011-12-02 Thread 88888 Dihedral
On Friday, December 2, 2011 5:53:47 PM UTC+8, Hrvoje Niksic wrote: > Chris Angelico writes: > > >> The hash can grow with (k,v) pairs accumulated in the run time. > >> An auto memory management mechanism is required for a hash of a non-fixed > >> size of (k,v) pairs. > > > > That's a hash table

Re: python 2.5 and ast

2011-12-02 Thread Andrea Crotti
And on a related topic, how can I actually detect other types of imports, for example __import__ Doing a dump I get this: In [113]: ast.dump(ast.parse('__import__("module")')) Out[113]: "Module(body=[Expr(value=Call(func=Name(id='__import__', ctx=Load()), args=[Str(s='module')], keywords=[], s

Re: python 2.5 and ast

2011-12-02 Thread Andrea Crotti
On 12/02/2011 03:18 PM, DevPlayer wrote: There was another topic in these forums recently about "un-importing" modules (and how you can not do that reliably without restarting python). There was various ways mentioned of keeping track of what was imported. And there was mentioned reasonable ways

Re: unpack('>f', b'\x00\x01\x00\x00')

2011-12-02 Thread Mark Dickinson
On Dec 1, 10:21 am, Hrvoje Niksic wrote: > Chris Rebert writes: > > C does not have a built-in fixed-point datatype, so the `struct` > > module doesn't handle fixed-point numbers directly. > > The built-in decimal module supports fixed-point arithmetic, but the > struct module doesn't know about

Re: Multiprocessing: killing children when parent dies

2011-12-02 Thread 88888 Dihedral
Please check Erlang that spawn so easily. And there are Python packages can do the same task. -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiprocessing: killing children when parent dies

2011-12-02 Thread Chris Angelico
On Sat, Dec 3, 2011 at 2:57 AM, 8 Dihedral wrote: > Multiple thread supporting programming languages  in true OOP as Erlang and > Python do not talk about POSIX signals. The OP talked about multiprocessing. Each thread of execution is a separate context, and can receive signals. ChrisA --

Re: Multiprocessing: killing children when parent dies

2011-12-02 Thread 88888 Dihedral
On Friday, December 2, 2011 11:13:34 PM UTC+8, Chris Angelico wrote: > On Sat, Dec 3, 2011 at 2:05 AM, Mihai Badoiu wrote: > > In the multiprocessing module, on a Process p, by just doing p.daemon=1 > > before p.start(), we can make the child die when the parent exits.  However, > > the child does

Re: Multiprocessing: killing children when parent dies

2011-12-02 Thread Alec Taylor
I've been in philosophical discussions all day. This topic title makes me cringe :P -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading twice from STDIN

2011-12-02 Thread janedenone
On Dec 2, 2:04 pm, Hans Mulder wrote: > That's odd.  For some reason, I can get away with a simple > >      sys.stdin = open('/dev/tty') > > and raw_input will merrily read from file descriptor 3. > > I'm using Pyhton 2.7.1 and 3.2 on MacOS/X 10.5.0. > > What version are you using? > > -- HansM

Why are Sphinx docs incompatible with Safari Reader?

2011-12-02 Thread K . -Michael Aye
Anybody knows? Have a nice weekend! Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: python 2.5 and ast

2011-12-02 Thread DevPlayer
On Nov 30, 1:03 pm, Andrea Crotti wrote: > Another thing about the AST, I am having fun trying to for example list > out all > the unused imports. > > I have already a visitor which works quite nicely I think, but now I > would like > to get a way to find all the unused imports, so I need more vis

Re: Multiprocessing: killing children when parent dies

2011-12-02 Thread Chris Angelico
On Sat, Dec 3, 2011 at 2:05 AM, Mihai Badoiu wrote: > In the multiprocessing module, on a Process p, by just doing p.daemon=1 > before p.start(), we can make the child die when the parent exits.  However, > the child does not die if the parent gets killed. > How can I make sure the child die when

Multiprocessing: killing children when parent dies

2011-12-02 Thread Mihai Badoiu
In the multiprocessing module, on a Process p, by just doing p.daemon=1 before p.start(), we can make the child die when the parent exits. However, the child does not die if the parent gets killed. How can I make sure the child die when the parent gets killed? thanks, --mihai -- http://mail.py

Re: Passing along cmd.Cmd completion to contained class

2011-12-02 Thread Miki Tebeka
This is not tested, but maybe it'll work :) def complete(self, text, state): if text.startswith('config): return self.config.complete(text, state) return Cmd.complete(self, text, state) -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading twice from STDIN

2011-12-02 Thread Hans Mulder
On 2/12/11 10:09:17, janedenone wrote: I had tried sys.stdin = open('/dev/tty', 'r') That seems to work for me. This code: import sys if sys.version_info.major == 2: input = raw_input for tp in enumerate(sys.stdin): print("%d: %s" % tp) sys.stdin = open('/dev/tty', 'r') answer = i

Re: order independent hash?

2011-12-02 Thread 88888 Dihedral
On Friday, December 2, 2011 5:53:47 PM UTC+8, Hrvoje Niksic wrote: > Chris Angelico writes: > > >> The hash can grow with (k,v) pairs accumulated in the run time. > >> An auto memory management mechanism is required for a hash of a non-fixed > >> size of (k,v) pairs. > > > > That's a hash table

Re: Python 3 - xml - crlf handling problem

2011-12-02 Thread Stefan Behnel
durumdara, 02.12.2011 09:13: So: may I don't understand the things well, but I thought that parser drop the "nondata" CRLF-s + other characters (not preserve them). Well, it does that, at least on my side (which is not under Windows): === original=''' AnyText

Re: suppressing bad characters in output PCDATA (converting JSON to XML)

2011-12-02 Thread Adam Funk
On 2011-11-29, Stefan Behnel wrote: > Adam Funk, 29.11.2011 13:57: >> On 2011-11-28, Stefan Behnel wrote: >>> If the name "big_json" is supposed to hint at a large set of data, you may >>> want to use something other than minidom. Take a look at the >>> xml.etree.cElementTree module instead, whic

Re: Python 3 - xml - crlf handling problem

2011-12-02 Thread durumdara
Dear Stefan! So: may I don't understand the things well, but I thought that parser drop the "nondata" CRLF-s + other characters (not preserve them). Then don't matters that I read the XML from a file, or I create it from code, because all of them generating SAME RESULT. But Python don't do that.

Re: order independent hash?

2011-12-02 Thread Hrvoje Niksic
Chris Angelico writes: >> The hash can grow with (k,v) pairs accumulated in the run time. >> An auto memory management mechanism is required for a hash of a non-fixed >> size of (k,v) pairs. > > That's a hash table In many contexts "hash table" is shortened to "hash" when there is no ambiguity.

Re: Clever hack or code abomination?

2011-12-02 Thread Chris Angelico
On Fri, Dec 2, 2011 at 7:54 PM, Steven D'Aprano wrote: > Dude, it was deliberately obfuscated code. I even named the function > "obfuscated_prefixes". I thought that would have been a hint > > It's kinda scary that of all the sins against readability committed in my > function, including isinstan

Re: Reading twice from STDIN

2011-12-02 Thread janedenone
On Dec 2, 8:53 am, Hans Mulder wrote: > On 2/12/11 03:46:10, Dan Stromberg wrote: > > > You can read piped data from sys.stdin normally.  Then if you want > > something from the user, at least on most *ix's, you would open > > /dev/tty and get user input from there.  'Not sure about OS/X. > > Read

Re: Clever hack or code abomination?

2011-12-02 Thread Steven D'Aprano
On Fri, 02 Dec 2011 17:02:01 +1100, Chris Angelico wrote: > On Fri, Dec 2, 2011 at 4:34 PM, Steven D'Aprano > wrote: >> On Fri, 02 Dec 2011 13:07:57 +1100, Chris Angelico wrote: >>> I would consider integer representations of ASCII to be code smell. >>> It's not instantly obvious that 45 means '-