Re: checking if a list is empty

2011-05-11 Thread Steven D'Aprano
On Wed, 11 May 2011 10:14:38 +0100, Hans Georg Schaathun wrote: > In this case, the interpretation of an arbitrary object as a boolean is > peculiar for python. Incorrect. It is widespread among many languages. Programmers have been writing conditional tests using arbitrary values since 1958 w

Re: Python backup programs?

2011-05-11 Thread Emile van Sebille
On 5/10/2011 4:00 PM Dan Stromberg said... What are your favorite backup programs written, in whole or in part, in Python? bup What do you like about them? resilient and written in python Dislike about them? lack of a user accessible front-end to monitor and restore Are there any fea

Re: Merge multiple source directories into one package with distutils?

2011-05-11 Thread Miki Tebeka
Greg, > Is there a straightforward way to tell distutils to merge .py files from more than one source directory into a single package when installing? The Selenium Python bindings does something like that, have a look at http://selenium.googlecode.com/svn/trunk/setup.py The other option is to wri

Re: Non Programming in python

2011-05-11 Thread Calvin Spealman
If this is the "non-programming side of python" then maybe some of us have a lacking definition of what "programming" is. My mechanic stilll has to check the tire pressure and I need to update the version number in PyPI. On May 10, 2011 12:46 PM, "rusi" wrote: Sorry for a silly subject change:

Re: checking if a list is empty

2011-05-11 Thread Steven D'Aprano
On Wed, 11 May 2011 10:02:42 +0100, Hans Georg Schaathun wrote: > The problem with 'if x' is that it requires a much more detailed > understanding of python. "Much" more detailed? Hardly. Understanding that Python accepts any and all objects in truth-testing concepts, and the rules thereof, is

Re: checking if a list is empty

2011-05-11 Thread Laurent Claessens
I believe you are grossly oversimplifying whatever code you had. Using the definition of f from above: theta = math.pi/4 f(math.cos(2*theta)) 6.12303176911e-17 Yes: its oversimplifued. The angle come from a normal vector of a curve and so on In particular, I was using Sage; the compu

Re: checking if a list is empty

2011-05-11 Thread Laurent Claessens
I believe you are grossly oversimplifying whatever code you had. Using the definition of f from above: theta = math.pi/4 f(math.cos(2*theta)) 6.12303176911e-17 Yes: its oversimplifued. The angle come from a normal vector of a curve and so on In particular, I was using Sage; the compu

HELP. This it is the code of tmb_import.py (to matter of .tmb to blender) I need tmb_exporter.py (to export of blender to .tmb) Thanks.

