Re: UnicodeDecodeError issue

2013-08-30 Thread Chris Angelico
On Sat, Aug 31, 2013 at 4:41 PM, Ferrous Cranus  wrote:
> Suddenly my webiste superhost.gr running my main python script presents me
> with this error:
>
> Code:
> UnicodeDecodeError('utf-8', b'\xb6\xe3\xed\xf9\xf3\xf4\xef
> \xfc\xed\xef\xec\xe1 \xf3\xf5\xf3\xf4\xde\xec\xe1\xf4\xef\xf2', 0, 1,
> 'invalid start byte')
>
>
> Does anyone know what this means?

Yes. It means that 0xB6 is an invalid start byte in UTF-8. If that
seems unhelpful, it's because your question was; there is not enough
information for us to be able to give any further information.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Encapsulation unpythonic?

2013-08-30 Thread Marco Buttu

On 08/31/2013 08:07 AM, Fabrice Pombet wrote:


well, look at that:

a=(1,2)
a=2+3 ->a is an object and I have changed its type and value from outside.


No, `a` is not an object, so you did not change the type of any object. 
`a` is just a name (a label), that initially refers to the tuple (1, 2):


>>> a = (1, 2)
>>> id(a)
140377464514968

ad after, to another object, of type int:

>>> a = 2 + 3
>>> id(a)
8752608

The bytecode:

>>> dis.dis('a = (1, 2); a = 2 + 3;')
  1   0 LOAD_CONST   4 ((1, 2))
  3 STORE_NAME   0 (a)
  6 LOAD_CONST   5 (5)
  9 STORE_NAME   0 (a)
 12 LOAD_CONST   3 (None)
 15 RETURN_VALUE

Regards, M.

--
Marco Buttu
--
http://mail.python.org/mailman/listinfo/python-list


UnicodeDecodeError issue

2013-08-30 Thread Ferrous Cranus
Suddenly my webiste superhost.gr running my main python script presents 
me with this error:


Code:
UnicodeDecodeError('utf-8', b'\xb6\xe3\xed\xf9\xf3\xf4\xef 
\xfc\xed\xef\xec\xe1 \xf3\xf5\xf3\xf4\xde\xec\xe1\xf4\xef\xf2', 0, 1, 
'invalid start byte')



Does anyone know what this means?


--
Webhost 
--
http://mail.python.org/mailman/listinfo/python-list


Re: Encapsulation unpythonic?

2013-08-30 Thread Fabrice Pombet
On Saturday, August 31, 2013 4:35:39 AM UTC+2, Steven D'Aprano wrote:
> On Fri, 30 Aug 2013 10:43:28 -0700, Fabrice Pombet wrote:
> 
> 
> 
> > On Saturday, August 17, 2013 2:26:32 PM UTC+2, Fernando Saldanha wrote:
> 
> 
> 
> >> 2) If it is in fact true that encapsulation is rarely used, how do I
> 
> >> deal with the fact that other programmers can easily alter the values
> 
> >> of members of my classes?
> 
> >> 
> 
> > Fernando, it is widely accepted that Python pays very little attention
> 
> > to encapsulation as a principle set in stone.
> 
> 
> 
> Widely accepted by whom?
> 
most people(except you, apparently, but I fear that you do not really accept in 
general)
> 
> 
> Python code is *full* of encapsulation. Functions, methods, classes, 
> 
> modules, packages, even local variables, are all mechanisms for 
> 
> encapsulating code and data. Those who say that Python has little or no 
> 
> encapsulation are talking rubbish.
> > Chaz's definition of
> 
> > encapsulation is also mine.
> 
> 
> 
> Who is Chaz, and what definition does he have?

See above me chaz...@gmail.com, the definition of encapsulation from his OST 
course is fine by y standards, quoting him:
"I'm taking the Python Cert series w/ O'Reilly School of Technology, which I 
recommend if you've got a good handle on OO programming.  In any event, 
according to what I've learned, "encapsulation is the idea that the only way to 
access or change the data inside an object is by calling its methods. This idea 
has never really gained much ground in the Python world, and it is normally 
considered acceptable to both read and set an object's attributes from anywhere 
in a program." 

Keep in mind that we are talking about Encapsulation(a general/philosophical 
principle) as opposed to encapsulating (i.e. setting an argument so that it can 
only be read/written from within its class/object)
this is a key conceptual point. I agree with you that Python allows you to 
enforce the encapsulation principle within your code, whenever you want it. But 
not as a principle that you NEED to respect(as in Java for instance). It is, in 
my opinion, much better this way. 

> And now you are talking about information hiding and protection, which is 
> 
> not the same of encapsulation, no matter what the academics think. 
> 
> Sometimes the air gets a bit too thin to breathe way up at the top of 
> 
> those ivory towers...
> 
I am no academic, and I think that's right.
> 
> 
> Encapsulation is about grouping code that needs to be together together. 
> 
> In contract, you have programming languages that give you little, or 
> 
> nothing, in the way of grouping -- everything is one big chunk of code, 
> 
> with GOTO or GOSUB to jump from place to place.
> 
> 
I think that I prefer chaz' definition (it is, how could I put it... A tad 
easier to understand)
> 
> Functions and procedures are the first, most simple, form of 
> 
> encapsulation. Classes allow you to encapsulate multiple functions 
> 
> ("methods") together with the data they need to operate on in one chunk. 
> 
> Even in C++ or Java, you can have classes that provide no information 
> 
> hiding at all -- just declare everything "public".
> 
> 
> 
> On the other hand, non-OOP languages like C can implement information 
> 
> hiding. In C, you can hide information from other files by declaring them 
> 
> as "static". Variables declared inside a brace-delimited block only exist 
> 
> within that block: local variables are hidden. For example:
> 
> 
> 
> int foo;
> 
> static int bar;
> 
> 
> 
> 
> 
> bar is hidden from other files. Likewise, in this function:
> 
> 
> 
>  
> 
> int func(void) {
> 
>int baz;
> 
>...
> 
> }
> 
> 
> 
> 
> 
> baz is local to func, and invisible to any other function.
> 
> 
> 
> So you can have information hiding without classes, and classes without 
> 
> information hiding. The two concepts are obviously independent, but as 
> 
> usual, the academics who are in love with OOP like to pretend that 
> 
> anything that is of any interest whatsoever in computing was invented by 
> 
> Java and C++.
> 
> 
> 
> There are even languages with functions, but no local variables. For 
> 
> instance, older versions of Forth let you define functions, what Forth 
> 
> calls "words", but all functions operate on the same global stack.
> 
> 
> 
> Python has excellent encapsulation: we can combine code that ought to be 
> 
> together into a function, related functions into a class, related classes 
> 
> into a module, and related modules into a package.
> 
> 
> 
> 
> 
> > Now, lets get to the pretentious philosophical discussion: I guess
> 
> > encapsulation is quite the opposite of, say, dynamic typing, which is
> 
> > arguably core in Python. 
> 
> 
> 
> They are utterly unrelated. Dynamic typing has nothing to do with whether 
> 
> or not you can encapsulate code into chunks (subroutines, functions, 
> 
> modules, classes...) or whether you have to write one

