Re: Anything like "Effective Java" for Python?

2010-03-10 Thread Stefan Behnel
Chris Withers, 10.03.2010 17:46: kj wrote: Subject line pretty much says it all: is there a book like "Effective Java" oxymoronic, no? Sorry, couldn't resist ;-) Nothing to excuse for. I thought exactly the same thing. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: os.rename [Errno 31] Too many links

2010-03-10 Thread Richard
On Mar 11, 3:08 am, Thomas Guettler wrote: > Richard wrote: > > I want to atomically write to a file so have been using temporary > > files and renaming: > > > temp = tempfile.NamedTemporaryFile(delete=False) > > temp.file.write(data) > > temp.file.close() > > os.rename(temp.name, output_file) > >

Re: Can't install ssl for Python2.5

2010-03-10 Thread Lacrima
On Mar 10, 11:23 pm, "Martin v. Loewis" wrote: > > I don't know how to solve this problem and I am looking forward for > > help. > > Try running "python setup.py install" directly, after downloading and > unpacking the package. > > Regards, > Martin Thanks a lot! It helped! -- http://mail.python

use of multiple versions of python

2010-03-10 Thread Bujji
hi all, I have installed python 2.6 in addition to python 2.5 in my system Now for some modules(while installing ) it needs to use python 2.6 how can i do that in case of easy_install what should i do to it to use python 2.6 from my understanding /usr/bin/python is the one which will be taking car

Re: a newbie's question

2010-03-10 Thread Shashwat Anand
Python is one language which is quite easy to get grasp of. one week and you'll start doing productive stuff. Best of luck on your quest. On Thu, Mar 11, 2010 at 10:26 AM, Lan Qing wrote: > hi Cheers, > Think you, that helps me a lot. > > > On Tue, Mar 9, 2010 at 10:00 PM, Simon Brunning >

Re: a newbie's question

2010-03-10 Thread Lan Qing
hi Cheers, Think you, that helps me a lot. On Tue, Mar 9, 2010 at 10:00 PM, Simon Brunning wrote: > On 9 March 2010 13:51, Lan Qing wrote: > > Hi all, > > I'm a newbie of python programming language. > > Welcome! > > > I have used c/c++ for 5 > > years, and one year experience in Lua

Get a method instance through 'getattr' but not superclass's method

2010-03-10 Thread Radhakrishna Bhat
I am using getattr to get a method instance from a class. But it also returns methods from the superclass. How to detect if an attribute is from superclass? -Radhakrishna -- http://mail.python.org/mailman/listinfo/python-list

Re: Knight's tour Warndorff's algorithm problem

2010-03-10 Thread Terry Reedy
On 3/10/2010 4:49 PM, Lawrence D'Oliveiro wrote: In message, Gabriel Genellina wrote: Warnsdorff's algorithm is heuristic ... Then it shouldn’t be called an “algorithm”. Heuristic algorithms correctly compute some function, just not the one you want ;-). -- http://mail.python.org/mailma

Re: Can't define __call__ within __init__?

2010-03-10 Thread Steven D'Aprano
On Wed, 10 Mar 2010 08:12:14 -0500, Neal Becker wrote: > Want to switch __call__ behavior. Why doesn't this work? What is the > correct way to write this? > > class X (object): > def __init__(self, i): > if i == 0: > def __call__ (self): > return 0 >

Re: Ideas for creating processes

2010-03-10 Thread J
On Wed, Mar 10, 2010 at 18:03, MRAB wrote: > Are you sure that you would gain from doing more than one at a time? > > The bottleneck will probably be the speed of your network connection, > and if that's working at its maximum speed with one sync then doing > several concurrently won't save any ti

Re: Python Script to get Info from Site not working

2010-03-10 Thread Jimbo
On Mar 11, 12:38 pm, "Gabriel Genellina" wrote: > En Wed, 10 Mar 2010 20:06:41 -0300, Jimbo escribió: > > > I found a semi Python & internet tutorial here if anyone else would > > like ithttp://www.upriss.org.uk/python/session6.html > > > My script is meant to find which radio button is selected

Re: Interacting With Another Script

2010-03-10 Thread alex23
Victor Subervi wrote: > > There's a program (vpopmail) that has commands which, when called, request > > input ("email address", "password", etc.) from the command line. I would > > like to build a TTW interface for my clients to use that interacts with > > these commands. The Pexpect[1] module i

Re: Python Script to get Info from Site not working

