Re: Using non-dict namespaces in functions

2012-03-18 Thread Peter Otten
Steven D'Aprano wrote: > On Sat, 17 Mar 2012 11:42:49 -0700, Eric Snow wrote: > >> On Sat, Mar 17, 2012 at 4:18 AM, Steven D'Aprano >> wrote: >>> Note that it is important for my purposes that MockChainMap does not >>> inherit from dict. >> >> Care to elaborate? > > I want to use collections.C

Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-18 Thread Cosmia Luna
I think I got the way to handle it but with small problem and probably at unnecessary performance cost. If you're going to use it, be sure rewrite the code and remove the lines which you don't need. Ad, test them, the code below is only tested on py3.2, and may contains a lot of bugs even in py

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-18 Thread Albert van der Horst
In article <4f654042$0$29981$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: >On Sat, 17 Mar 2012 17:28:38 -0600, Michael Torrie wrote: > >> Thank you. Your example makes more clear your assertion about "labels" >> and how really A1 and A5 were the only real labels in the example. >>

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-18 Thread Albert van der Horst
In article , Antti J Ylikoski wrote: > >In his legendary book series The Art of Computer Programming, >Professor Donald E. Knuth presents many of his algorithms in the form >that they have been divided in several individual phases, with >instructions to GOTO to another phase interspersed in the t

dpkg status

2012-03-18 Thread admin lewis
Hi, anyone know what library i have to use to manage /var/lib/dpkg/status file to get url of packages ? thanks lewis -- Linux Server, Microsoft Windows 2003/2008 Server, Exchange 2007 http://predellino.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Unittest2 on python 2.6

2012-03-18 Thread Andrea Crotti
Suppose we want to use the unittest from Python 2.7, but also want to support Python 2.6, what is the best way to do it? The solution used now is to have in setup.py if sys.version < '2.7': tests_require.append('unittest2') and then in every test file try: import unittest2 as unittes

Re: dpkg status

2012-03-18 Thread Vincent Vande Vyvre
Le 18/03/12 13:03, admin lewis a écrit : Hi, anyone know what library i have to use to manage /var/lib/dpkg/status file to get url of packages ? thanks lewis Hi, What url ?, Sources, maintainer? You can use "apt-cache search 'keyword'" to find a p

Re: dpkg status

2012-03-18 Thread admin lewis
2012/3/18 Vincent Vande Vyvre : > Le 18/03/12 13:03, admin lewis a écrit : > > Hi, > > What url ?, Sources, maintainer? > No, I need of to open /var/lib/dpkg/status and extract the packages and its url to download it... I know that there is python-apt http://apt.alioth.debian.org/python-apt-doc/li

Re: dpkg status

2012-03-18 Thread Vincent Vande Vyvre
Le 18/03/12 15:54, admin lewis a écrit : 2012/3/18 Vincent Vande Vyvre : Le 18/03/12 13:03, admin lewis a écrit : Hi, What url ?, Sources, maintainer? No, I need of to open /var/lib/dpkg/status and extract the packages and its url to download

Re: Unittest2 on python 2.6