Re: semicolon at end of python's statements

2013-08-30 Thread Terry Reedy

On 8/30/2013 8:09 PM, Steven D'Aprano wrote:


We really are spoiled for choice here. We can write any of these:

# Option 1
for spam in sequence:
 if predicate(spam):
 process(spam)

# Option 2
for spam in filter(predicate, sequence):
 process(spam)

# Option 3
for spam in (spam for spam in sequence if predicate(spam)):
 process(spam)


Adding a fourth option:

for spam in sequence if predicate(spam):
 process(spam)

saves absolutely nothing except a line and an indent level, neither of
which are in short supply, and gains nothing in readability over Option 1.


Which is why it has been rejected.


But of all the options shown, including the hypothetical for...if, I
still prefer Option 1, or Option 2 as my second option.


Ditto.

I think people would be better off spending more time learning more 
about how to use this incredibly powerful tool we have and less arguing 
for rejected redundant alternatives to what we do have. Just a few days 
ago, after 16 years of Python, I learned something really neat about 
function attributes of instances that made a certain testing problem 
disappear.


--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: Encapsulation unpythonic?

2013-08-30 Thread Steven D'Aprano
On Fri, 30 Aug 2013 10:43:28 -0700, Fabrice Pombet wrote:

> On Saturday, August 17, 2013 2:26:32 PM UTC+2, Fernando Saldanha wrote:

>> 2) If it is in fact true that encapsulation is rarely used, how do I
>> deal with the fact that other programmers can easily alter the values
>> of members of my classes?
>> 
> Fernando, it is widely accepted that Python pays very little attention
> to encapsulation as a principle set in stone.

Widely accepted by whom?

Python code is *full* of encapsulation. Functions, methods, classes, 
modules, packages, even local variables, are all mechanisms for 
encapsulating code and data. Those who say that Python has little or no 
encapsulation are talking rubbish.


> Chaz's definition of
> encapsulation is also mine.

Who is Chaz, and what definition does he have?


> Now you need to consider that taking this
> principle off the hostel of OOP does not mean that you can do whatever
> you fancy and you can't make anything unsettable.
> 
> There are plenty of techniques within Python that allow you to protect
> your arguments (in particular, decorators) inside a Class.

And now you are talking about information hiding and protection, which is 
not the same of encapsulation, no matter what the academics think. 
Sometimes the air gets a bit too thin to breathe way up at the top of 
those ivory towers...

Encapsulation is about grouping code that needs to be together together. 
In contract, you have programming languages that give you little, or 
nothing, in the way of grouping -- everything is one big chunk of code, 
with GOTO or GOSUB to jump from place to place.

Functions and procedures are the first, most simple, form of 
encapsulation. Classes allow you to encapsulate multiple functions 
("methods") together with the data they need to operate on in one chunk. 
Even in C++ or Java, you can have classes that provide no information 
hiding at all -- just declare everything "public".

On the other hand, non-OOP languages like C can implement information 
hiding. In C, you can hide information from other files by declaring them 
as "static". Variables declared inside a brace-delimited block only exist 
within that block: local variables are hidden. For example:

int foo;
static int bar;


bar is hidden from other files. Likewise, in this function:

 
int func(void) {
   int baz;
   ...
}


baz is local to func, and invisible to any other function.

So you can have information hiding without classes, and classes without 
information hiding. The two concepts are obviously independent, but as 
usual, the academics who are in love with OOP like to pretend that 
anything that is of any interest whatsoever in computing was invented by 
Java and C++.

There are even languages with functions, but no local variables. For 
instance, older versions of Forth let you define functions, what Forth 
calls "words", but all functions operate on the same global stack.

Python has excellent encapsulation: we can combine code that ought to be 
together into a function, related functions into a class, related classes 
into a module, and related modules into a package.


> Now, lets get to the pretentious philosophical discussion: I guess
> encapsulation is quite the opposite of, say, dynamic typing, which is
> arguably core in Python. 

They are utterly unrelated. Dynamic typing has nothing to do with whether 
or not you can encapsulate code into chunks (subroutines, functions, 
modules, classes...) or whether you have to write one big amorphous 
unstructured program where every chunk of code can reach inside other 
chunks of code. Nor does dynamic type have to do with information hiding. 
You can have a private member of a class regardless of whether that 
member has a single fixed type enforced at compile-time, or a dynamically 
typed value enforced at run-time.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Interface and duck typing woes

2013-08-30 Thread Ned Batchelder

On 8/30/13 8:13 PM, Steven D'Aprano wrote:

On Fri, 30 Aug 2013 06:35:47 -0400, Roy Smith wrote:


In article <52200699$0$6599$c3e8da3$54964...@news.astraweb.com>,
  Steven D'Aprano  wrote:


These days, it would be relatively simple to implement pre- and post-
condition checking using decorators, and indeed one of the motivating
use- cases for function annotations in Python 3 is to allow such
things.

http://www.python.org/dev/peps/pep-3107/

(Function annotations are perhaps the best Python feature that nobody
uses.)

This is awesome.


Heh, everybody has one of two reactions:

"This is awesome!"

"You'll add type checking to my Python code over my dead body!!!"

But I'm still to see a practical use for annotations in real world code.
Or indeed to think of a use for them other than type checking.




At PyCon 2007 (I think), Guido was giving a keynote about the features 
coming in Py3k, and he couldn't remember the name "function 
annotations." He said, "what are they called, the things that aren't 
type declarations."


--Ned.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Using PyQT with QT Designer

2013-08-30 Thread tausciam
Lee Harr, thank you. I took your suggestion after I finished coding the audio 
section. You can see the improved project here: http://i.imgur.com/permuRQ.jpg

On Friday, August 23, 2013 7:35:53 PM UTC-5, Lee Harr wrote:
> > That's the problem though. It is exactly how I want it in designer. It's
> > perfect as it is in designer when I preview it. Here is a screenshot of the
> > preview: http://i.imgur.com/ULRolq8.png
> 
> That's not a preview. That's just the regular design view.
> (you can tell by the little dots in the background)
> 
> You need to go to Form -> Preview... to see the actual preview.
> 
> That said...
> 
> 1.) You may want to ask your question on the PyQt mailing list. Though
> you are talking with the undisputed PyQt expert in Phil, there are more
> people on the other list who are familiar with PyQt and who may be willing
> to look more closely at your specific code.
> 
> 2.) It may be that the examples you are looking at are not sufficient to
> help you with the situation you are in. For instance, I've written several
> programs using Designer and PyQt and I would recommend against
> using the pyuic method.
> 
> When I first started with PyQt I also used pyuic and eventually I found
> the PyQt4.uic method works better for me.
> 
> 3.) Layouts. You have to use them with Qt or you're going to have a
> bad time.
> 
> Looking at your design, I would do something like ...
> 
> - select the two buttons on the left and click "Lay Out Vertically"
> - select the two large white boxes and click "Lay Out Vertically"
> - put a vertical spacer underneath the red X button
> - select the red button and the spacer and click "Lay Out Vertically"
> - at this point you may need to resize and rearrange your three vertical
>    layouts so that they don't overlap and are in approximately the positions
>    that you want, then
> - select the main window and click "Lay Out Horizontally"
> 
> Something along those lines would get you about to where you want
> to be. The form may not look _exactly_ the way you have it there, but
> it will be a more flexible design and nothing will be overlapping.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python script to gather file links into textfile

2013-08-30 Thread Steven D'Aprano
On Fri, 30 Aug 2013 03:53:05 -0700, david.dsch wrote:

> Hi, im looking for someone who can make a script that gathers all file
> links from an url into a textfile, like this :
> http://pastebin.com/jfD31r1x

You've come to the right place! My rate is AUD$100 an hour. Contact me if 
you are interested.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Interface and duck typing woes

2013-08-30 Thread Steven D'Aprano
On Fri, 30 Aug 2013 06:35:47 -0400, Roy Smith wrote:

> In article <52200699$0$6599$c3e8da3$54964...@news.astraweb.com>,
>  Steven D'Aprano  wrote:
> 
>> These days, it would be relatively simple to implement pre- and post-
>> condition checking using decorators, and indeed one of the motivating
>> use- cases for function annotations in Python 3 is to allow such
>> things.
>> 
>> http://www.python.org/dev/peps/pep-3107/
>> 
>> (Function annotations are perhaps the best Python feature that nobody
>> uses.)
> 
> This is awesome.


Heh, everybody has one of two reactions: 

"This is awesome!"

"You'll add type checking to my Python code over my dead body!!!"

But I'm still to see a practical use for annotations in real world code. 
Or indeed to think of a use for them other than type checking.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: semicolon at end of python's statements

2013-08-30 Thread Steven D'Aprano
On Fri, 30 Aug 2013 11:32:17 +0100, Fábio Santos wrote:

> On 29 Aug 2013 23:20, "Ben Finney"  wrote:
>>
>> Fábio Santos  writes:
>>
>> > It is a shame that this is not possible in python. for..if exists in
>> > comprehensions and not in regular loops but that would be nice
>> > sometimes.
>>
>> So you use it in a generator expression, and iterate over the
>> generator:
>>
>> for foo in (spam for spam in sequence if predicate(spam)):
>> process(spam)
>>
>> That way, there's no need for new syntax.
> 
> The problem I have with that strategy is that it is repetitive and
> hinders readability. You wrote "for" and "in" twice, and spam (a pretty
> useless intermediate variable) thrice! 

There is no need for spam to be "intermediate", and the fact that it 
shouldn't be is demonstrated by Ben's error in referring to "process
(spam)" instead of "process(foo)".

We really are spoiled for choice here. We can write any of these:

# Option 1
for spam in sequence:
if predicate(spam):
process(spam)

# Option 2
for spam in filter(predicate, sequence):
process(spam)

# Option 3
for spam in (spam for spam in sequence if predicate(spam)):
process(spam)


Adding a fourth option:

for spam in sequence if predicate(spam):
process(spam)

saves absolutely nothing except a line and an indent level, neither of 
which are in short supply, and gains nothing in readability over Option 1.



> While it does its job, it hides
> the true intent for filtering beneath a lot of (pun intended) spam. The
> "if" particle is nigh undetectable there.
> 
> To get around this, I often declare a generator. But I still find it a
> bit awkward to have to look up the definition elsewhere, and to waste
> lines over something so simple.

No need to look up a definition elsewhere, you can put the generator 
right next to the loop:

gen = (spam for spam in sequence if predicate(spam))
for spam in gen:
process(spam)


But of all the options shown, including the hypothetical for...if, I 
still prefer Option 1, or Option 2 as my second option.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Gunstar - Another python web framework.