2010-03-10 Thread Gabriel Genellina
En Wed, 10 Mar 2010 20:06:41 -0300, Jimbo escribió: I found a semi Python & internet tutorial here if anyone else would like it http://www.upriss.org.uk/python/session6.html My script is meant to find which radio button is selected & tell me that. But it just keeps saying "No Drink Selected!"

Re: Interacting With Another Script

2010-03-10 Thread Gabriel Genellina
En Wed, 10 Mar 2010 09:32:15 -0300, Victor Subervi escribió: There's a program (vpopmail) that has commands which, when called, request input ("email address", "password", etc.) from the command line. I would like to build a TTW interface for my clients to use that interacts with these comman

Re: Method / Functions - What are the differences?

2010-03-10 Thread Gabriel Genellina
En Wed, 10 Mar 2010 11:45:38 -0300, John Posner escribió: As I promised/threatened, here's the *start* of a write-up on properties, aimed at non-advanced Python programmers: http://www.jjposner.net/media/python-properties-0310.pdf I'd use 'function' instead of 'procedure', as this last

Re: Importing Modules

2010-03-10 Thread Gabriel Genellina
En Wed, 10 Mar 2010 09:19:29 -0300, PEYMAN ASKARI escribió: I wanted to know if imported classes are treated differently than internal classes. If by 'internal classes' you mean 'classes defined in the main module', no, they're absolutely the same. class A(): __init__(self): pass and c

Re: Does this already exists?: A module that checks if the used platform is supported

2010-03-10 Thread Gabriel Genellina
En Wed, 10 Mar 2010 10:54:27 -0300, Martin P. Hellwig escribió: Before I start reinventing a squared wheel, I have the following question: Is there already a (standard) module that wraps around the various os/sys information which checks if the platform + version is supported for what I wa

Re: Can't install PIL on MacOS X Leopard

2010-03-10 Thread phantasm
Thank you for your reply, Ned, but I just tried to install it again and found out that I didn't finally run "python setup.py install" after building PIL manually. It solved the problem. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't install PIL on MacOS X Leopard

2010-03-10 Thread Ned Deily
In article <94070db2-91f0-47a8-a259-36378aab9...@o3g2000yqb.googlegroups.com>, phantasm wrote: > I'm trying to install PIL module on MacOS X Leopard with python 2.6. > Everything seemed to be fine - now I have PIL egg package in "site- > packages" directory, but when I'm trying "import PIL", I g

Python 2.6 and modules dbi AND odbc

2010-03-10 Thread robert somerville
hi; i am trying to get some legacy python code (which i no nothing about) working with tries to import dbi and odbc (the import fails ...) it looks like these modules are deprecated ?? if so is there a work around , if not deprecated, what am i doing wrong ?? i see no Ubuntu packages that look pro

Can't install PIL on MacOS X Leopard

2010-03-10 Thread phantasm
Hello! I'm trying to install PIL module on MacOS X Leopard with python 2.6. Everything seemed to be fine - now I have PIL egg package in "site- packages" directory, but when I'm trying "import PIL", I get an error "ImportError: No module named PIL". All other modules such as SQL Alchemy work fine

Re: Elementtree install problem in Ubuntu (a newbie ..)

2010-03-10 Thread Philip Semanchuk
On Mar 10, 2010, at 6:48 PM, robert somerville wrote: Hi ; I installed the elementtree and celementree packages throught the synaptic package manager, all seems to go fine through the install ... when i startup python and try to import them (as per the EFFBOTT.org suggestions) .. PROBLEMS .

Elementtree install problem in Ubuntu (a newbie ..)

2010-03-10 Thread robert somerville
Hi ; I installed the elementtree and celementree packages throught the synaptic package manager, all seems to go fine through the install ... when i startup python and try to import them (as per the EFFBOTT.org suggestions) .. PROBLEMS ... (see below ..) What am i doing wrong ??? this is a new win

Re: Can't define __call__ within __init__?

2010-03-10 Thread Neal Becker
Robert Kern wrote: > On 2010-03-10 12:23 PM, Neal Becker wrote: >> Duncan Booth wrote: >> ... >>> >>> P.S. I don't know what you did in your post but your Followup-To header >>> is pointing to a group on gmane which makes extra work for me replying. >>> Please don't do that. >> >> I'm sorry about

Re: file seek is slow