2012-03-18 Thread Terry Reedy
On 3/18/2012 9:31 AM, Andrea Crotti wrote: Suppose we want to use the unittest from Python 2.7, but also want to support Python 2.6, what is the best way to do it? The solution used now is to have in setup.py if sys.version < '2.7': tests_require.append('unittest2') and then in every test file

Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-18 Thread Ian Kelly
On Sun, Mar 18, 2012 at 3:42 AM, Cosmia Luna wrote: > But it seems that the last line(#ref2) in the Py2Type.__init__ does not work > at > all. I'm not sure what you're expecting it to do, but type.__init__ does not actually do anything > It seems really weird, 'type' is an instance of 'type' it

Re: dpkg status

2012-03-18 Thread admin lewis
2012/3/18 Vincent Vande Vyvre : > > > OK, you know apt, I see (your blog). > > But packages have no url, just repositery. > > I see your link python-apt, this doc is very minimalistic, maybe you can > find repositeries infos of packages with aptsources.distinfo, but methods > are not documented. >

Re: Python is readable

2012-03-18 Thread alister
On Thu, 15 Mar 2012 00:34:47 +0100, Kiuhnm wrote: > I've just started to read >The Quick Python Book (2nd ed.) > The author claims that Python code is more readable than Perl code and > provides this example: > > --- Perl --- > sub pairwise_sum { > my($arg1, $arg2) = @_; > my(@resul

Benchmarking stripping of Unicode characters which are invalid XML

2012-03-18 Thread Alex Willmer
Last week I was surprised to discover that there are Unicode characters that aren't valid in an XML document. That is regardless of escaping (e.g. �) and unicode encoding (e.g. UTF-8) - not every Unicode string can be stored in XML. The valid characters are (as of XML 1.0) #x9 | #xA | #xD | [#x2

Re: Unittest2 on python 2.6

2012-03-18 Thread Andrea Crotti
On 03/18/2012 03:46 PM, Terry Reedy wrote: 1. If the difference between unittest and unittest2 is strictly a matter of deletions and addition, replace unittest with the union of the two. 2. Put the try/except dance in a compat file. Then everywhere else 'from compat import unittest'. This ide

Re: Python is readable

2012-03-18 Thread John Ladasky
On Mar 14, 11:23 pm, alex23 wrote: > The idea that Python code has to be obvious to non-programmers is an > incorrect and dangerous one. Incorrect? Probably. Dangerous? You'll have to explain what you mean. What I would say is that, when PROGRAMMERS look at Python code for the first time, th

Re: Unittest2 on python 2.6

2012-03-18 Thread Terry Reedy
On 3/18/2012 4:55 PM, Andrea Crotti wrote: On 03/18/2012 03:46 PM, Terry Reedy wrote: 1. If the difference between unittest and unittest2 is strictly a matter of deletions and addition, replace unittest with the union of the two. 2. Put the try/except dance in a compat file. Then everywhere els

Re: Python is readable

2012-03-18 Thread Chris Angelico
On Mon, Mar 19, 2012 at 8:30 AM, John Ladasky wrote: > What I would say is that, when PROGRAMMERS look at Python code for the > first time, they will understand what it does more readily than they > would understand other unfamiliar programming languages.  That has > value. This is something that

Problem with special characters in the password field (urllib)

2012-03-18 Thread Bernhard Heijstek
Hi, I'm having problems getting a script that I wrote to check the unread Gmail feed work (http://pastebin.com/FAGyedH0). The script fetches the unread mail feed (https://mail.google.com/mail/feed/atom/) and then parses it using python-feedparser. The script seems to work fine if I'm not using

Re: Currying in Python

2012-03-18 Thread Kiuhnm
On 3/17/2012 2:21, Kiuhnm wrote: Here we go. I wrote an article about my approach to currying: http://mtomassoli.wordpress.com/2012/03/18/currying-in-python/ Beginners should be able to understand it as well. Experienced programmers will probably want to skip some sections. Kiuhnm -- http:/

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-18 Thread Kiuhnm
On 3/18/2012 0:28, Michael Torrie wrote: I am familiar with how one might implement a decompiler, as well as a compiler (having written a simple one in the past), but even now I don't see a connection between a decompiler and the process of converting a knuth algorithm into a python python implem

Re: Python is readable

2012-03-18 Thread Steven D'Aprano
On Mon, 19 Mar 2012 09:02:06 +1100, Chris Angelico wrote: > On Mon, Mar 19, 2012 at 8:30 AM, John Ladasky > wrote: >> What I would say is that, when PROGRAMMERS look at Python code for the >> first time, they will understand what it does more readily than they >> would understand other unfamiliar

[RELEASED] Second release candidates for Python 2.6.8, 2.7.3, 3.1.5, and 3.2.3

2012-03-18 Thread Benjamin Peterson
We're chuffed to announce the immediate availability of the second release candidates for Python 2.6.8, 2.7.3, 3.1.5, and 3.2.3. The only change from the first release candidates is the patching of an additional security hole. The security issue fixed in the second release candidates is in the exp

Re: Python is readable

2012-03-18 Thread alex23
John Ladasky wrote: > > The idea that Python code has to be obvious to non-programmers is an > > incorrect and dangerous one. > > Incorrect?  Probably.  Dangerous?  You'll have to explain what you > mean. The classic "obvious" behaviour to new Python programmers that causes problems would be muta

Re: Python is readable

2012-03-18 Thread Chris Rebert
On Sun, Mar 18, 2012 at 8:15 PM, alex23 wrote: > John Ladasky wrote: >> > The idea that Python code has to be obvious to non-programmers is an >> > incorrect and dangerous one. >> >> Incorrect?  Probably.  Dangerous?  You'll have to explain what you >> mean. > > The classic "obvious" behaviour to

Re: Python is readable

2012-03-18 Thread Chris Angelico
On Mon, Mar 19, 2012 at 12:23 PM, Steven D'Aprano wrote: > On Mon, 19 Mar 2012 09:02:06 +1100, Chris Angelico wrote: > >> On Mon, Mar 19, 2012 at 8:30 AM, John Ladasky >> wrote: >>> What I would say is that, when PROGRAMMERS look at Python code for the >>> first time, they will understand what it

ANN: cmd2, an extenstion of cmd that parses its argument line

2012-03-18 Thread anntzer . lee
Dear all, I would like to announce the first public release of cmd2, an extension of the standard library's cmd with argument parsing, here: https://github.com/anntzer/cmd2. Cmd2 is an extension built around the excellent cmd module of the standard library. Cmd allows one to build simple custo

New learner of Python--any suggestion on studying it?

2012-03-18 Thread yan xianming
Hello all, I'm a new learning of Python. Can someone give me some suggestion about it? thanks xianming -- http://mail.python.org/mailman/listinfo/python-list