2013-08-30 Thread Allisson Azevedo
It's a recent project, check this out: http://github.com/allisson/gunstar

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Lettuce vs Behave

2013-08-30 Thread Ben Finney
jumpmanl...@myopera.com writes:

> On Friday, August 16, 2013 1:15:01 PM UTC-4, cutems93 wrote:
> > As professionals, what do you prefer and why?
>
> +1 for Behave

And why?

-- 
 \  “In the long run, the utility of all non-Free software |
  `\  approaches zero. All non-Free software is a dead end.” —Mark |
_o__)Pilgrim, 2006 |
Ben Finney

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: semicolon at end of python's statements

2013-08-30 Thread Chris Angelico
On Sat, Aug 31, 2013 at 12:14 AM, Antoon Pardon
 wrote:
> Maybe python should just allow more than one control structure on one
> line and then considers the end of the suite the end of both controls.
> In that case we could just write the following:
>
>   for a in lst: if a % 2:
>   treat a
>   process a some more
>   after loop things.

Exactly what I suggested a while ago :) This is how we got onto this
subject - a discussion of how physical structure and logical structure
can differ.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: subprocess.Popen instance hangs

2013-08-30 Thread Tim Johnson
* Jerry Hill  [130830 07:48]:
> On Fri, Aug 30, 2013 at 11:32 AM, Tim Johnson  wrote:
> >   The objective is to display all output, but to also separate error
> >   messages from normal output.
> 
> I still think you want to use communicate().  Like this:
> 
> p = subprocess.Popen(args,stderr=subprocess.PIPE,stdout=subprocess.PIPE)
> output, err = p.communicate()
> 
> That's it.  No need for a loop, or manually handling the fact that
> stderr and/or stdout could end up with a full buffer and start to
> block.
  The following code :
p = subprocess.Popen(args,stderr=subprocess.PIPE,stdout=subprocess.PIPE)
errmsg,output = p.communicate()
... Hangs
this code :
p = subprocess.Popen(args,stderr=subprocess.PIPE,stdout=subprocess.PIPE)
while 1 :
output = p.stdout.read()
if output :
print(output)
else : break
... works
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: subprocess.Popen instance hangs

2013-08-30 Thread Tim Johnson
* Nobody  [130830 06:55]:
> On Thu, 29 Aug 2013 17:00:21 -0800, Tim Johnson wrote:
> 
> > ## This appears to be what works.
> > def __exec(self,args) :
> > """Run the process with arguments"""
> >p =
> >subprocess.Popen(args,stderr=subprocess.PIPE,stdout=subprocess.PIPE)
> >while 1 :
> >output = p.stdout.read()
> 
> If the process tries to write more than a pipe's worth of data to stderr,
> before closing stdout, it will block indefinitely.
> 
> If you want to process both stdout and stderr, you have to be able to
> consume the data in whatever order the process generates it, which means
> either using multiple threads or (on Unix) select/poll or non-blocking
> I/O. This is what the .communicate() method does (threads on Windows,
> select/poll on Unix).
> 
> The alternative is to merge both streams with stderr=subprocess.STDOUT, or
> redirect one of them to a file (or /dev/null, etc).
  In earlier code I, I was merging them...
  :) Like I said: gnarly! What if I were to do something like:
  ## code
  while 1: 
output = p.stout.read()
err = p.stderr.read() ## trapping for AttributeError, etc..

  ## /code
break'ing if either no output or value in `err' 
 ?? 
  The objective is to display all output, but to also separate error
  messages from normal output.

  thank you
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Encapsulation unpythonic?

2013-08-30 Thread Fabrice Pombet
On Saturday, August 17, 2013 2:26:32 PM UTC+2, Fernando Saldanha wrote:
> I am new to Python, with experience in Java, C++ and R. 
> 
> 
> 
> As I understand encapsulation is not a big thing in the Python world. I read 
> that you can put two underscores before the name of a variable within a class 
> declaration but in the many examples of code I looked at this is not widely 
> used. I also read that encapsulation is "unpythonic."
> 
> 
> 
> Questions:
> 
> 
> 2) If it is in fact true that encapsulation is rarely used, how do I deal 
> with the fact that other programmers can easily alter the values of members 
> of my classes?
> 
Fernando, it is widely accepted that Python pays very little attention to 
encapsulation as a principle set in stone. Chaz's definition of encapsulation 
is also mine. Now you need to consider that taking this principle off the 
hostel of OOP does not mean that you can do whatever you fancy and you can't 
make anything unsettable.

There are plenty of techniques within Python that allow you to protect your 
arguments (in particular, decorators) inside a Class.

Now, lets get to the pretentious philosophical discussion: I guess 
encapsulation is quite the opposite of, say, dynamic typing, which is arguably 
core in Python. In practice this allows Python to be less verbose: at the end 
of the day, if you look back at your previous languages, don't you find that 
some of their compulsory features are usually more of a pain than something 
useful in practice? And after all, whither encapsulation? Can't we just have 
objects whose arguments are determined externally if we want to?
And that is the ballgame: as my old tutor says: "the claptrap of setters and 
getters does not need to be here if it is unnecessary". I would add: "so long 
as you can have them when you deem it necessary", and Python allows that.

-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: A new version (0.3.5) of python-gnupg has been released.

2013-08-30 Thread Vinay Sajip
A new version of the Python module which wraps GnuPG has been
released.