2010-03-10 Thread sjdevn...@yahoo.com
On Mar 10, 6:01 pm, Neil Hodgson wrote: > Metalone: > > > As it turns out each call is only > > 646 nanoseconds slower than 'C'. > > However, that is still 80% of the time to perform a file seek, > > which I would think is a relatively slow operation compared to just > > making a system call. > >

Re: Import problem

2010-03-10 Thread News123
Hi JM, Jean-Michel Pichavant wrote: > News123 wrote: >> Jean-Michel Pichavant wrote: >> >>> Johny wrote: >>> I have this directory structure C: \A __init__.py amodule.py \B __init__.py bmod

Re: Import problem

2010-03-10 Thread News123
Hi JM, Jean-Michel Pichavant wrote: > News123 wrote: >> Jean-Michel Pichavant wrote: >> >>> Johny wrote: >>> I have this directory structure C: \A __init__.py amodule.py \B __init__.py bmod

Python Script to get Info from Site not working

2010-03-10 Thread Jimbo
Hello I am asking what is probably a very easy thing to do but I cannot find a tutorial on how to do it anywhere. [b]I want to use a Python script to get information from a webpage. [/b] I found a semi Python & internet tutorial here if anyone else would like it http://www.upriss.org.uk/python/se

Re: file seek is slow

2010-03-10 Thread Neil Hodgson
Metalone: > As it turns out each call is only > 646 nanoseconds slower than 'C'. > However, that is still 80% of the time to perform a file seek, > which I would think is a relatively slow operation compared to just > making a system call. A seek may not be doing much beyond setting a current

Re: Ideas for creating processes

