Re: Why use "locals()"

2009-09-13 Thread Chris Colbert
Given that python is devoid of types: "Is the variable 'a' an int or a float at runtime?", explicit can only be taken so far. Personally, I use locals() when I work with Django. On Mon, Sep 14, 2009 at 7:42 AM, Sean DiZazzo wrote: >> If you are willing to open your mind to the possibility that

Re: yet another modifying locals() question

2009-09-13 Thread Ed Anuff
On Sep 13, 8:15 pm, Steven D'Aprano wrote: > Metaclasses are left as an exercise for the reader. The parent class has a metaclass, which is why I was trying this approach instead, since it let me get at the class attributes before the metaclass did. Overriding the metaclass looked to be a much m

Re: Accessing objects at runtime.

2009-09-13 Thread Chris Colbert
why not just pawn your processing loop off onto a child thread and give yourself a hook (function) that you can call that return whatver info you what. Run the script in ipython, problem solved. On Mon, Sep 14, 2009 at 7:57 AM, jacopo wrote: > >>    You might consider running a BaseHTTPServer in

Re: Accessing objects at runtime.

2009-09-13 Thread jacopo
>    You might consider running a BaseHTTPServer in a separate thread > which has references to your objects of interest and exporting the > data through a web interface. Using a RESTful approach for mapping > URLs to objects within your system, a basic export of the data can > be as simple as pri

Re: Why use "locals()"

2009-09-13 Thread Sean DiZazzo
> If you are willing to open your mind to the possibility that some > Pythonic things don't adhere to every Zen, then I would suggest that > Gabrielle's examples are perfectly Pythonic shortcuts.  But if you > don't want to use them, you don't have to, nobody is forcing you. It's a pretty small do

Re: Why use "locals()"

2009-09-13 Thread Carl Banks
On Sep 13, 10:15 pm, Carl Banks wrote: > Gabrielle's Whoops, very sorry about that typo, just how it rolled of the fingers. Ugh. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Commutative object in emulating numbers

2009-09-13 Thread Steven D'Aprano
On Sun, 13 Sep 2009 21:52:26 -0700, iu2 wrote: > Hi, > > I reached the chapter "Emulating numeric types" in the python > documentation and I tried this: [...] > What do I need to do in order to make the two classes, int and A, > commutative? Try adding a __rmul__ method: class A: def __mu

Re: Commutative object in emulating numbers

2009-09-13 Thread iu2
On Sep 14, 8:16 am, Chris Rebert wrote: > On Sun, Sep 13, 2009 at 9:52 PM, iu2 wrote: > > Hi, > > > I reached the chapter "Emulating numeric types" in the python > > documentation and I tried this: > > class A: > >        def __mul__(self, a): > >                return 'A' * a > > > Now, thi

Re: Why use "locals()"