What Changed?
=
This is a minor enhancement and bug-fix release. See the project
website ( http://code.google.com/p/python-gnupg/ ) for more
information. Summary:

Added improved shell quoting to guard against shell injection attacks.
Added search_keys() and send_keys() methods to interact with keyservers.
A symmetric cipher algorithm can now be specified when encrypting.
UTF-8 encoding is used as a fall back when no other encoding can be determined.
The key length now defaults to 2048 bits.
A default Name-Comment field is no longer provided during key generation.

What Does It Do?

The gnupg module allows Python programs to make use of the
functionality provided by the Gnu Privacy Guard (abbreviated GPG or
GnuPG). Using this module, Python programs can encrypt and decrypt
data, digitally sign documents and verify digital signatures, manage
(generate, list and delete) encryption keys, using proven Public Key
Infrastructure (PKI) encryption technology based on OpenPGP.

This module is expected to be used with Python versions >= 2.4, as it
makes use of the subprocess module which appeared in that version of
Python. This module is a newer version derived from earlier work by
Andrew Kuchling, Richard Jones and Steve Traugott.

A test suite using unittest is included with the source distribution.

Simple usage:

>>> import gnupg
>>> gpg = gnupg.GPG(gnupghome='/path/to/keyring/directory')
>>> gpg.list_keys()
[{
  ...
  'fingerprint': 'F819EE7705497D73E3CCEE65197D5DAC68F1AAB2',
  'keyid': '197D5DAC68F1AAB2',
  'length': '1024',
  'type': 'pub',
  'uids': ['', 'Gary Gross (A test user) ']},
 {
  ...
  'fingerprint': '37F24DD4B918CC264D4F31D60C5FEFA7A921FC4A',
  'keyid': '0C5FEFA7A921FC4A',
  'length': '1024',
  ...
  'uids': ['', 'Danny Davis (A test user) ']}]
>>> encrypted = gpg.encrypt("Hello, world!", ['0C5FEFA7A921FC4A'])
>>> str(encrypted)
'-BEGIN PGP MESSAGE-\nVersion: GnuPG v1.4.9 (GNU/Linux)\n
\nhQIOA/6NHMDTXUwcEAf
...
-END PGP MESSAGE-\n'
>>> decrypted = gpg.decrypt(str(encrypted), passphrase='secret')
>>> str(decrypted)
'Hello, world!'
>>> signed = gpg.sign("Goodbye, world!", passphrase='secret')
>>> verified = gpg.verify(str(signed))
>>> print "Verified" if verified else "Not verified"
'Verified'

For more information, visit http://code.google.com/p/python-gnupg/ -
as always, your feedback is most welcome (especially bug reports,
patches and suggestions for improvement). Enjoy!

Cheers

Vinay Sajip
Red Dove Consultants Ltd.
-- 
http://mail.python.org/mailman/listinfo/python-list


Best practice for generalizing and documenting each method's behaviour

2013-08-30 Thread niubao56
I'm starting a small project coding in Python as I learn the ropes. As the 
project grows bigger, there are more and more overlapping and even redundant 
methods. For example, several classes have a checkAndClean_obj_state() method. 
If just one or two such classes, it is easy to analyze the behaviour of them 
and design the optimal interaction for all objects. However, when there are 
many of such classes, exactly at what point to invoke check and clean behaviour 
becomes a little blurred. There is a desperate need for generalizing and 
documenting the behaviour of each such class, preferably in a flowchart. I'm 
currently doing the flowchart manually but the job becomes a bit overwhelming.

I wonder what Python pros are using for analyzing and documenting 
classes/functions behaviours and interactions? Is UML the only way? Personally 
I found UML is a bit overkill for a one person project, but I'm not sure if it 
is the right direction. I'd appreciate any insight. Many thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: sax.handler.Contenthandler.__init__

2013-08-30 Thread Prasad, Ramit
Neil Cerutti wrote:
> This code is from The Python Cookbook, 2nd edition, 12.2 Counting
> Tags in a Document:
> 
> from xml.sax.handler import ContentHandler
> import xml.sax
> class countHandler(ContentHandler):
> def __init__(self):
> self.tags={}
> def startElement(self, name, attr):
> self.tags[name] = 1 + self.tags.get(name, 0)
> 
> Isn't overriding __init__ a risky thing to do? The docs don't
> mention it as a method I should override, and also don't define
> what's in there or if I'd need to call the base class __init__.
> Moreover, startDocument is provided for parser setup.
> 
> As it happens, ContentHandler.__init__ isn't empty, so the above
> code could fail if the parser isn't prepared for _locator to be
> undefined.
> 
> Is the above code is an acceptable idiom?
> 
> --
> Neil Cerutti
> --

I think this is a bad idea unless you want to avoid the parent 
class __init__ specifically (in which case a comment stating 
why is mandatory). I do not like that this recipe shows behavior
that might be fine in this instance, but is not a good general 
practice.

 def __init__(self):
 super(ContentHandler, self).__init__()
 #OR ContentHandler.__init__(self)
 self.tags={}

I personally think the super() line is better of the two options.

~Ramit



This email is confidential and subject to important disclaimers and conditions 
including on offers for the purchase or sale of securities, accuracy and 
completeness of information, viruses, confidentiality, legal privilege, and 
legal entity disclaimers, available at 
http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: web2py - running on fedora

2013-08-30 Thread Joel Goldstick
On Fri, Aug 30, 2013 at 1:13 PM, bruce  wrote:
> Hi.
>
> I know this is a python list, but hoping that I can find someone to
> help get a base install of web2py running.
>
> I've got an older version of fedora, running py 2.6.4 running apache v2.2
>
> I'm simply trying to get web2py up/running, and then to interface it
> with apache, so that the existing webapps (php apps) don't get screwed
> up.
>
> Thanks
>
> -bruce
> --
> http://mail.python.org/mailman/listinfo/python-list


Do you know about google?  I just seached this: 'installing web2py apache'

and I got whole lot of information.  Why don't you try to get it
running and come back with a specific question if you get stuck?
-- 
Joel Goldstick
http://joelgoldstick.com
-- 
http://mail.python.org/mailman/listinfo/python-list


sax.handler.Contenthandler.__init__

2013-08-30 Thread Neil Cerutti
This code is from The Python Cookbook, 2nd edition, 12.2 Counting
Tags in a Document:

from xml.sax.handler import ContentHandler
import xml.sax
class countHandler(ContentHandler):
def __init__(self):
self.tags={}
def startElement(self, name, attr):
self.tags[name] = 1 + self.tags.get(name, 0)

Isn't overriding __init__ a risky thing to do? The docs don't
mention it as a method I should override, and also don't define
what's in there or if I'd need to call the base class __init__.
Moreover, startDocument is provided for parser setup.

As it happens, ContentHandler.__init__ isn't empty, so the above
code could fail if the parser isn't prepared for _locator to be
undefined.

Is the above code is an acceptable idiom?

-- 
Neil Cerutti
-- 
http://mail.python.org/mailman/listinfo/python-list


web2py - running on fedora

2013-08-30 Thread bruce
Hi.

I know this is a python list, but hoping that I can find someone to
help get a base install of web2py running.

I've got an older version of fedora, running py 2.6.4 running apache v2.2

I'm simply trying to get web2py up/running, and then to interface it
with apache, so that the existing webapps (php apps) don't get screwed
up.

Thanks

-bruce
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: subprocess.Popen instance hangs

2013-08-30 Thread Jerry Hill
On Fri, Aug 30, 2013 at 11:32 AM, Tim Johnson  wrote:
>   The objective is to display all output, but to also separate error
>   messages from normal output.

I still think you want to use communicate().  Like this:

p = subprocess.Popen(args,stderr=subprocess.PIPE,stdout=subprocess.PIPE)
output, err = p.communicate()

That's it.  No need for a loop, or manually handling the fact that
stderr and/or stdout could end up with a full buffer and start to
block.

-- 
Jerry
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python script to gather file links into textfile

2013-08-30 Thread Joel Goldstick
David,

actually, what is the url?  I read about you a little and it looks
like you are into music but not a software guy.  You might be better
off finding someone local to write the code for you.  People here
generally help people with actual coding problems, or discuss aspects
of python, but if you  want to hire someone you will need to give more
specific details of what you want done

On Fri, Aug 30, 2013 at 10:56 AM, Joel Goldstick
 wrote:
>>
>>> On 2013-08-30, david.d...@gmail.com  wrote:

 Hi, im looking for someone who can make a script that gathers
 all file links from an url into a textfile, like this :
 http://pastebin.com/jfD31r1x
>>
> Sometimes its good to look in the closets or under the beds.  People
> forget what they put in those places sometimes.
>
>
>
> --
> Joel Goldstick
> http://joelgoldstick.com



-- 
Joel Goldstick
http://joelgoldstick.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Python Weekend Challenge - $$

2013-08-30 Thread Michael Herman
https://gist.github.com/mjhea0/6390724

Check it out!:)