2010-03-10 Thread MRAB
J wrote: I'm working on a project and thought I'd ask for a suggestion on how to proceed (I've got my own ideas, but I wanted to see if I was on the right track) For now, I've got this: def main(): ## get our list of directories to refresh releases=sys.argv[1:] if len(releases) < 1:

Re: Ideas for creating processes

2010-03-10 Thread Martin P. Hellwig
On 03/10/10 21:52, J wrote: I'm working on a project and thought I'd ask for a suggestion on how to proceed (I've got my own ideas, but I wanted to see if I was on the right track) Well I can't speak with authority but I would go into similar lines, especially since you want to call an externa

Re: Named loops for breaking

2010-03-10 Thread Alf P. Steinbach
* James Harris: On 10 Mar, 06:29, "Gabriel Genellina" wrote: En Tue, 09 Mar 2010 18:41:10 -0300, Daniel Klein escribi : Basically I'm wondering if there are any plans to implemented named loops in Python, so I can tell a break command to break out of a specific loop in the case of nested l

Re: NoSQL Movement?

2010-03-10 Thread Xah Lee
On Mar 10, 9:26 am, Duncan Booth wrote: > No, I'm saying that if you plan to build a business that could grow you > should be clear up front how you plan to handle the growth. It's too late > if you suddenly discover your platform isn't scalable just when you need to > scale it. Right, but that d

Re: Passing FILE * types using ctypes

2010-03-10 Thread Robert Kern
On 2010-03-10 15:57 PM, Lawrence D'Oliveiro wrote: In message<7vbrvefeg...@mid.individual.net>, Gregory Ewing wrote: If you need the same FILE * that Python is using, you may need to use ctypes to extract it out of the file object. Why would Python be using a FILE *? In Python 2.x, Python's

Re: Knight's tour Warndorff's algorithm problem

2010-03-10 Thread Grant Edwards
On 2010-03-10, Lawrence D'Oliveiro wrote: > In message , Gabriel > Genellina wrote: > >> Warnsdorff's algorithm is heuristic ... > > Then it shouldn???t be called an ???algorithm???. Why? An algorithm is just a well-defined series of steps. Just because it uses heuristics doesn't mean it's not

Re: Knight's tour Warndorff's algorithm problem

2010-03-10 Thread Robert Kern
On 2010-03-10 15:49 PM, Lawrence D'Oliveiro wrote: In message, Gabriel Genellina wrote: Warnsdorff's algorithm is heuristic ... Then it shouldn’t be called an “algorithm”. There are lots of algorithms that use heuristics or are heuristics. The two are orthogonal concepts. -- Robert Kern

Re: Ideas for creating processes

2010-03-10 Thread J
On Wed, Mar 10, 2010 at 16:52, J wrote: > the quick and dirty would be (as I'm imagining it at the moment): > for path in pathlist: >    chdir into path >    execute rsync or zsync > > but that gets me moving into one dir, updating, then moving into another. > > What I was wondering about though,

show image in python

2010-03-10 Thread mohamed issolah
Hey, This is my program 1 #!/usr/bin/python 2 import PIL 3 import numpy 4 import Image 5 import ImageOps 6 import sys 7 8 def Matimg(path): 9 """transforme image en matrice""" 10 Img = Image.open(str(path)) 11 Img1 = ImageOps.grayscale(Img) 12 la

Re: Passing FILE * types using ctypes

2010-03-10 Thread Lawrence D'Oliveiro
In message , Zeeshan Quireshi wrote: > Hello, I'm using ctypes to wrap a library i wrote. I am trying to pass > it a FILE *pointer ... Another option is to fix your library not to use stdio directly. -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing FILE * types using ctypes

2010-03-10 Thread Lawrence D'Oliveiro
In message <7vbrvefeg...@mid.individual.net>, Gregory Ewing wrote: > If you need the same FILE * that Python is using, you > may need to use ctypes to extract it out of the file > object. Why would Python be using a FILE *? -- http://mail.python.org/mailman/listinfo/python-list

Re: Draft PEP on RSON configuration file format

2010-03-10 Thread Lawrence D'Oliveiro
In message <4b8b5cef$0$1625$742ec...@news.sonic.net>, John Nagle wrote: > Patrick Maupin wrote: >> >> Finding .ini configuration files too limiting, JSON and XML to hard to >> manually edit, and YAML too complex to parse quickly, I have started >> work on a new configuration file parser. > >

Re: Named loops for breaking

2010-03-10 Thread James Harris
On 10 Mar, 06:29, "Gabriel Genellina" wrote: > En Tue, 09 Mar 2010 18:41:10 -0300, Daniel Klein   > escribi : > > > Basically I'm wondering if there are any plans to implemented named > > loops in Python, so I can tell a break command to break out of a > > specific loop in the case of nested loop

Ideas for creating processes

2010-03-10 Thread J
I'm working on a project and thought I'd ask for a suggestion on how to proceed (I've got my own ideas, but I wanted to see if I was on the right track) For now, I've got this: def main(): ## get our list of directories to refresh releases=sys.argv[1:] if len(releases) < 1: print

Re: Knight's tour Warndorff's algorithm problem

2010-03-10 Thread Lawrence D'Oliveiro
In message , Gabriel Genellina wrote: > Warnsdorff's algorithm is heuristic ... Then it shouldn’t be called an “algorithm”. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't install ssl for Python2.5

2010-03-10 Thread Martin v. Loewis
> I don't know how to solve this problem and I am looking forward for > help. Try running "python setup.py install" directly, after downloading and unpacking the package. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

logging: local functions ==> loss of lineno

2010-03-10 Thread Hellmut Weber
Hi Vinay Sajip, I'm very glad discoverd your logging module ;-) (That's what I would have liked 25 years ago when I was working as a technical software developper!) Now I'm writing just some personal tools, I like python and want to use logging on a regular basis. Logging works very well giv

Can't install ssl for Python2.5

2010-03-10 Thread Lacrima
Hello! I use Ubuntu 9.10 Karmic Koala. It has Python 2.6 as default installation. And I installed Python 2.5 alongside (for the need of Google AppEngine). But it seems like my Python 2.5 installation lacks ssl support. I can't import ssl and starting appengine server fails with "'module' object ha

Re: Can't define __call__ within __init__?

2010-03-10 Thread Robert Kern
On 2010-03-10 12:23 PM, Neal Becker wrote: Duncan Booth wrote: ... P.S. I don't know what you did in your post but your Followup-To header is pointing to a group on gmane which makes extra work for me replying. Please don't do that. I'm sorry about that, there is some bad interaction between

Re: Can't define __call__ within __init__?

2010-03-10 Thread Robert Kern
On 2010-03-10 13:42 PM, Neal Becker wrote: Duncan Booth wrote: Neal Becker wrote: Duncan Booth wrote: ... P.S. I don't know what you did in your post but your Followup-To header is pointing to a group on gmane which makes extra work for me replying. Please don't do that. I'm sorry about

Re: file seek is slow

2010-03-10 Thread Metalone
Thanks, Tim. Good to know. -- http://mail.python.org/mailman/listinfo/python-list

Re: file seek is slow

2010-03-10 Thread Metalone
f1_seek = f1.seek did not change the performance at all. As it turns out each call is only 646 nanoseconds slower than 'C'. However, that is still 80% of the time to perform a file seek, which I would think is a relatively slow operation compared to just making a system call. -- http://mail.python

Re: Can't define __call__ within __init__?

2010-03-10 Thread Neal Becker
Duncan Booth wrote: > Neal Becker wrote: > >> Duncan Booth wrote: >> ... >>> >>> P.S. I don't know what you did in your post but your Followup-To >>> header is pointing to a group on gmane which makes extra work for me >>> replying. Please don't do that. >> >> I'm sorry about that, there is so

Re: Text mining in Python

2010-03-10 Thread Jason Tackaberry
On Wed, 2010-03-10 at 19:58 +0100, mk wrote: > I need to do the following: [...] > Is there some good open source engine out there that would be suitable > to the task at hand? Anybody has experience with them? It sounds like a full text search engine might do a bit more than you need, but based

Re: Down casting Python objects

2010-03-10 Thread Steve Holden
Andrey Fedorov wrote: > On Wed, Mar 10, 2010 at 12:24 AM, Rami Chowdhury > mailto:rami.chowdh...@gmail.com>> wrote: > > Could you tell us *why* you need to down-cast x? Explicit > type-casting is usually unnecessary in Python... > > > Sure! It's related to the longer question I unwisely

Re: Text mining in Python

2010-03-10 Thread Robert Kern
On 2010-03-10 12:58 PM, mk wrote: Hello everyone, I need to do the following: (0. transform words in a document into word roots) 1. analyze a set of documents to see which words are highly frequent 2. detect clusters of those highly frequent words 3. map the clusters to some "special" keywor

Text mining in Python

2010-03-10 Thread mk
Hello everyone, I need to do the following: (0. transform words in a document into word roots) 1. analyze a set of documents to see which words are highly frequent 2. detect clusters of those highly frequent words 3. map the clusters to some "special" keywords 4. rank the documents on cluste

Re: Scalable python dict {'key_is_a_string': [count, some_val]}

2010-03-10 Thread geremy condra
On Wed, Mar 10, 2010 at 11:47 AM, Krishna K wrote: > > > On Fri, Feb 19, 2010 at 11:27 PM, Jonathan Gardner > wrote: >> >> On Fri, Feb 19, 2010 at 10:36 PM, krishna >> wrote: >> > I have to manage a couple of dicts with huge dataset (larger than >> > feasible with the memory on my system), it ba

Re: Can't define __call__ within __init__?

2010-03-10 Thread Duncan Booth
Neal Becker wrote: > Duncan Booth wrote: > ... >> >> P.S. I don't know what you did in your post but your Followup-To >> header is pointing to a group on gmane which makes extra work for me >> replying. Please don't do that. > > I'm sorry about that, there is some bad interaction between gmane'

Re: Can't define __call__ within __init__?

2010-03-10 Thread Neal Becker
Duncan Booth wrote: ... > > P.S. I don't know what you did in your post but your Followup-To header is > pointing to a group on gmane which makes extra work for me replying. > Please don't do that. I'm sorry about that, there is some bad interaction between gmane's nntp- smtp gateway and python's

Re: Calculating very large exponents in python

2010-03-10 Thread Mark Dickinson
On Mar 9, 1:54 pm, casevh wrote: > After a few hours, the remaining factors are > > 6060517860310398033985611921721 > > and > > 9941808367425935774306988776021629111399536914790551022447994642391 > > casevh Whoops---I missed this. I'm too slow! But at least my answers agree with yours. (Factor

Re: I passed a fizzbuzz test but failed at recursion.

2010-03-10 Thread Terry Reedy
On 3/10/2010 10:55 AM, Bill wrote: Look at this recursive fizzbuzz function from http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html def fizzbuzz(num): if num: if num % 15 is 0: return fizzbuzz(num-1) + 'fizzbuzz \n' elif num % 5 is 0: return fizzbuz

Python 2.6.5 release candidate 2 now available

2010-03-10 Thread Barry Warsaw
Hi everyone, The source tarballs and Windows installer for Python 2.6.5 release candidate 2 are now available: http://www.python.org/download/releases/2.6.5/ As usual, please download, install, and test them with your favorite projects and environments. A number of regressions and build problem

Re: Calculating very large exponents in python

2010-03-10 Thread Mark Dickinson
On Mar 9, 6:39 am, casevh wrote: > [also replying to Geremy since the OP's message doesn't appear...] > > On Mar 8, 11:05 am, geremy condra wrote: > > > > > > > On Mon, Mar 8, 2010 at 2:15 AM, Fahad Ahmad wrote: > > > Thanks Geremy, > > > > That has been an absolute bump... GOD i cant si

Re: Can't define __call__ within __init__?

2010-03-10 Thread Duncan Booth
Neal Becker wrote: > What I'm trying to do is make a callable whose behavior is switched > based on some criteria that will be fixed for all calls. In my > example, this will ultimately be determined by the setting of a > command line switch. > If you want different behaviour its usually best

Re: NoSQL Movement?

2010-03-10 Thread Duncan Booth
Xah Lee wrote: > On Mar 8, 11:14 am, Duncan Booth > wrote: >> Xah Lee wrote: >> > For example, consider, if you are within world's top 100th user of >> > database in terms of database size, such as Google, then it may be >> > that the off-the-shelf tools may be limiting. But how many users >>

Re: equivalent of Ruby's Pathname?

2010-03-10 Thread Chris Rebert
On Wed, Mar 10, 2010 at 8:54 AM, Phlip wrote: > Martin P. Hellwig wrote: >> Well even if this statement would be true, I personally think that not >> proclaiming something a 'standard' if you are sure that you are not sure >> about it, is a virtue. > > In terms of trying too hard to achieve perfec

Re: equivalent of Ruby's Pathname?

2010-03-10 Thread Phlip
Martin P. Hellwig wrote: > Well even if this statement would be true, I personally think that not > proclaiming something a 'standard' if you are sure that you are not sure > about it, is a virtue. In terms of trying too hard to achieve perfection, am I missing a Python repository similar to the

Re: Interacting With Another Script

2010-03-10 Thread Grant Edwards
On 2010-03-10, Chris Rebert wrote: > On Wed, Mar 10, 2010 at 8:34 AM, Victor Subervi > wrote: > >> Yeah, that was my idea. But how does the program know when it's being >> prompted to enter data? That's my question ;) > > There's no magical "prompt time". That depends on the program. Some prog

Re: Scalable python dict {'key_is_a_string': [count, some_val]}

2010-03-10 Thread Krishna K
On Fri, Feb 19, 2010 at 11:27 PM, Jonathan Gardner < jgard...@jonathangardner.net> wrote: > On Fri, Feb 19, 2010 at 10:36 PM, krishna > wrote: > > I have to manage a couple of dicts with huge dataset (larger than > > feasible with the memory on my system), it basically has a key which > > is a st

Re: Anything like "Effective Java" for Python?

2010-03-10 Thread Chris Withers
kj wrote: Subject line pretty much says it all: is there a book like "Effective Java" oxymoronic, no? Sorry, couldn't resist ;-) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listi

Re: Interacting With Another Script

2010-03-10 Thread Chris Rebert
On Wed, Mar 10, 2010 at 8:34 AM, Victor Subervi wrote: > On Wed, Mar 10, 2010 at 12:31 PM, Chris Rebert wrote: >> Option C. The most user-friendly, and in some sense simplest, one. >> Figure out the "conversation tree" vpopmail follows. Create a matching >> form tree workflow, presenting multiple

Re: Interacting With Another Script

2010-03-10 Thread Chris Rebert
On Wed, Mar 10, 2010 at 4:32 AM, Victor Subervi wrote: > Hi; > There's a program (vpopmail) that has commands which, when called, request > input ("email address", "password", etc.) from the command line. I would > like to build a TTW interface for my clients to use that interacts with > these com

Re: I passed a fizzbuzz test but failed at recursion.

2010-03-10 Thread Chris Hulan
On Mar 10, 10:55 am, Bill wrote: > Look at this recursive fizzbuzz function > fromhttp://www.codinghorror.com/blog/2007/02/why-cant-programmers-program... > > def fizzbuzz(num): >     if num: >         if num % 15 is 0: return fizzbuzz(num-1) + 'fizzbuzz \n' >         elif num % 5 is 0: return fi

Re: os.rename [Errno 31] Too many links

2010-03-10 Thread Thomas Guettler
Richard wrote: > I want to atomically write to a file so have been using temporary > files and renaming: > > temp = tempfile.NamedTemporaryFile(delete=False) > temp.file.write(data) > temp.file.close() > os.rename(temp.name, output_file) > > This worked but after 39567 files os.rename raises an O

I passed a fizzbuzz test but failed at recursion.

2010-03-10 Thread Bill
Look at this recursive fizzbuzz function from http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html def fizzbuzz(num): if num: if num % 15 is 0: return fizzbuzz(num-1) + 'fizzbuzz \n' elif num % 5 is 0: return fizzbuzz(num-1) + 'buzz \n' elif num %

Re: Bluetooth

2010-03-10 Thread Jeff Peck
On 3/7/2010 1:26 PM, PythonAB wrote: Hello, I'm writing a script that has to connect a bluetooth device with a 3D application. On my search for a bluetooth module i ran into this: http://www.python.org/download/releases/2.4/notes/ where it says: "The socket module now supports Bluetooth sockets

Re: [Edu-sig] Method / Functions - What are the differences?

2010-03-10 Thread Edward Cherlin
On Wed, Mar 10, 2010 at 09:45, John Posner wrote: > [ cross-posting to edu-sig ] > > Bruno (and anyone else interested) -- > > As I promised/threatened, here's the *start* of a write-up on properties, > aimed at non-advanced Python programmers: > >  http://www.jjposner.net/media/python-properties-

Re: Anything like "Effective Java" for Python?

2010-03-10 Thread Simon Brunning
On 10 March 2010 15:19, kj wrote: > Subject line pretty much says it all: is there a book like "Effective > Java" for Python.  I.e. a book that assumes that readers are > experienced programmers that already know the basics of the language, > and want to focus on more advanced programming issues?

Anything like "Effective Java" for Python?

2010-03-10 Thread kj
Subject line pretty much says it all: is there a book like "Effective Java" for Python. I.e. a book that assumes that readers are experienced programmers that already know the basics of the language, and want to focus on more advanced programming issues? ~K -- http://mail.python.org/mailman/l

Re: Named loops for breaking

2010-03-10 Thread Daniel Klein
Thanks for the link to the PEP. I should search through PEPs first next time :) Okay, I understand Guido's reasoning and yield the point. I typed up the specific example in which I came across this problem and, while doing so, realized there's a much better way of approaching the problem, so thank

Re: Method / Functions - What are the differences?

2010-03-10 Thread John Posner
[ cross-posting to edu-sig ] Bruno (and anyone else interested) -- As I promised/threatened, here's the *start* of a write-up on properties, aimed at non-advanced Python programmers: http://www.jjposner.net/media/python-properties-0310.pdf I'm interested in corrections, of course. But I'm

Re: Importing Modules

2010-03-10 Thread Terry Reedy
On 3/10/2010 7:19 AM, PEYMAN ASKARI wrote: Hello I frequent the PyGtk mailing list all the time, but this is the first time I am posting here =) I wanted to know if imported classes are treated differently than internal classes. I have attached a minimal example which points out what I mean. E