2009-09-13 Thread Carl Banks
On Sep 13, 9:54 pm, Sean DiZazzo wrote: > > > I have never used a call to "locals()" in my code.  Can you show me a > > > use case where it is valuable and Pythonic? > > > def print_item(item): > >      description = textwrap.fill(item.description, 40) > >      short = item.description.split('\n',

Re: Commutative object in emulating numbers

2009-09-13 Thread Chris Rebert
On Sun, Sep 13, 2009 at 9:52 PM, iu2 wrote: > Hi, > > I reached the chapter "Emulating numeric types" in the python > documentation and I tried this: > class A: >        def __mul__(self, a): >                return 'A' * a > > Now, this works as expected: a = A() a * 3 > 'AAA' > >

Re: Why use "locals()"

2009-09-13 Thread Sean DiZazzo
On Sep 13, 9:11 pm, Steven D'Aprano wrote: > On Sun, 13 Sep 2009 20:26:06 -0700, Sean DiZazzo wrote: > > On Sep 13, 8:18 pm, Steven D'Aprano > > wrote: > >> On Sun, 13 Sep 2009 20:06:51 -0700, Sean DiZazzo wrote: > >> > I have never used a call to "locals()" in my code.  Can you show me a > >> >

Re: Commutative object in emulating numbers

2009-09-13 Thread iu2
On Sep 14, 7:52 am, iu2 wrote: > Hi, > > I reached the chapter "Emulating numeric types" in the python > documentation and I tried this: > > >>> class A: > >         def __mul__(self, a): >                 return 'A' * a > > Now, this works as expected:>>> a = A() > >>> a * 3 > > 'AAA' > > But thi

Re: Why use "locals()"

2009-09-13 Thread Sean DiZazzo
> > I have never used a call to "locals()" in my code.  Can you show me a > > use case where it is valuable and Pythonic? > > def print_item(item): >      description = textwrap.fill(item.description, 40) >      short = item.description.split('\n', 1)[0] >      code = str(item.id).zfill(6) >      p

Commutative object in emulating numbers

2009-09-13 Thread iu2
Hi, I reached the chapter "Emulating numeric types" in the python documentation and I tried this: >>> class A: def __mul__(self, a): return 'A' * a Now, this works as expected: >>> a = A() >>> a * 3 'AAA' But this doesn't (also as expected): >>> 3 * a Traceback (most re

Re: Why indentation is use to denote block of code?

2009-09-13 Thread TerryP
On Sep 13, 10:12 pm, Peng Yu wrote: > Hi, > > I want to understand why python use indentation to denote block of > code. What are the advantages of it? Is there a style in python to > denote a block of code the same as that of C++ (with '{}')? > > One disadvantage of using indentation to denote a

Re: Why use "locals()"

2009-09-13 Thread Gabriel Genellina
En Mon, 14 Sep 2009 00:06:51 -0300, Sean DiZazzo escribió: I have never used a call to "locals()" in my code. Can you show me a use case where it is valuable and Pythonic? def print_item(item): description = textwrap.fill(item.description, 40) short = item.description.split('\n', 1

Re: Why use "locals()"

2009-09-13 Thread Steven D'Aprano
On Sun, 13 Sep 2009 20:26:06 -0700, Sean DiZazzo wrote: > On Sep 13, 8:18 pm, Steven D'Aprano > wrote: >> On Sun, 13 Sep 2009 20:06:51 -0700, Sean DiZazzo wrote: >> > I have never used a call to "locals()" in my code.  Can you show me a >> > use case where it is valuable and Pythonic? >> >> grep

python audio streams?

2009-09-13 Thread konung.nik...@googlemail.com
Hello! Is there a way to record different audio streams (.asx, .ram, m3u) with Python? Also, is there a way to convert them "on the fly" ? Thank, you -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Text Processing

2009-09-13 Thread Tim Roberts
Steven D'Aprano wrote: >On Fri, 11 Sep 2009 21:52:36 -0700, Tim Roberts wrote: > >> Basically, when you're good with Perl, you start to think of every task >> in terms of regular expression matches. When you're good with Python, >> you start to think of every task in terms of lists and tuples. >

Re: Why use "locals()"

2009-09-13 Thread Sean DiZazzo
On Sep 13, 8:18 pm, Steven D'Aprano wrote: > On Sun, 13 Sep 2009 20:06:51 -0700, Sean DiZazzo wrote: > > I have never used a call to "locals()" in my code.  Can you show me a > > use case where it is valuable and Pythonic? > > grep is your friend: > > $ grep "locals()" /usr/lib/python2.5/*.py > /u

Re: Why use "locals()"

2009-09-13 Thread Steven D'Aprano
On Sun, 13 Sep 2009 20:06:51 -0700, Sean DiZazzo wrote: > I have never used a call to "locals()" in my code. Can you show me a > use case where it is valuable and Pythonic? grep is your friend: $ grep "locals()" /usr/lib/python2.5/*.py /usr/lib/python2.5/decimal.py:for name, val in lo

Re: yet another modifying locals() question

2009-09-13 Thread Steven D'Aprano
On Sun, 13 Sep 2009 18:52:47 -0700, Ed Anuff wrote: > I know that locals() is not supposed to be modifiable under most > circumstances, but I'm trying to solve a situation where I'm dynamically > generating some class attributes and it seemed to be the best way, so I > tried something out that see

Why use "locals()"

2009-09-13 Thread Sean DiZazzo
I have never used a call to "locals()" in my code. Can you show me a use case where it is valuable and Pythonic? ~Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with the inclusion of new files like lxml, django, numpy, etc.

2009-09-13 Thread alex23
joy99 wrote: > What is the problem I am doing? Following the wrong installation instructions? The ones you _should_ be following state: 1. Download the latest release from our download page. 2. Untar the downloaded file (e.g. tar xzvf Django-NNN.tar.gz, where NNN is the version number of the la

Re: NameError: name '__main__' is not defined

2009-09-13 Thread Sean DiZazzo
On Sep 13, 6:43 pm, Peng Yu wrote: > Hi, > > I try the following code. I don't quite understand why __main__ is not > defined. Could somebody let me know what I am wrong about it? > > Regards, > Peng > > $ cat test.py > #!/usr/bin/env python > > if __main__ == '__main__' : >   print "Hello World!\

Re: NameError: name '__main__' is not defined

2009-09-13 Thread Sean DiZazzo
On Sep 13, 6:43 pm, Peng Yu wrote: > Hi, > > I try the following code. I don't quite understand why __main__ is not > defined. Could somebody let me know what I am wrong about it? > > Regards, > Peng > > $ cat test.py > #!/usr/bin/env python > > if __main__ == '__main__' : >   print "Hello World!\

Re: NameError: name '__main__' is not defined

2009-09-13 Thread André
On Sep 13, 10:43 pm, Peng Yu wrote: > Hi, > > I try the following code. I don't quite understand why __main__ is not > defined. Could somebody let me know what I am wrong about it? > > Regards, > Peng > > $ cat test.py > #!/usr/bin/env python > > if __main__ == '__main__' : >   print "Hello World!

Re: NameError: name '__main__' is not defined

2009-09-13 Thread Xavier Ho
Try if __name__ == '__main__' :], Xav On Mon, Sep 14, 2009 at 11:43 AM, Peng Yu wrote: > Hi, > > I try the following code. I don't quite understand why __main__ is not > defined. Could somebody let me know what I am wrong about it? > > Regards, > Peng > > $ cat test.py > #!/usr/bin/env python

Re: Is there a similar mailing list about django?

2009-09-13 Thread Tim Chase
Thanks.. I saw the google group, but I was hoping for a list that I can read in my thunderbird client. Thanks all for the good pointers You can subscribe to the google group via email (which is what I did previously with TB), or you can subscribe to the mirrored copy of it over at gmane.comp

yet another modifying locals() question

2009-09-13 Thread Ed Anuff
I know that locals() is not supposed to be modifiable under most circumstances, but I'm trying to solve a situation where I'm dynamically generating some class attributes and it seemed to be the best way, so I tried something out that seems to work but I'm not sure that it's kosher: >>> def f(l):

NameError: name '__main__' is not defined

2009-09-13 Thread Peng Yu
Hi, I try the following code. I don't quite understand why __main__ is not defined. Could somebody let me know what I am wrong about it? Regards, Peng $ cat test.py #!/usr/bin/env python if __main__ == '__main__' : print "Hello World!\n" $ ./test.py Traceback (most recent call last): File "

trouble quitting PyQt4 App

2009-09-13 Thread Soumen banerjee
Hi, Im new to PyQt4 and im having fun using it. but ive run into a bit of a problem. I cant quit the application. The application has 2 modules. The gui module(gui.py) and then the main program(main.py) heres gui.py: from PyQt4 import QtCore, QtGui import sys from subprocess import Popen class Ui_

Re: run exe on different computer

2009-09-13 Thread Sean DiZazzo
On Sep 13, 4:57 pm, Dave Angel wrote: > daved170 wrote: > > On Sep 13, 2:17 pm, Dave Angel wrote: > > >> daved170 wrote: > > >>> Hi everybody, > >>> I'm building a small python program that run a service (exe file) on > >>> my servers. > >>> I don't want to use remote desktop and it's siblings. >

Re: Why indentation is use to denote block of code?

2009-09-13 Thread AggieDan04
On Sep 13, 6:27 pm, Steven D'Aprano wrote: > On Sun, 13 Sep 2009 15:15:40 -0700, Chris Rebert wrote: > > In fact it's pretty much impossible to automatically indent Python code > > that has had its indentation removed; it's impossible to know for sure > > where the dedents should occur. > > Just l

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread John Ladasky
On Sep 13, 4:17 pm, Carl Banks wrote: > On Sep 13, 3:18 pm, John Ladasky wrote: > > > In my leisure time, I would like to dig deeper into the issue of why > > object identities are not guaranteed for elements in numpy arrays... > > with elements of type "float", at least, I thought this would be

Re: run exe on different computer

2009-09-13 Thread Dave Angel
daved170 wrote: On Sep 13, 2:17 pm, Dave Angel wrote: daved170 wrote: Hi everybody, I'm building a small python program that run a service (exe file) on my servers. I don't want to use remote desktop and it's siblings. I would like to have some information on how to run an exe o

Re: How to define a function with an empty body?

2009-09-13 Thread Steven D'Aprano
On Sun, 13 Sep 2009 15:30:52 +0200, Christian Heimes wrote: > Peng Yu schrieb: >> Hi, >> >> I want to define a function without anything in it body. In C++, I can >> do something like the following because I can use "{}" to denote an >> empty function body. Since python use indentation, I am not

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread Steven D'Aprano
On Sun, 13 Sep 2009 17:58:14 -0500, Robert Kern wrote: > John Ladasky wrote: > >> In my leisure time, I would like to dig deeper into the issue of why >> object identities are not guaranteed for elements in numpy arrays... >> with elements of type "float", at least, I thought this would be >> tri

Re: Python strict mode?

2009-09-13 Thread Carl Banks
On Sep 13, 9:25 am, Peng Yu wrote: > Is there is a way to make python check the variables just as the > strict mode in perl. Would somebody let me know what is the python > equivalent to the perl strict mode? I don't recommend using it, but see this post: http://groups.google.com/group/comp.lan

Re: Is there a similar mailing list about django?

2009-09-13 Thread Albert Hopkins
On Sun, 2009-09-13 at 18:46 -0400, Joel Goldstick wrote: > Thanks.. I saw the google group, but I was hoping for a list that I > can > read in my thunderbird client. Thanks all for the good pointers And if you simply go to the Django web site and click on "Community" there is a form where you ca

Re: Is there a similar mailing list about django?

2009-09-13 Thread Andreas Waldenburger
On Mon, 14 Sep 2009 01:24:49 +0200 Andreas Waldenburger wrote: > (among a Usenet portal) Damn those late hours. What I meant was "amongst other things such as a Usenet portal". /W -- INVALID? DE! -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a similar mailing list about django?

2009-09-13 Thread Andreas Waldenburger
On Sun, 13 Sep 2009 18:46:44 -0400 Joel Goldstick wrote: > Thanks.. I saw the google group, but I was hoping for a list that I > can read in my thunderbird client. Thanks all for the good pointers Huh? Django-Users is a mailing list. That's what Google-Groups is (among a Usenet portal): A colle

Re: Why indentation is use to denote block of code?

2009-09-13 Thread Steven D'Aprano
On Sun, 13 Sep 2009 15:15:40 -0700, Chris Rebert wrote: > In fact it's pretty much impossible to automatically indent Python code > that has had its indentation removed; it's impossible to know for sure > where the dedents should occur. Just like most other syntactic elements -- if you remove al

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread Carl Banks
On Sep 13, 3:18 pm, John Ladasky wrote: > In my leisure time, I would like to dig deeper into the issue of why > object identities are not guaranteed for elements in numpy arrays... > with elements of type "float", at least, I thought this would be > trivial. Unlike Python lists, numpy arrays don

Re: Why indentation is use to denote block of code?

2009-09-13 Thread r
On Sep 13, 5:12 pm, Peng Yu wrote: > Hi, > > I want to understand why python use indentation to denote block of > code. What are the advantages of it? Is there a style in python to > denote a block of code the same as that of C++ (with '{}')? Easy! because Python is simplistic programming bliss!

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread Robert Kern
John Ladasky wrote: In my leisure time, I would like to dig deeper into the issue of why object identities are not guaranteed for elements in numpy arrays... with elements of type "float", at least, I thought this would be trivial. Why do you think that? We would have to keep a reference aroun

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread Christian Heimes
John Ladasky wrote: > OK, so there's a dedicated function in numpy to handle this. Thanks! > > I tried "x is NaN" after noting the obvious, that any equality or > inequality test involving NaN will return False. > > In my leisure time, I would like to dig deeper into the issue of why > object id

Re: Why indentation is use to denote block of code?

2009-09-13 Thread Grant Edwards
On 2009-09-13, Peng Yu wrote: > One disadvantage of using indentation to denote a block of code is > that the runtime to automatically indent a python code would be about > a few times more than the runtime to automatically indent a C++ code > of the same length (both are in vim). Talking about

Re: Odd/Weird errors with FTPLib

2009-09-13 Thread MRAB
Bakes wrote: On 13 Sep, 22:41, Chris Rebert wrote: On Sun, Sep 13, 2009 at 2:34 PM, Bakes wrote: I am using a simple python script to download my logfiles. This is on a while loop, the logfile grows rapidly, so it is necessary for python to start downloading the new script as soon as it has f

Re: Is there a similar mailing list about django?

2009-09-13 Thread Joel Goldstick
Andreas Waldenburger wrote: On Sun, 13 Sep 2009 15:54:07 -0400 Albert Hopkins wrote: On Sun, 2009-09-13 at 21:27 +0200, Andreas Waldenburger wrote: Didn't like http://groups-beta.google.com/group/django-users ? (Second hit for "django mailing list", but I know Google results vary from countr

Re: Why indentation is use to denote block of code?

2009-09-13 Thread Sean DiZazzo
On Sep 13, 3:12 pm, Peng Yu wrote: > Hi, > > I want to understand why python use indentation to denote block of > code. What are the advantages of it? Is there a style in python to > denote a block of code the same as that of C++ (with '{}')? > > One disadvantage of using indentation to denote a b

Re: Which version of python I should use if I just start programming in python?

2009-09-13 Thread Andreas Waldenburger
On Sun, 13 Sep 2009 17:04:25 -0500 Peng Yu wrote: > On Sun, Sep 13, 2009 at 4:01 PM, Andreas Waldenburger > wrote: > > On Sun, 13 Sep 2009 15:52:44 -0500 Peng Yu > > wrote: > > > >> On Sun, Sep 13, 2009 at 12:27 AM, John Nagle > >> wrote: > >> What are the differences between 2.5 and 2.6? > >

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread John Ladasky
Hi Robert, Thanks for the quick reply. On Sep 13, 1:22 pm, Robert Kern wrote: > The problem is that you are trying to use "is" to compare by Python object > identity. Except for dtype=object arrays, the object identities of the > individual elements that you extract from numpy arrays are never

Re: Why indentation is use to denote block of code?

2009-09-13 Thread Sean DiZazzo
On Sep 13, 3:12 pm, Peng Yu wrote: > Hi, > > I want to understand why python use indentation to denote block of > code. What are the advantages of it? Is there a style in python to > denote a block of code the same as that of C++ (with '{}')? > > One disadvantage of using indentation to denote a b

Re: Why indentation is use to denote block of code?

2009-09-13 Thread Chris Rebert
On Sun, Sep 13, 2009 at 3:12 PM, Peng Yu wrote: > Hi, > > I want to understand why python use indentation to denote block of > code. What are the advantages of it? See the FAQ: http://www.python.org/doc/faq/general/#why-does-python-use-indentation-for-grouping-of-statements > Is there a style in

Why indentation is use to denote block of code?

2009-09-13 Thread Peng Yu
Hi, I want to understand why python use indentation to denote block of code. What are the advantages of it? Is there a style in python to denote a block of code the same as that of C++ (with '{}')? One disadvantage of using indentation to denote a block of code is that the runtime to automaticall

Re: Python and 3d

2009-09-13 Thread Carl Banks
On Sep 13, 9:29 am, "Mike C. Fletcher" wrote: > azrael wrote: > > Has anyone any exipience with python and 3d. > > > I mean, is there a module to deal with popular 3d formats like 3ds, or > > vrml. is it possible to import into python opengl models and then use > > it in application for GUI purpos

Re: Which version of python I should use if I just start programming in python?

2009-09-13 Thread Peng Yu
On Sun, Sep 13, 2009 at 4:01 PM, Andreas Waldenburger wrote: > On Sun, 13 Sep 2009 15:52:44 -0500 Peng Yu wrote: > >> On Sun, Sep 13, 2009 at 12:27 AM, John Nagle >> wrote: >> What are the differences between 2.5 and 2.6? > > http://docs.python.org/dev/whatsnew/2.6.html Are all packages availab

Re: Odd/Weird errors with FTPLib

2009-09-13 Thread Bakes
On 13 Sep, 22:41, Chris Rebert wrote: > On Sun, Sep 13, 2009 at 2:34 PM, Bakes wrote: > > I am using a simple python script to download my logfiles. This is on > > a while loop, the logfile grows rapidly, so it is necessary for python > > to start downloading the new script as soon as it has fini

Re: Odd/Weird errors with FTPLib

2009-09-13 Thread Chris Rebert
On Sun, Sep 13, 2009 at 2:34 PM, Bakes wrote: > I am using a simple python script to download my logfiles. This is on > a while loop, the logfile grows rapidly, so it is necessary for python > to start downloading the new script as soon as it has finished the > old. > > It works fine (for about 20

Odd/Weird errors with FTPLib

2009-09-13 Thread Bakes
I am using a simple python script to download my logfiles. This is on a while loop, the logfile grows rapidly, so it is necessary for python to start downloading the new script as soon as it has finished the old. It works fine (for about 20 minutes), then crashes. I have removed a couple of except

Re: Python strict mode?

2009-09-13 Thread Ben Finney
Peng Yu writes: > Is there is a way to make python check the variables just as the > strict mode in perl. Would somebody let me know what is the python > equivalent to the perl strict mode? There isn't one, because Python doesn't have the same concept of “unsafe constructs”; in Python, we think

ANN: Python FTP Server library (pyftpdlib) 0.5.2 released

2009-09-13 Thread Giampaolo Rodola'
Hi, I'm pleased to announce release 0.5.2 of Python FTP Server library (pyftpdlib). http://code.google.com/p/pyftpdlib === About === Python FTP server library provides a high-level portable interface to easily write asynchronous FTP servers with Python. pyftpdlib is currently the most complete RF

Re: Python strict mode?

2009-09-13 Thread Terry Reedy
Peng Yu wrote: Hi, Is there is a way to make python check the variables just as the strict mode in perl. Would somebody let me know what is the python equivalent to the perl strict mode? 3rd party code checkers like pylint, pychecker. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a similar mailing list about django?

2009-09-13 Thread Andreas Waldenburger
On Sun, 13 Sep 2009 15:54:07 -0400 Albert Hopkins wrote: > On Sun, 2009-09-13 at 21:27 +0200, Andreas Waldenburger wrote: > > Didn't like http://groups-beta.google.com/group/django-users ? > > > > (Second hit for "django mailing list", but I know Google results > > vary from country to country,

Re: Which version of python I should use if I just start programming in python?

2009-09-13 Thread Andreas Waldenburger
On Sun, 13 Sep 2009 15:52:44 -0500 Peng Yu wrote: > On Sun, Sep 13, 2009 at 12:27 AM, John Nagle > wrote: > What are the differences between 2.5 and 2.6? http://docs.python.org/dev/whatsnew/2.6.html /W -- INVALID? DE! -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a similar mailing list about django?

2009-09-13 Thread Tim Chase
Joel Goldstick wrote: I'm learning python and django more or less concurrently. I've googled to find a similar list like this for django. Help? There's a Django Users mailing list over on Google Groups. http://groups.google.com/group/django-users You want Django *Users* for folks that use

Re: Which version of python I should use if I just start programming in python?

2009-09-13 Thread Peng Yu
On Sun, Sep 13, 2009 at 12:27 AM, John Nagle wrote: > Kee Nethery wrote: >> >> I am in 2.x because the IDE I am using does not support stepping through >> my code when in 3.x. As soon as the IDE I use supports debugging in 3.x, I'm >> moving up to 3.x. >> >> I would prefer to be in 3.x because all

Re: IRC bot

2009-09-13 Thread Someone Something
Thanks a lot! On Sun, Sep 13, 2009 at 4:29 PM, MRAB wrote: > Someone Something wrote: > >> I"m trying to write an IRC bot just for fun (in python of course). Here's >> my current code: >> >> 1 #!/usr/local/bin/python >> 2 import time >> 3 import socket >> 4 >> 5 def message (x, channel,s):

Re: IRC bot

2009-09-13 Thread MRAB
Someone Something wrote: I"m trying to write an IRC bot just for fun (in python of course). Here's my current code: 1 #!/usr/local/bin/python 2 import time 3 import socket 4 5 def message (x, channel,s): 6 y="PRIVMSG"+" "+ channel+" :"+x 7 s.send(y); 8 host="irc.freenode

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread Robert Kern
John Ladasky wrote: Hi folks, I am aware that numpy has its own discussion group, which is hosted at gmane. Unfortunately, I can't seem to get in to gmane today. It is not hosted at GMane. It just has a GMane mirror. http://www.scipy.org/Mailing_Lists In any case, I'm not sure whether I

Re: IRC bot

2009-09-13 Thread Someone Something
Anyone? On Sun, Sep 13, 2009 at 3:58 PM, Someone Something wrote: > I"m trying to write an IRC bot just for fun (in python of course). Here's > my current code: > > 1 #!/usr/local/bin/python > 2 import time > 3 import socket > 4 > 5 def message (x, channel,s): > 6 y="PRIVMSG"+" "+

numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread John Ladasky
Hi folks, I am aware that numpy has its own discussion group, which is hosted at gmane. Unfortunately, I can't seem to get in to gmane today. In any case, I'm not sure whether I have a problem with numpy, or with my understanding of the Python pickle module, so I'm posting here. I am pickling n

Re: Python strict mode?

2009-09-13 Thread Patrick Sabin
> You could write a class with a custom __setattr__() method that checks for valid attribute names for that class (a list of strings given to it's __init__() method). That way you could form several restricted "namespaces" for variables simply as different instances of that class. This can be

IRC bot

2009-09-13 Thread Someone Something
I"m trying to write an IRC bot just for fun (in python of course). Here's my current code: 1 #!/usr/local/bin/python 2 import time 3 import socket 4 5 def message (x, channel,s): 6 y="PRIVMSG"+" "+ channel+" :"+x 7 s.send(y); 8 host="irc.freenode.net"; 9 port=6667; 10 si

Re: Is there a similar mailing list about django?

2009-09-13 Thread Albert Hopkins
On Sun, 2009-09-13 at 21:27 +0200, Andreas Waldenburger wrote: > Didn't like http://groups-beta.google.com/group/django-users ? > > (Second hit for "django mailing list", but I know Google results vary > from country to country, so you might not have seen it.) Or, better yet, go to Django's web s

Re: Is there a similar mailing list about django?

2009-09-13 Thread Andreas Waldenburger
On Sun, 13 Sep 2009 14:17:42 -0400 Joel Goldstick wrote: > I'm learning python and django more or less concurrently. I've > googled to find a similar list like this for django. Help? > Didn't like http://groups-beta.google.com/group/django-users ? (Second hit for "django mailing list", but I

Re: Python strict mode?

2009-09-13 Thread Andreas Waldenburger
On Sun, 13 Sep 2009 09:25:50 -0700 (PDT) Peng Yu wrote: > Is there is a way to make python check the variables just as the > strict mode in perl. Short answer: No. Long answer: I'm guessing you want Python to complain when assigning to a variable that has not been declared before. Since Python h

Re: including constants

2009-09-13 Thread Andreas Waldenburger
On Sun, 13 Sep 2009 18:44:25 + (UTC) Nikola Skoric wrote: > Hi there, > > I have a simple problem and I know how to solve it :-D, but I suspect > that there is a standard solution which is more elegant. > > So, here is my problem: I have django app versioned with svn and I > test my trunk o

Python and 3d

2009-09-13 Thread Ryniek90
> > azrael wrote: > >> Has anyone any exipience with python and 3d. >> >> I mean, is there a module to deal with popular 3d formats like 3ds, or >> vrml. is it possible to import into python opengl models and then use >> it in application for GUI purposes like through WX. I know that WX >> supp

Re: QTableWidgetItem-list

2009-09-13 Thread Helvin
On Sep 14, 7:18 am, Helvin wrote: > Hi, > > Could not find anything on this online, except the documentation, > which does not explain how to work with a QTableWidgetItem-list. How > do I get out what QWidgetTable.finditems found? > > I have a string that I want to find in my table. I want to loca

QTableWidgetItem-list

2009-09-13 Thread Helvin
Hi, Could not find anything on this online, except the documentation, which does not explain how to work with a QTableWidgetItem-list. How do I get out what QWidgetTable.finditems found? I have a string that I want to find in my table. I want to locate the row it's in, then delete the row. My cod

including constants

2009-09-13 Thread Nikola Skoric
Hi there, I have a simple problem and I know how to solve it :-D, but I suspect that there is a standard solution which is more elegant. So, here is my problem: I have django app versioned with svn and I test my trunk on two different machines (one with mysql, another with sqlite3). How do I remo

Re: AttributeError: 'NoneType' object has no attribute 'get_text'

2009-09-13 Thread MRAB
Raji Seetharaman wrote: Hi all, i did a small gui addressbook application using pygtk, python, mysql db. It was successful. I tried the same application with glade. But i ended up with errors. I desgined the code as follows. 1.It has one main window and four child dialogs. 2.In the main window,

Is there a similar mailing list about django?

2009-09-13 Thread Joel Goldstick
I'm learning python and django more or less concurrently. I've googled to find a similar list like this for django. Help? Joel Goldstick -- http://mail.python.org/mailman/listinfo/python-list

Re: First release of pyfsevents

2009-09-13 Thread Aahz
In article <04180ce5-4cc0-43a4-b26a-b7a4fe826...@g23g2000yqh.googlegroups.com>, IngoognI wrote: >On Sep 8, 6:19=A0am, a...@pythoncraft.com (Aahz) wrote: >> >> There's no direct equivalent to Linux inotify [...] > >pnotify ? Thanks! I'll look into that. -- Aahz (a...@pythoncraft.com)

Re: Python and 3d

2009-09-13 Thread Ian Mallett
On Sun, Sep 13, 2009 at 9:29 AM, Mike C. Fletcher wrote: > There's a few older projects to load 3DS files, but I don't think any of > them is currently PyOpenGL 3.x compatible. I would be interested in making them 3.x compatible. Where are they? I've wanted .3ds support for a while... > OpenG

AttributeError: 'NoneType' object has no attribute 'get_text'

2009-09-13 Thread Raji Seetharaman
Hi all, i did a small gui addressbook application using pygtk, python, mysql db. It was successful. I tried the same application with glade. But i ended up with errors. I desgined the code as follows. 1.It has one main window and four child dialogs. 2.In the main window, i have to fill in the text

Re: compiling python 3

2009-09-13 Thread Christian Heimes
Rustom Mody wrote: > Just managed to compile python3 on debian lenny > I get (among other things) > > 7 skips unexpected on linux2: > test_dbm_ndbm test_bz2 test_ttk_guionly test_tcl test_tk > test_ttk_textonly test_dbm_gnu > Any ideas what dev packages I need to add? "apt-get build-dep p

Re: Python and 3d

2009-09-13 Thread Mike C. Fletcher
azrael wrote: > Has anyone any exipience with python and 3d. > > I mean, is there a module to deal with popular 3d formats like 3ds, or > vrml. is it possible to import into python opengl models and then use > it in application for GUI purposes like through WX. I know that WX > supports OpenGL but

Re: Python and 3d

2009-09-13 Thread TerryP
Importing models from a file, obviously always raises the question, what kind of model formats :-P. You should probably take a look at something like Python-Ogre or Pygame for a starting point. Doing raw OpenGL is a bit more tricky and even more dependent on format. -- http://mail.python.org/ma

Python strict mode?

2009-09-13 Thread Peng Yu
Hi, Is there is a way to make python check the variables just as the strict mode in perl. Would somebody let me know what is the python equivalent to the perl strict mode? Regards, Peng -- http://mail.python.org/mailman/listinfo/python-list

compiling python 3

2009-09-13 Thread Rustom Mody
Just managed to compile python3 on debian lenny I get (among other things) 7 skips unexpected on linux2: test_dbm_ndbm test_bz2 test_ttk_guionly test_tcl test_tk test_ttk_textonly test_dbm_gnu Any ideas what dev packages I need to add? Also emacs python-mode is not set for python3 it look

Re: How to define a function with an empty body?

2009-09-13 Thread David
Il Sat, 12 Sep 2009 22:37:01 -0500, Peng Yu ha scritto: > Hi, > > I want to define a function without anything in it body. [...] I usually define void functions as: def myfunction(): raise NotImplementedError("You forgot to implement me!") so I keep safe from leaving orphaned functio

Re: Array of objects lost in unpickling

2009-09-13 Thread Bahadir
On Sep 13, 5:48 pm, Jon Clements wrote: > On 13 Sep, 15:19, Bahadir wrote: > > > > > Hi, > > > I have a class: > > > class second: > >     a = None > >     b = None > > > class first: > >     array = [] > > > I populate the array in first class with instances of second, then > > save by: > > > sh

Re: Array of objects lost in unpickling

2009-09-13 Thread Christian Heimes
Bahadir wrote: > Also there are no errors printed out. > > Any idea why the array of instances are lost? > The pickle protocol doesn't pickle class attributes by default, only instance variables. You list called 'array' is a class variable -- it's bound to the class not your instance. By the wa

Re: Array of objects lost in unpickling

2009-09-13 Thread Jon Clements
On 13 Sep, 15:19, Bahadir wrote: > Hi, > > I have a class: > > class second: >     a = None >     b = None > > class first: >     array = [] > > I populate the array in first class with instances of second, then > save by: > > shelve = shelve.open(), > shelve["first"] = myfirst > shelve.close() >

Array of objects lost in unpickling

2009-09-13 Thread Bahadir
Hi, I have a class: class second: a = None b = None class first: array = [] I populate the array in first class with instances of second, then save by: shelve = shelve.open(), shelve["first"] = myfirst shelve.close() When I reopen the shelve from another script, the first class is

Re: How to define a function with an empty body?

2009-09-13 Thread Albert Hopkins
On Sat, 2009-09-12 at 22:37 -0500, Peng Yu wrote: > Hi, > > I want to define a function without anything in it body. In C++, I can > do something like the following because I can use "{}" to denote an > empty function body. Since python use indentation, I am not sure how > to do it. Can somebody l

Re: How to define a function with an empty body?

2009-09-13 Thread Christian Heimes
Peng Yu schrieb: > Hi, > > I want to define a function without anything in it body. In C++, I can > do something like the following because I can use "{}" to denote an > empty function body. Since python use indentation, I am not sure how > to do it. Can somebody let me know how to do it in python

  1   2   >