Have a great labor day weekend.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python script to gather file links into textfile

2013-08-30 Thread Joel Goldstick
>
>> On 2013-08-30, david.d...@gmail.com  wrote:
>>>
>>> Hi, im looking for someone who can make a script that gathers
>>> all file links from an url into a textfile, like this :
>>> http://pastebin.com/jfD31r1x
>
Sometimes its good to look in the closets or under the beds.  People
forget what they put in those places sometimes.



-- 
Joel Goldstick
http://joelgoldstick.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: subprocess.Popen instance hangs

2013-08-30 Thread Nobody
On Thu, 29 Aug 2013 17:00:21 -0800, Tim Johnson wrote:

> ## This appears to be what works.
> def __exec(self,args) :
> """Run the process with arguments"""
>p =
>subprocess.Popen(args,stderr=subprocess.PIPE,stdout=subprocess.PIPE)
>while 1 :
>output = p.stdout.read()

If the process tries to write more than a pipe's worth of data to stderr,
before closing stdout, it will block indefinitely.

If you want to process both stdout and stderr, you have to be able to
consume the data in whatever order the process generates it, which means
either using multiple threads or (on Unix) select/poll or non-blocking
I/O. This is what the .communicate() method does (threads on Windows,
select/poll on Unix).

The alternative is to merge both streams with stderr=subprocess.STDOUT, or
redirect one of them to a file (or /dev/null, etc).

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Lettuce vs Behave

2013-08-30 Thread jumpmanlane
On Friday, August 16, 2013 1:15:01 PM UTC-4, cutems93 wrote:
> I found that BDD is a very good philosophy for coding and checking my 
> program, and I decided to use either of these two software. However, it seems 
> these two are very similar in the way they function. As professionals, what 
> do you prefer and why?

+1 for Behave

-J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: semicolon at end of python's statements

2013-08-30 Thread Antoon Pardon
Op 30-08-13 12:53, Roy Smith schreef:
> In article ,
>  Fábio Santos  wrote:
> 
>> On 29 Aug 2013 23:20, "Ben Finney"  wrote:
>>>
>>> Fábio Santos  writes:
>>>
 It is a shame that this is not possible in python. for..if exists in
 comprehensions and not in regular loops but that would be nice
 sometimes.
>>>
>>> So you use it in a generator expression, and iterate over the generator:
>>>
>>> for foo in (spam for spam in sequence if predicate(spam)):
>>> process(spam)
>>>
>>> That way, there's no need for new syntax.
>>
>> The problem I have with that strategy is that it is repetitive and hinders
>> readability. You wrote "for" and "in" twice, and spam (a pretty useless
>> intermediate variable) thrice! While it does its job, it hides the true
>> intent for filtering beneath a lot of (pun intended) spam. The "if"
>> particle is nigh undetectable there.
>>
>> To get around this, I often declare a generator. But I still find it a bit
>> awkward to have to look up the definition elsewhere, and to waste lines
>> over something so simple.
>>
>> I can't say I understand why we don't merge the for loops' syntax with the
>> comprehension syntax. Even after following the for..while discussion.
> 
> +1 on loop comprehensions, for all the reasons Fábios states.

Maybe python should just allow more than one control structure on one
line and then considers the end of the suite the end of both controls.
In that case we could just write the following:

  for a in lst: if a % 2:
  treat a
  process a some more
  after loop things.

It technically is not loop comprehension but just nested controls but
by allowing them on the same line it looks close enough like loop
comprehension.

Plus if people have a problem that would best be solved by a while loop
comprehension that would be just as easy.

-- 
Antoon Pardon