os.rename [Errno 31] Too many links

2010-03-10 Thread Richard
I want to atomically write to a file so have been using temporary files and renaming: temp = tempfile.NamedTemporaryFile(delete=False) temp.file.write(data) temp.file.close() os.rename(temp.name, output_file) This worked but after 39567 files os.rename raises an OSError: [Errno 31] Too many links

Re: Knight's tour Warndorff's algorithm problem

2010-03-10 Thread Terry Reedy
On 3/10/2010 12:37 AM, Gabriel Genellina wrote: if (next != 0): (self.y, self.x) = (next.y, next.x) In Python3, next is a builtin function. Choose a different name, at least in public code ;=). -- http://mail.python.org/mailman/listinfo/python-list

Re: about Telnetlib problem

2010-03-10 Thread Jean-Michel Pichavant
JEHERUL wrote: Dear All I am trying to telnet to a Cisco router . Following is my code . #code router.py import getpass import sys import telnetlib HOST = "router address" # router address is ommitted for security reason user = raw_input("Username : ") password = getpass.getpa

Re: pexpect and logging integration

2010-03-10 Thread Jean-Michel Pichavant
Lars Stavholm wrote: Hi all, has anyone managed to integrate pexpect and logging? I.e., I'd like to be able to pick up the dialog, commands sent and responses received, in my logging. I know about the pexpect logfile, and I can log things to stdout or stderr, but I really need to log using the