2011-05-11 Thread Jean Carlos Páez Ramírez
Buen día comunidad Hola. El archivo adjunto es un script de blender hecho en python que sirve para importar archivos .tmb (http://www.mediafire.com/?clmdgkymsfooddd), descargas blender y usa el script e importa el segundo archivo que te envio para que lo veas (http://www.mediafire.com/?lb

HELP. This it is the code of tmb_import.py (to matter of .tmb to blender) I need tmb_exporter.py (to export of blender to .tmb) Thanks.

2011-05-11 Thread Jean Carlos Páez Ramírez
Buen día comunidad Hola. El archivo adjunto es un script de blender hecho en python que sirve para importar archivos .tmb (http://www.mediafire.com/?clmdgkymsfooddd), descargas blender y usa el script e importa el segundo archivo que te envio para que lo veas (http://www.mediafire

Re: checking if a list is empty

2011-05-11 Thread Steven D'Aprano
On Wed, 11 May 2011 11:48:16 +0200, Laurent Claessens wrote: > Once I wrote something like: > > def f(x=None): > if x: >print x > else: >print "I have no value" > > > The caller of that function was something like f(cos(2*theta)) where > theta come from some computations

Re: NewBie Doubt in Python Thread Programming

2011-05-11 Thread Chris Angelico
On Wed, May 11, 2011 at 7:08 PM, vijay swaminathan wrote: > Sorry. My intention was not to send out a private message. when I chose > reply to all, I was confused if this would start as a new thread. so just > did a reply.. No probs. If you just send your response to the list python-list@python.o

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On Sat, 07 May 2011 21:57:13 -0700, Ethan Furman wrote: : If you're going to use a language, and use it well, you have to learn : how that language works. And if the world evolves around the compiler and you, that advice suffices. However, programming is often as much about developing ideas

Re: checking if a list is empty

2011-05-11 Thread Laurent Claessens
In this case, the interpretation of an arbitrary object as a boolean is peculiar for python. An empty list is a real, existing object, and the supposition that [] be false is counter-intuitive. It can be learnt, and the shorthand may be powerful when it is, but it will confuse many readers. On

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On 07 May 2011 02:49:53 GMT, Steven D'Aprano wrote: : On Fri, 06 May 2011 16:05:09 -0400, Adam Tauno Williams wrote: : : > I'd never accept code like "if not x" as an empty test. : : So much the worse for you then. : : The point of the "if x" idiom is that it is a polymorphic test which is

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On 07 May 2011 02:51:50 GMT, Steven D'Aprano wrote: : On Fri, 06 May 2011 14:57:21 -0700, scattered wrote: : : > is there any problem with : > : > (3) if li == []: : > : > ? : > : > Seems to work when I test it and seems to clearly test what you are : > trying to test. The only problem migh

Re: NewBie Doubt in Python Thread Programming

2011-05-11 Thread vijay swaminathan
Sorry. My intention was not to send out a private message. when I chose reply to all, I was confused if this would start as a new thread. so just did a reply.. coming back, I have developed a GUI based on pyQT4 which has a run button. when I click on run, it invokes a command prompt and runs a .b

Re: NewBie Doubt in Python Thread Programming

2011-05-11 Thread Chris Angelico
I'm responding to this on-list on the assumption that this wasn't meant to be private; apologies if you didn't intend for this to be the case! On Wed, May 11, 2011 at 6:38 PM, vijay swaminathan wrote: > so If i understand correctly, once the run method of the thread is executed, > the thread is n

Py3k,email header handling

2011-05-11 Thread TheSaint
Hello, some time ago, I wrote a program to eliminate undesided emails from the server(s) and leave those which comply to certain filter criteria. I started it when I got to know whit Python 2.3. Now a days I'd like to spend some time to improve it, just for my interest, however it didn't gather

Re: NewBie Doubt in Python Thread Programming

2011-05-11 Thread James Mills
On Wed, May 11, 2011 at 4:57 PM, vijay swaminathan wrote: [...] > 1. How the total active thread is 2? Your threads are terminating as normal. Without some kind of loop in your run() method they will execute the instructions and terminate. > 2. how do I stop a thread? does it get automatically

Re: NewBie Doubt in Python Thread Programming

2011-05-11 Thread Gabriel Genellina
En Wed, 11 May 2011 03:57:13 -0300, vijay swaminathan escribió: Hi All, I'm new bie to thread programming and I need some assistance in understanding few concepts ... I have a very simple program which runs a thread and prints a string. import threading class MyThread(threading.Thread):

Re: NewBie Doubt in Python Thread Programming

2011-05-11 Thread Chris Angelico
On Wed, May 11, 2011 at 4:57 PM, vijay swaminathan wrote: >     for i in range(10): >     MyThread_Object.start() >     count = threading.activeCount() > > When I run this, I could see 10 thread being called. But when I print the > active thread count it is only 2. > > Need some understanding

NewBie Doubt in Python Thread Programming

2011-05-11 Thread vijay swaminathan
Hi All, I'm new bie to thread programming and I need some assistance in understanding few concepts ... I have a very simple program which runs a thread and prints a string. import threading class MyThread(threading.Thread): def __init__(self, parent = None): threading.Thread.__init_

<    1   2