-- 
http://mail.python.org/mailman/listinfo/python-list


صفحتنا على الفيس بوك اشترك الان اخباريه وترفيه وصور

2013-08-30 Thread 23alagmy
صفحتنا على الفيس بوك اشترك الان اخباريه وترفيه وصور

https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550?ref=hl
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about XMLRPC

2013-08-30 Thread Ferrous Cranus

Στις 29/8/2013 6:30 μμ, ο/η Ferrous Cranus έγραψε:

Στις 29/8/2013 3:35 μμ, ο/η Ferrous Cranus έγραψε:

Στις 29/8/2013 2:54 μμ, ο/η Gregory Ewing έγραψε:

i.she...@gmail.com wrote:


I should write a python script(s) that listens to an existing XMLRPC
service on my company's dev server.



then i should parse that and return to the existing XML-RPC,

 > or write the parsed data to the Posgresql database.


but i'm not permitted to edit the existing XMLRPC service.


It's not clear exactly what you mean by this. Are you trying
to intercept XMLRPC requests sent to an existing service and
do something different with them?

To do that without modifying the existing service, you would
need to change your web server's configuration to redirect
the url of the service to a handler of your own. Are you
able to do that, or get your administrators to do it?


test


test


test

--
Webhost 
--
http://mail.python.org/mailman/listinfo/python-list


Re: python script to gather file links into textfile

2013-08-30 Thread Bastien Amiel

Le 30/08/2013 15:01, Neil Cerutti a écrit :

On 2013-08-30, david.d...@gmail.com  wrote:

Hi, im looking for someone who can make a script that gathers
all file links from an url into a textfile, like this :
http://pastebin.com/jfD31r1x

1. Read the file with urls
http://stackoverflow.com/questions/3925614/how-do-you-read-a-file-into-a-list-in-python

2. Download each url
http://stackoverflow.com/questions/22676/how-do-i-download-a-file-over-http-using-python

Michael Jackson advises you to start with the man in the mirror.

:D


--
http://mail.python.org/mailman/listinfo/python-list


Re: python script to gather file links into textfile

2013-08-30 Thread Neil Cerutti
On 2013-08-30, david.d...@gmail.com  wrote:
> Hi, im looking for someone who can make a script that gathers
> all file links from an url into a textfile, like this :
> http://pastebin.com/jfD31r1x

Michael Jackson advises you to start with the man in the mirror.

-- 
Neil Cerutti
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to keep cookies when making http requests (Python 2.7)

2013-08-30 Thread Luca Cerone
Thanks Dieter,
 
> With respect to cookie handling, you do everything right.
> 
> 
> 
> There may be other problems with the (wider) process.
> 
> Analysing the responses of your requests (reading the status codes,
> 
> the response headers and the response bodies) may provide hints
> 
> towards the problem.
> 

I will try to do that and try to see if I can figure out why.

> 
> 
> >Do I misunderstand something in the process?
> 
> 
> 
> Not with respect to cookie handling.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: semicolon at end of python's statements

2013-08-30 Thread Roy Smith
In article ,
 Fábio Santos  wrote:

> On 29 Aug 2013 23:20, "Ben Finney"  wrote:
> >
> > Fábio Santos  writes:
> >
> > > It is a shame that this is not possible in python. for..if exists in
> > > comprehensions and not in regular loops but that would be nice
> > > sometimes.
> >
> > So you use it in a generator expression, and iterate over the generator:
> >
> > for foo in (spam for spam in sequence if predicate(spam)):
> > process(spam)
> >
> > That way, there's no need for new syntax.
> 
> The problem I have with that strategy is that it is repetitive and hinders
> readability. You wrote "for" and "in" twice, and spam (a pretty useless
> intermediate variable) thrice! While it does its job, it hides the true
> intent for filtering beneath a lot of (pun intended) spam. The "if"
> particle is nigh undetectable there.
> 
> To get around this, I often declare a generator. But I still find it a bit
> awkward to have to look up the definition elsewhere, and to waste lines
> over something so simple.
> 
> I can't say I understand why we don't merge the for loops' syntax with the
> comprehension syntax. Even after following the for..while discussion.

+1 on loop comprehensions, for all the reasons Fábios states.
-- 
http://mail.python.org/mailman/listinfo/python-list


python script to gather file links into textfile

2013-08-30 Thread david . dsch
Hi, im looking for someone who can make a script that gathers all file links
from an url into a textfile, like this : http://pastebin.com/jfD31r1x

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Interface and duck typing woes

2013-08-30 Thread Roy Smith
In article <52200699$0$6599$c3e8da3$54964...@news.astraweb.com>,
 Steven D'Aprano  wrote:

> These days, it would be relatively simple to implement pre- and post-
> condition checking using decorators, and indeed one of the motivating use-
> cases for function annotations in Python 3 is to allow such things.
> 
> http://www.python.org/dev/peps/pep-3107/
> 
> (Function annotations are perhaps the best Python feature that nobody 
> uses.)

This is awesome.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: semicolon at end of python's statements

2013-08-30 Thread Fábio Santos
On 29 Aug 2013 23:20, "Ben Finney"  wrote:
>
> Fábio Santos  writes:
>
> > It is a shame that this is not possible in python. for..if exists in
> > comprehensions and not in regular loops but that would be nice
> > sometimes.
>
> So you use it in a generator expression, and iterate over the generator:
>
> for foo in (spam for spam in sequence if predicate(spam)):
> process(spam)
>
> That way, there's no need for new syntax.

The problem I have with that strategy is that it is repetitive and hinders
readability. You wrote "for" and "in" twice, and spam (a pretty useless
intermediate variable) thrice! While it does its job, it hides the true
intent for filtering beneath a lot of (pun intended) spam. The "if"
particle is nigh undetectable there.

To get around this, I often declare a generator. But I still find it a bit
awkward to have to look up the definition elsewhere, and to waste lines
over something so simple.

I can't say I understand why we don't merge the for loops' syntax with the
comprehension syntax. Even after following the for..while discussion.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a function that applies list of functions to a value?