Re: Can't define __call__ within __init__?

2010-03-10 Thread Matt Nordhoff
Neal Becker wrote: > Simon Brunning wrote: > >> On 10 March 2010 13:12, Neal Becker wrote: >>> Want to switch __call__ behavior. Why doesn't this work? What is the >>> correct way to write this? >>> >>> class X (object): >>> def __init__(self, i): >>> if i == 0: >>> def __call__ (self): >>> ret

Does this already exists?: A module that checks if the used platform is supported

2010-03-10 Thread Martin P. Hellwig
Hi all, Before I start reinventing a squared wheel, I have the following question: Is there already a (standard) module that wraps around the various os/sys information which checks if the platform + version is supported for what I want to do with it. For example I am currently looking at mak

Re: Can't define __call__ within __init__?

2010-03-10 Thread Neal Becker
Simon Brunning wrote: > On 10 March 2010 13:12, Neal Becker wrote: >> Want to switch __call__ behavior. Why doesn't this work? What is the >> correct way to write this? >> >> class X (object): >> def __init__(self, i): >> if i == 0: >> def __call__ (self): >> return 0 >> else: >> def __call_ (s

Re: Can't define __call__ within __init__?

2010-03-10 Thread Mark Lawrence
Neal Becker wrote: Want to switch __call__ behavior. Why doesn't this work? What is the correct way to write this? class X (object): def __init__(self, i): if i == 0: def __call__ (self): return 0 else: def __call_ (self):