2013-08-30 Thread Fabrice Pombet
On Friday, August 30, 2013 8:36:40 AM UTC+2, alex23 wrote:
> On 30/08/2013 4:17 PM, fp2...@gmail.com wrote:
> 
> > On Wednesday, August 28, 2013 8:50:53 PM UTC+2, Josh English wrote:
> 
> >> def compose(*funcs):
> 
> >>  for func in funcs:
> 
> >>  if not callable(func):
> 
> >>  raise ValueError('Must pass callable functions')
> 
> 
> 
> > Imho still, the ValueError you are raising is not that important in this 
> > context, it would raise an Error anyway.
> 
> 
> 
> The main advantage with Josh's approach is that it fails at the point of 
> 
> composition, not when the composed function is first used.  It'd be even 
> 
> more useful if it aggregated a list of the failing functions and 
> 
> returned their names as part of the error.
> 
> 
> 
> Personally, I'd go with an assertion:
> 
> 
> 
>  assert all(map(callable, funcs)), "Must pass callable functions"
> 
> 
> 
> I find that it makes it more obvious that this is part of the function 
> 
> contract rather than the actual body.

it is a valid point, but I would contend that it makes this quick and easy code 
a little bit heavy just for the sake of ensuring that you are composing 
composable functions... The assertion is definitely better.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a function that applies list of functions to a value?

2013-08-30 Thread Fabrice Pombet
On Friday, August 30, 2013 8:23:44 AM UTC+2, alex23 wrote:
> On 30/08/2013 4:14 PM, fp2...@gmail.com wrote:
> 
> > For this purpose however, I suspect that a named function with a proper 
> > docstring that can be imported and reused over and over again is probably 
> > more appropriate than a lambda
> 
> 
> 
> Given that in Chris' example the lambda was returned from a factory, 
> 
> importing the inner function by name is never going to be a concern.
> 
> 
> 
> It's also possible to assign to both __name__ and __doc__ for a lambda, 
> 
> which can be useful at times.
I am sorry, I can't see any of Chris' code in this thread, where is it???
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: semicolon at end of python's statements

2013-08-30 Thread Antoon Pardon
Op 30-08-13 09:25, Chris Angelico schreef:
> On Fri, Aug 30, 2013 at 5:15 PM, Antoon Pardon
>  wrote:
>> Op 30-08-13 06:55, Ben Finney schreef:
>>> Ben Finney  writes:
>>>
 Fábio Santos  writes:

> It is a shame that this is not possible in python. for..if exists in
> comprehensions and not in regular loops but that would be nice
> sometimes.
 for foo in (spam for spam in sequence if predicate(spam)): …
>>>
>>> Better:
>>>
>>> for foo in filter(predicate, sequence):
>>> process(foo)
>>
>> Well better in what way? You now have to translate a predicate
>> expression into a predicate function. Which AFAIU was one of
>> the reasons to move away from map/filter to list comprehension.
>>
>> As I understand it, python made a move away from map and filter
>> towards list comprehension. Chris seems to want some of the
>> possibilities that came with that incorporated into the for
>> statement. And your suggestion is to go back to the old kind
>> of filter way.
> 
> No, actually Ben's quite right - assuming the predicate is a simple
> function,

But why should we assume that? Suppose I would like to process all
odd items in a list. A comprehension kind of notation would be

|  for item in lst if item % 2:
|  process items

Which we would have to turn into

|  for item in filter(lambda nr: nr % 2, lst):
|  process items

But AFAIR, one of the driving forces behind the introduction to list
comprehension, and thus a move away from map and filter was to get rid
of the lambda's in this kind of situations.

> of course (Python's lambda notation is a bit clunky for
> comparisons); as of Python 3, filter() is lazy and is pretty much what
> I'm doing here.

Lazy or not, is AFAICS, not a point here.

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: semicolon at end of python's statements

2013-08-30 Thread Chris Angelico
On Fri, Aug 30, 2013 at 5:15 PM, Antoon Pardon
 wrote:
> Op 30-08-13 06:55, Ben Finney schreef:
>> Ben Finney  writes:
>>
>>> Fábio Santos  writes:
>>>
 It is a shame that this is not possible in python. for..if exists in
 comprehensions and not in regular loops but that would be nice
 sometimes.
>>> for foo in (spam for spam in sequence if predicate(spam)): …
>>
>> Better:
>>
>> for foo in filter(predicate, sequence):
>> process(foo)
>
> Well better in what way? You now have to translate a predicate
> expression into a predicate function. Which AFAIU was one of
> the reasons to move away from map/filter to list comprehension.
>
> As I understand it, python made a move away from map and filter
> towards list comprehension. Chris seems to want some of the
> possibilities that came with that incorporated into the for
> statement. And your suggestion is to go back to the old kind
> of filter way.

No, actually Ben's quite right - assuming the predicate is a simple
function, of course (Python's lambda notation is a bit clunky for
comparisons); as of Python 3, filter() is lazy and is pretty much what
I'm doing here. However, that's still a specific answer to a specific
(albeit common) instance of wanting to merge control structures.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: semicolon at end of python's statements

2013-08-30 Thread Antoon Pardon
Op 30-08-13 06:55, Ben Finney schreef:
> Ben Finney  writes:
> 
>> Fábio Santos  writes:
>>
>>> It is a shame that this is not possible in python. for..if exists in
>>> comprehensions and not in regular loops but that would be nice
>>> sometimes.
>> for foo in (spam for spam in sequence if predicate(spam)): …
> 
> Better:
> 
> for foo in filter(predicate, sequence):
> process(foo)

Well better in what way? You now have to translate a predicate
expression into a predicate function. Which AFAIU was one of
the reasons to move away from map/filter to list comprehension.

As I understand it, python made a move away from map and filter
towards list comprehension. Chris seems to want some of the
possibilities that came with that incorporated into the for
statement. And your suggestion is to go back to the old kind
of filter way.

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list