Re: Down casting Python objects

2010-03-10 Thread Andrey Fedorov
On Wed, Mar 10, 2010 at 12:24 AM, Rami Chowdhury wrote: > Could you tell us *why* you need to down-cast x? Explicit type-casting is > usually unnecessary in Python... Sure! It's related to the longer question I unwisely asked during PyCon [1] (when no one had time to read it, I suppose). I hav

Re: Can't define __call__ within __init__?

2010-03-10 Thread Simon Brunning
On 10 March 2010 13:12, Neal Becker wrote: > Want to switch __call__ behavior.  Why doesn't this work?  What is the > correct way to write this? > > class X (object): >    def __init__(self, i): >        if i == 0: >            def __call__ (self): >                return 0 >        else: >      

Re: Named loops for breaking

2010-03-10 Thread Jean-Michel Pichavant
Daniel Klein wrote: Hey, I did a little searching and couldn't really find much recent on this. The only thing I found was this: http://groups.google.com/group/comp.lang.python/browse_thread/thread/a696624c92b91181/5b7479fdc3362b83?lnk=gst&q=break+named+loop#5b7479fdc3362b83 Basically I'm wond

Can't define __call__ within __init__?

2010-03-10 Thread Neal Becker
Want to switch __call__ behavior. Why doesn't this work? What is the correct way to write this? class X (object): def __init__(self, i): if i == 0: def __call__ (self): return 0 else: def __call_ (self): return 1 x =

Interacting With Another Script

2010-03-10 Thread Victor Subervi
Hi; There's a program (vpopmail) that has commands which, when called, request input ("email address", "password", etc.) from the command line. I would like to build a TTW interface for my clients to use that interacts with these commands. It's easy enough for me to get the information from a scrip

Re: Import problem

2010-03-10 Thread Jean-Michel Pichavant
News123 wrote: Jean-Michel Pichavant wrote: Johny wrote: I have this directory structure C: \A __init__.py amodule.py \B __init__.py bmodule.py \D __init__.py dmodule.py and I want to import bm

Importing Modules

2010-03-10 Thread PEYMAN ASKARI
Hello I frequent the PyGtk mailing list all the time, but this is the first time I am posting here =) I wanted to know if imported classes are treated differently than internal classes. I have attached a minimal example which points out what I mean. Essentially, if I create a class: class A(

Re: odd error

2010-03-10 Thread Tim Golden
On 10/03/2010 12:09, Alex Hall wrote: I am honestly a bit lost as to why keys.append() is not a good choice here, but I have it working. That's ok; it's just not clear from the context why you have a list of dicts but your comment about different modes explains that. I apparently have to use

Re: odd error

2010-03-10 Thread Alex Hall
I am honestly a bit lost as to why keys.append() is not a good choice here, but I have it working. I apparently have to use the ascii for capital letters if I am capturing the shift modifier, not the lowercase ascii. Using 67 instead of 99 works as expected. I use append because the program has th

Re: Knight's tour Warndorff's algorithm problem

2010-03-10 Thread Robin Rytich
On Wed, 2010-03-10 at 02:37 -0300, Gabriel Genellina wrote: > Warnsdorff's algorithm is heuristic; it works most of the time, but in > some cases leads to a dead end and you have to backtrack and try another > alternative. > The starting square is important; if you start at 1,1 (instead of 0,0

  1   2   >