Jython 2.5.1 Release Candidate 3 is out

2009-09-24 Thread Frank Wierzbicki
On behalf of the Jython development team, I'm pleased to announce that Jython 2.5.1rc3 is available for download here: https://sourceforge.net/projects/jython/files/jython-dev/2.5.1rc3/jython_installer-2.5.1rc3.jar/download - See http://wiki.python.org/jython/InstallationInstructions for

Try CodeInvestigator version 0.16.0

2009-09-24 Thread hans moleman
CodeInvestigator version 0.16.0 was released on Sept 23. It requires Python version 2.6 and a Firefox browser. Bug fixes: Indentation of comments and triple quoted strings. Triple quoted strings could embed additional spaces. Additional __str__ calls were made for an

Sneaky web server 0.1

2009-09-24 Thread Massimo Di Pierro
A fast portable pure-python multithreaded experimental WSGI web server in 300 lines of code: Python 2.4,2.5,2.6 version: http://code.google.com/p/web2py/source/browse/trunk/gluon/sneaky.py Python 3.0,3.1 version: http://code.google.com/p/web2py/source/browse/trunk/gluon/ sneaky3.py

Re: Finding application data after install - a solution?

2009-09-24 Thread Gabriel Genellina
En Tue, 22 Sep 2009 13:47:09 -0300, Wolodja Wentland wentl...@cl.uni-heidelberg.de escribió: On Tue, Sep 22, 2009 at 07:42 -0700, Aahz wrote: I want to: 1. Give administrators the freedom to install the data wherever they want 2. Adhere to the FHS (installing data within

Re: Twisted: 1 thread in the reactor pattern

2009-09-24 Thread jacopo
On Sep 23, 5:57 pm, exar...@twistedmatrix.com wrote: On 06:08 am, jacopo.pe...@gmail.com wrote: I am diving into Twisted and Perspective Broker (PB) in particular and I would like to understand more about what happens behind the curtains. Say I have a client and a server on two different

Re: logging.handlers.SMTPHandler question

2009-09-24 Thread Vinay Sajip
On Sep 24, 4:14 am, akonsu ako...@gmail.com wrote: hello, SMTPHAndler seems to email every single record separately. is there a way to collect all log output and then send it in a single email message? or do i have to do it manually? You can use a buffering SMTP handler, see:

Screencapture of a video

2009-09-24 Thread koranthala
Hi, I was trying to capture the video which I was viewing using Imagegrab module in PIL (windows). But, I found that the video was not captured at all. A quick googling tells me that it is because the windows does not have access to the viewing area. Is there any way I can capture the

Re: logging.handlers.SMTPHandler question

2009-09-24 Thread Vinay Sajip
On Sep 24, 8:37 am, Vinay Sajip vinay_sa...@yahoo.co.uk wrote: On Sep 24, 4:14 am, akonsu ako...@gmail.com wrote: http://python.pinger.pl/m/552751/bufferingsmtphandler Looking back at it, it looks as if it's adapted from some test code I wrote back in 2002, see here:

Average of entries in a list of lists

2009-09-24 Thread Evora
Hello, I'm a bit of a newbie to python, so this may very well be a basic question: I have a list of lists, with around 1000 lists looking like this: ['0.000744', '0.480106', 'B']. I need the average of the first to entries of all the lists, can anybody help how me to do this? Thanks in

Re: Average of entries in a list of lists

2009-09-24 Thread Steven D'Aprano
On Thu, 24 Sep 2009 01:30:10 -0700, Evora wrote: Hello, I'm a bit of a newbie to python, so this may very well be a basic question: I have a list of lists, with around 1000 lists looking like this: ['0.000744', '0.480106', 'B']. I need the average of the first to entries of all the

Re: Intercepting binding?

2009-09-24 Thread Steven D'Aprano
On Wed, 23 Sep 2009 18:10:10 -0700, andrew cooke wrote: these are valid points, but in practice the main use (for the restricted application i care about) is si,ple variables, and this is an optional extra to help the user, so it's OK if it only works sometimes. at the moment i'd be happy

Re: custom data warehouse in python vs. out-of-the-box ETL tool

2009-09-24 Thread Tony Schmidt
@Martin: Thanks for your great feedback. So do you think it would be very beneficial for me to start with an Inman or Kimball book? Or do you think it would be just leisure reading and not very practical at best - fill my head with needless jargon and inflexible dogmas, at worst? I took a

Re: IDE for python similar to visual basic

2009-09-24 Thread Albert van der Horst
In article pan.2009.09.11.12.02.03.656...@nowhere.com, Nobody nob...@nowhere.com wrote: On Mon, 07 Sep 2009 23:56:17 +, Albert van der Horst wrote: SNIP In view of the above this is not quite the correct way to put it. What I resent is that it leads to a non-professional attitude of

Date using input

2009-09-24 Thread flebber
Sorry to ask a simple question but I am a little confused how to combine the input function and the date time module. Simply at the start of the program I want to prompt the user to enter the date, desirably in the format dd/mm/year. However I want to make sure that python understands the time

very weird python bug..

2009-09-24 Thread Sampsa Riikonen
Dear List, Maybe someone could help out with this mysterious bug.. starting a python program in a directory named python, makes the importation of modules sometimes impossible with cryptic error messages.. sam...@linux-912g:~ mkdir paska2 sam...@linux-912g:~ sam...@linux-912g:~ echo import

Re: Creating a local variable scope.

2009-09-24 Thread Albert van der Horst
In article 65e8a017-abcb-49ad-8867-bc473f83e...@s39g2000yqj.googlegroups.com, Bearophile bearophileh...@lycos.com wrote: Steven D'Aprano: (3) Create an inner function, then call that. Several people after someone gives this anwer. My personal opinion is that if you really need a local scope

Average of entries in a list of lists

2009-09-24 Thread Evora
Hello, I'm a bit of a newbie to python, so this may very well be a basic question: I have a list of lists, with around 1000 lists looking like this: ['0.000744', '0.480106', 'B']. I need the average of the first to entries of all the lists, can anybody help how me to do this? Thanks in

Re: easy question, how to double a variable

2009-09-24 Thread Iain King
On Sep 23, 7:36 pm, David C Ullrich dullr...@sprynet.com wrote: On Tue, 22 Sep 2009 02:34:53 +, Steven D'Aprano wrote: On Mon, 21 Sep 2009 13:50:23 -0500, David C Ullrich wrote: But you actually want to return twice the value. I don't see how to do that. What? Seriously? You're

Re: Download and save a picture - urllib

2009-09-24 Thread Piet van Oostrum
MRAB pyt...@mrabarnett.plus.com (M) wrote: M mattia wrote: You were right, the problem was with the print function, using a normal write everythong works fine. M You should open the output file as binary (it doesn't matter on M Linux/Unix, but is a good idea anyway for portability). It

Re: very weird python bug..

2009-09-24 Thread Christian Heimes
Sampsa Riikonen wrote: = If I start the program in directory paska2, everythings OK, but if the directory name happens to be python, the importation of the modules goes nuts! What's inside the python/ subdirectory? Do you happen to have a file called struct.py inside it? --

Re: custom data warehouse in python vs. out-of-the-box ETL tool

2009-09-24 Thread M.-A. Lemburg
snfctech wrote: @Lemburg: Thanks for the suggestion. I'm sure you make a fine product, but my development platform is Linux, and I don't want any additional Windows servers to deal with (than the ones I'm already stuck with.) Strange, EasySoft used to support their product on Linux as

Re: Intercepting binding?

2009-09-24 Thread Carl Banks
On Sep 23, 5:49 pm, Rhodri James rho...@wildebst.demon.co.uk wrote: On Thu, 24 Sep 2009 01:34:35 +0100, andrew cooke and...@acooke.org wrote: For example, I assume it's possible to somehow access the dictionary for the current block, but I can't see how to do this after assignment.  If I

Re: Average of entries in a list of lists

2009-09-24 Thread Xavier Ho
On Thu, Sep 24, 2009 at 8:54 PM, Evora lasse_lorent...@hotmail.com wrote: Hello, I'm a bit of a newbie to python, so this may very well be a basic question: I have a list of lists, with around 1000 lists looking like this: ['0.000744', '0.480106', 'B']. I need the average of the first to

Re: Finding application data after install - a solution?

2009-09-24 Thread Wolodja Wentland
On Thu, Sep 24, 2009 at 04:07 -0300, Gabriel Genellina wrote: I do not intentionally focus on UNIX type systems, but I have grown up with *nix and I rather follow one scheme than none at all. But the proposed way works on Windows as well, although the users might find previously unseen

Re: Intercepting binding?

2009-09-24 Thread Carl Banks
On Sep 23, 7:41 pm, andrew cooke and...@acooke.org wrote: On Sep 23, 10:11 pm, Dave Angel da...@ieee.org wrote: This comes up periodically in this list, and the answer is always something like:  you can't get there from here. Well, I'm both flexible and desperate, so this is a possible

Re: Finding application data after install - a solution?

2009-09-24 Thread Tim Golden
Wolodja Wentland wrote: I think many Windows users would say WTF!? when seeing those directories - and send cordial greetings to you, your parents and your whole family :) That is probably true, but Windows has a 'etc' directory (c:\windows\system32\drivers\etc) which AFAIK contains the hosts

Re: Intercepting binding?

2009-09-24 Thread andrew cooke
On Sep 24, 7:12 am, Carl Banks pavlovevide...@gmail.com wrote:     with capture_changed_bindings() as changed:         b = 5         c = 4         d = 6     print changed test() Quick and dirty, not robust at all.  But you get the idea. Carl Banks brilliant. using the with context is

Re: Date using input

2009-09-24 Thread Dave Angel
flebber wrote: Sorry to ask a simple question but I am a little confused how to combine the input function and the date time module. Simply at the start of the program I want to prompt the user to enter the date, desirably in the format dd/mm/year. However I want to make sure that python

Re: Average of entries in a list of lists

2009-09-24 Thread Dave Angel
Evora wrote: Hello, I'm a bit of a newbie to python, so this may very well be a basic question: I have a list of lists, with around 1000 lists looking like this: ['0.000744', '0.480106', 'B']. I need the average of the first to entries of all the lists, can anybody help how me to do this?

Re: Re: Date using input

2009-09-24 Thread flebber . crue
I am using python 2.6.2, I haven't updated to 3.0 yet. No I have no class or instructor, I am learning this myself. I have Hetlands book Beginning Python Novice to Professional and online documentation books so Dive into Python, python.org etc. Using the SPE editor. I have currently only

Re: Intercepting binding?

2009-09-24 Thread andrew cooke
On Sep 24, 5:20 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: Speaking as a user (although not of Andrew's domain specific language), I'd like to say to developers PLEASE PLEASE PLEASE don't try to help me with half-baked unreliable solutions that only work sometimes.

Re: Solved - Python: automate input to MySQL query

2009-09-24 Thread Joe Riopel
On Wed, Sep 23, 2009 at 4:21 PM, D'Arcy J.M. Cain da...@druid.net wrote: In any case, I have a strong philosophical objection to using the same name to refer to two different things regardless of any operational issues.  The manager.firstname and employee.firstname are not the same thing and

Re: Date using input

2009-09-24 Thread Dave Angel
flebber.c...@gmail.com wrote: I am using python 2.6.2, I haven't updated to 3.0 yet. No I have no class or instructor, I am learning this myself. I have Hetlands book Beginning Python Novice to Professional and online documentation books so Dive into Python, python.org etc. Using the SPE

Re: Finding application data after install - a solution?

2009-09-24 Thread Wolodja Wentland
On Thu, Sep 24, 2009 at 12:51 +0100, Tim Golden wrote: Wolodja Wentland wrote: Is CSIDL_COMMON_APPDATA and environment variable set on all Windows flavours? Certainly all those which Python currently supports. There are some small subtleties which have changed between older and newer

Re: Solved - Python: automate input to MySQL query

2009-09-24 Thread Tino Wildenhain
Hi, ... code, even that is not needed, as the columns are returned in the order specified so code /knows/ that the first column isname from /this/ table and the other column withname is from /that/ table). Unless you get a dictionary return. In any case, I have a strong philosophical

Re: Date using input

2009-09-24 Thread flebber
On Sep 24, 10:58 pm, Dave Angel da...@ieee.org wrote: flebber.c...@gmail.com wrote: I am using python 2.6.2, I haven't updated to 3.0 yet. No I have no class or instructor, I am learning this myself. I have Hetlands book Beginning Python Novice to Professional and online documentation

Re: Finding application data after install - a solution?

2009-09-24 Thread Tim Golden
Wolodja Wentland wrote: On Thu, Sep 24, 2009 at 12:51 +0100, Tim Golden wrote: Wolodja Wentland wrote: Is CSIDL_COMMON_APPDATA and environment variable set on all Windows flavours? Just to clarify, now that I read your post more carefully, there *is* an environment variable APPDATA which is

Re: Solved - Python: automate input to MySQL query

2009-09-24 Thread D'Arcy J.M. Cain
On Thu, 24 Sep 2009 08:49:02 -0400 Joe Riopel goo...@gmail.com wrote: On Wed, Sep 23, 2009 at 4:21 PM, D'Arcy J.M. Cain da...@druid.net wrote: In any case, I have a strong philosophical objection to using the same name to refer to two different things regardless of any operational issues.  

Looger object only prints ERRORs

2009-09-24 Thread daved170
hi everybody, I took your adviced and used the logging object. I copied the example in 16.6.15.2 - using logging in multiple modules from http://docs.activestate.com/activepython/3.1/python/library/logging.html. unfortunattly it only prints to file the ERROR level's messages and ignore the

Re: easy question, how to double a variable

2009-09-24 Thread Pablo Torres N.
On Sep 24, 5:51 am, Iain King iaink...@gmail.com wrote: On Sep 23, 7:36 pm, David C Ullrich dullr...@sprynet.com wrote: On Tue, 22 Sep 2009 02:34:53 +, Steven D'Aprano wrote: On Mon, 21 Sep 2009 13:50:23 -0500, David C Ullrich wrote: But you actually want to return twice the

Re: Solved - Python: automate input to MySQL query

2009-09-24 Thread D'Arcy J.M. Cain
On Thu, 24 Sep 2009 15:03:26 +0200 Tino Wildenhain t...@wildenhain.de wrote: In any case, I have a strong philosophical objection to using the same name to refer to two different things regardless of any operational issues. The manager.firstname and employee.firstname are not the same

Re: Most active coroutine library project?

2009-09-24 Thread Antoine Pitrou
Grant Edwards invalid at invalid.invalid writes: Back when I worked on one of the first hand-held cellular mobile phones, it used co-routines where the number of coroutines was fixed at 2 (one for each register set in a Z80 CPU). Gotta love the lightning-fast EXX instruction. :-) Regards

Re: Looger object only prints ERRORs

2009-09-24 Thread Jean-Michel Pichavant
daved170 wrote: hi everybody, I took your adviced and used the logging object. I copied the example in 16.6.15.2 - using logging in multiple modules from http://docs.activestate.com/activepython/3.1/python/library/logging.html. unfortunattly it only prints to file the ERROR level's messages

Re: Looger object only prints ERRORs

2009-09-24 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: daved170 wrote: hi everybody, I took your adviced and used the logging object. I copied the example in 16.6.15.2 - using logging in multiple modules from http://docs.activestate.com/activepython/3.1/python/library/logging.html. unfortunattly it only prints to

Regex trouble

2009-09-24 Thread Support Desk
I am trying to loop over a dictionary of phone numbers and using a python regex to determine if they are long distance or local and then adding them to their appropriate dictionary, My regex doesn't appear to be working though. My regex's are these international__iregex=r'^1?(011|001)'

Re: Date using input

2009-09-24 Thread flebber
On Sep 24, 11:10 pm, flebber flebber.c...@gmail.com wrote: On Sep 24, 10:58 pm, Dave Angel da...@ieee.org wrote: flebber.c...@gmail.com wrote: I am using python 2.6.2, I haven't updated to 3.0 yet. No I have no class or instructor, I am learning this myself. I have Hetlands book

Regex trouble

2009-09-24 Thread Support Desk
I am trying to loop over a dictionary of phone numbers and using a python regex to determine if they are long distance or local and then adding them to their appropriate dictionary, My regex doesn't appear to be working though. My regex's are these international__iregex=r'^1?(011|001)'

Re: Dynamic Form

2009-09-24 Thread victorsubervi
in line... On Wed, Sep 23, 2009 at 9:13 PM, BJ Swope bigbluesw...@gmail.com wrote: What is your code not doing? see below Are you winding up with duplicate data in the DB? yes Is your web browser re-submitting the form with the same data if you refresh the screen? yes Is your

Re: Date using input

2009-09-24 Thread Tim Chase
Surely getting it tottally mixed up from datetime import date def ObtainDate(params): date = raw_input(Type Date dd/mm/year: %2.0r%2.0r/%2.0r%2.0r/%4.0r %4.0r%4.0r%4.0r) print date.datetime(year-month-day) By setting date = raw_input(...), you mask the datetime.date object preventing you

Re: logging.handlers.SMTPHandler question

2009-09-24 Thread Vinay Sajip
On Sep 24, 4:14 am, akonsu ako...@gmail.com wrote: hello, SMTPHAndler seems to email every single record separately. is there a way to collect all log output and then send it in a single email message? or do i have to do it manually? thanks konstantin See also

setting up dynamic descriptors in Python

2009-09-24 Thread brian huggins
Hello, I want to set up descriptors at runtine, but it isn't working the way i would expect. Does anybody know if this is possible? Here is an example: class Descriptor(object): def __init__(self, name) : self.val=0 self.name = name def __get__(self, obj, objtype):

Re: Most active coroutine library project?

2009-09-24 Thread Michele Simionato
On Aug 23, 5:02 pm, Phillip B Oldham phillip.old...@gmail.com wrote: I've been taking a look at the multitude of coroutine libraries available for Python, but from the looks of the projects they all seem to be rather quiet. I'd like to pick one up to use on a current project but can't deduce

Re: Regex trouble

2009-09-24 Thread MRAB
Support Desk wrote: I am trying to loop over a dictionary of phone numbers and using a python regex to determine if they are long distance or local and then adding them to their appropriate dictionary, My regex doesn't appear to be working though. My regex's are these

Re: IDE for python similar to visual basic

2009-09-24 Thread brian huggins
You can also try Eclipse + PyDev. It's not the same as Visual Studio, and I   am not sure about the GUI builder, but I think it's what you want. I really like Eclipse + Pydev. It is not a GUI builder at all but it has a nice debugger, code completion and that kind of thing. And its free!

Re: Dynamic Form

2009-09-24 Thread BJ Swope
1. Did you try the headers for no-caching of the page? 2. If you wish to avoid dupes in a DB, Primary Keys are the tool to prevent duplicates. On Thu, Sep 24, 2009 at 11:01 AM, victorsubervi victorsube...@gmail.comwrote: in line... On Wed, Sep 23, 2009 at 9:13 PM, BJ Swope

Re: custom data warehouse in python vs. out-of-the-box ETL tool

2009-09-24 Thread Tony Schmidt
Hi, Marc-Andre - well, so far you seem to be the only one suggesting that cross-database joins is the way to go - everyone else has been telling me to build a warehouse. I initially was trying to avoid the warehouse idea to avoid going through the external temporary resource, as you say. But

Re: Dynamic Form

2009-09-24 Thread Brian Victor
victorsubervi wrote: On Wed, Sep 23, 2009 at 9:13 PM, BJ Swope bigbluesw...@gmail.com wrote: Is your web browser re-submitting the form with the same data if you refresh the screen? yes I'm surprised no one has mentioned this before, but the standard approach to this problem is to redirect

Re: Twisted: 1 thread in the reactor pattern

2009-09-24 Thread exarkun
On 07:10 am, jacopo.pe...@gmail.com wrote: On Sep 23, 5:57�pm, exar...@twistedmatrix.com wrote: [snip] It isn't possible. �While the remote methods are running, other events are not being serviced. �This is what is meant when people describe Twisted as a *cooperative* multitasking

Doubley imported module caused devastating bug

2009-09-24 Thread Zac Burns
Currently it is possible to import a file of one path to more than one 'instance' of a module. One notable example is import __init__ from a package. See http://stackoverflow.com/questions/436497/python-import-the-containing-package This recently caused a devastating bug in some of my code. What

Re: Date using input

2009-09-24 Thread Dave Angel
flebber wrote: On Sep 24, 11:10 pm, flebber flebber.c...@gmail.com wrote: On Sep 24, 10:58 pm, Dave Angel da...@ieee.org wrote: flebber.c...@gmail.com wrote: I am using python 2.6.2, I haven't updated to 3.0 yet. No I have no class or instructor, I am learning this myself. I

test_sys failed

2009-09-24 Thread Eno Compton 3
On a new python 3 installation on a fedora 7 box, I get a test_sys failure. Here is the console spew. Couldn't find any discussion about this. Suspect I have fouled up but I don' t know how to proceed. Ideas? 853 test_sys 854 test test_sys failed -- Traceback (most recent call last):

Re: Regex trouble

2009-09-24 Thread Simon Forman
On Thu, Sep 24, 2009 at 10:43 AM, Support Desk m...@ipglobal.net wrote: I am trying to loop over a dictionary  of phone numbers and using a python regex to determine if they are long distance or local and then adding them to their appropriate dictionary, My regex doesn't appear to be working

Re: Python-URL! - weekly Python news and links (Sep 17)

2009-09-24 Thread Cameron Laird
In article h8tf2d$95...@lairds.us, Gabriel Genellina python-...@phaseit.net wrote (but I edited): . . . More ways to define an empty function that you ever imagined:

Re: DBHandler class for logging?

2009-09-24 Thread kj
In f8a64e65-d13c-410f-abf8-fa5fadcb9...@f10g2000vbf.googlegroups.com Vinay Sajip vinay_sa...@yahoo.co.uk writes: See my answer to a question on Stack Overflow, which has the source code for a simple handler which writes to a database using the Python DB-API 2.0:

Re: pycopg2 build problems

2009-09-24 Thread devaru
On Sep 24, 2:14 am, phi...@semanchuk.com wrote: Quoting Wolodja Wentland wentl...@cl.uni-heidelberg.de: On Wed, Sep 23, 2009 at 12:24 -0700, devaru wrote: I'm trying to install psycopg2 on my system. I followed the instruction in INSTALL file and gave the command python setup.py build

PExpect on Windows System Using Cygwin

2009-09-24 Thread Kevin Holleran
Hello, I downloaded and installed the pexpect module and wrote a script. All is well and good, but the script proved to be pretty useful and now I was asked to run it as a scheduled task up on a server to run periodically. I was intending on simply packaging it up with Py2Exe and moving it to

When is divmod(a,b)[0] == floor(a/b)-1 ?

2009-09-24 Thread kj
The docs for divmod include the following: divmod(a, b) ...For floating point numbers the result is (q, a % b), where q is usually math.floor(a / b) but may be 1 less than that. ... I know that floating point math can sometimes produce unexpected results, so the above caveat is

Repeated output when logging exceptions

2009-09-24 Thread John Gordon
I wrote some code to handle and log exceptions in my application. It works well, but it produces double output for each exception. How can I fix this? Here's the pared-down code: - main.py import exceptionLogger import doStuff exlog = exceptionLogger.exceptionLogger() stuff =

Re: Doubley imported module caused devastating bug

2009-09-24 Thread Ethan Furman
Zac Burns wrote: Currently it is possible to import a file of one path to more than one 'instance' of a module. One notable example is import __init__ from a package. See http://stackoverflow.com/questions/436497/python-import-the-containing-package This recently caused a devastating bug in

Evaluate coding and style

2009-09-24 Thread Brown, Rodrick
I recently started playing with Python about 3 days now (Ex Perl guy) and wanted some input on style and structure of what I'm doing before I really start picking up some bad habits here is a simple test tool I wrote to validate home dirs on my system. Please evaluate and let me know what

Re: Looger object only prints ERRORs

2009-09-24 Thread Vinay Sajip
On Sep 24, 2:27 pm, daved170 daved...@gmail.com wrote: hi everybody, I took your adviced and used theloggingobject. I copied the example in 16.6.15.2 - usingloggingin multiple modules fromhttp://docs.activestate.com/activepython/3.1/python/library/logging.html. unfortunattly it only prints

help wanted with list

2009-09-24 Thread Ahmed Shamim
list = [ 'a', '1', 'b', '2'] what would be the logic, if I input a to get output 1. -- http://mail.python.org/mailman/listinfo/python-list

Re: help wanted with list

2009-09-24 Thread Iuri
You should use a dictionary. dic = {'a':1, 'b':2} Use dic['a'] to get output 1. []s iurisilvio On Thu, Sep 24, 2009 at 5:31 PM, Ahmed Shamim partha.sha...@gmail.comwrote: list = [ 'a', '1', 'b', '2'] what would be the logic, if I input a to get output 1. --

Re: Doubley imported module caused devastating bug

2009-09-24 Thread Carl Banks
On Sep 24, 10:26 am, Zac Burns zac...@gmail.com wrote: Currently it is possible to import a file of one path to more than one 'instance' of a module. One notable example is import __init__ from a package. Seehttp://stackoverflow.com/questions/436497/python-import-the-containin... This

iterate over list while changing it

2009-09-24 Thread Torsten Mohr
Hello, a = [1, 2, 3, 4, 5, 6] for i, x in enumerate(a): if x == 3: a.pop(i) continue if x == 4: a.push(88) print i, i, x, x I'd like to iterate over a list and change that list while iterating. I'd still like to work on all items in that list, which is not

Re: help wanted with list

2009-09-24 Thread Simon Brunning
2009/9/24 Ahmed Shamim partha.sha...@gmail.com: list = [ 'a', '1', 'b', '2'] what would be the logic, if I input a to get output 1. Turn it into a dictionary first: mylist = [ 'a', '1', 'b', '2'] mydict = dict(zip(mylist[::2], mylist[1::2])) mydict['a'] '1' -- Cheers, Simon B. --

help wanted with list

2009-09-24 Thread Xavier Lapointe
Not sure I understand well, but let say I did.. list[list.index('a')+1] Le 14:59, Ahmed Shamim a écrit : list = [ 'a', '1', 'b', '2'] what would be the logic, if I input a to get output 1. -- http://mail.python.org/mailman/listinfo/python-list

Re: Doubley imported module caused devastating bug

2009-09-24 Thread Zac Burns
On Thu, Sep 24, 2009 at 1:38 PM, Carl Banks pavlovevide...@gmail.com wrote: On Sep 24, 10:26 am, Zac Burns zac...@gmail.com wrote: Currently it is possible to import a file of one path to more than one 'instance' of a module. One notable example is import __init__ from a package.

Re: When is divmod(a,b)[0] == floor(a/b)-1 ?

2009-09-24 Thread Robert Kern
On 2009-09-24 14:40 PM, kj wrote: The docs for divmod include the following: divmod(a, b) ...For floating point numbers the result is (q, a % b), where q is usually math.floor(a / b) but may be 1 less than that. ... I know that floating point math can sometimes produce

Re: iterate over list while changing it

2009-09-24 Thread Terry Reedy
Torsten Mohr wrote: Hello, a = [1, 2, 3, 4, 5, 6] for i, x in enumerate(a): If you change a list while iterating over, start at the tail. ...reversed(enumerate(a)) if x == 3: a.pop(i) del a[i] # you already have the item continue if x == 4:

Re: Evaluate coding and style

2009-09-24 Thread Ethan Furman
Brown, Rodrick wrote: I recently started playing with Python about 3 days now (Ex Perl guy) and wanted some input on style and structure of what I'm doing before I really start picking up some bad habits here is a simple test tool I wrote to validate home dirs on my system. Please evaluate

Re: When is divmod(a,b)[0] == floor(a/b)-1 ?

2009-09-24 Thread kj
In mailman.429.1253825725.2807.python-l...@python.org Robert Kern robert.k...@gmail.com writes: On 2009-09-24 14:40 PM, kj wrote: The docs for divmod include the following: divmod(a, b) ...For floating point numbers the result is (q, a % b), where q is usually math.floor(a /

urllib, can't seem to get form post right

2009-09-24 Thread Adam W.
I'm trying to scrape some historical data from NOAA's website, but I can't seem to feed it the right form values to get the data out of it. Heres the code: import urllib import urllib2 ## The source page http://www.erh.noaa.gov/bgm/climate/bgm.shtml url =

Re: Doubley imported module caused devastating bug

2009-09-24 Thread Terry Reedy
Zac Burns wrote: On Thu, Sep 24, 2009 at 1:38 PM, Carl Banks pavlovevide...@gmail.com wrote: On Sep 24, 10:26 am, Zac Burns zac...@gmail.com wrote: Currently it is possible to import a file of one path to more than one 'instance' of a module. One notable example is import __init__ from a

Re: Evaluate coding and style

2009-09-24 Thread Jon Clements
On 24 Sep, 21:11, Brown, Rodrick rodrick.br...@citi.com wrote: I recently started playing with Python about 3 days now (Ex Perl guy) and wanted some input on style and structure of what I'm doing before I really start picking up some bad habits here is a simple test tool I wrote to

Re: urllib, can't seem to get form post right

2009-09-24 Thread Jon Clements
On 24 Sep, 22:18, Adam W. awasile...@gmail.com wrote: I'm trying to scrape some historical data from NOAA's website, but I can't seem to feed it the right form values to get the data out of it.  Heres the code: import urllib import urllib2 ## The source

Re: Evaluate coding and style

2009-09-24 Thread Rhodri James
On Thu, 24 Sep 2009 21:11:36 +0100, Brown, Rodrick rodrick.br...@citi.com wrote: I recently started playing with Python about 3 days now (Ex Perl guy) and wanted some input on style and structure of what I'm doing before I really start picking up some bad habits here is a simple test tool

Re: iterate over list while changing it

2009-09-24 Thread Simon Forman
On Thu, Sep 24, 2009 at 4:32 PM, Torsten Mohr tm...@s.netic.de wrote: Hello, a = [1, 2, 3, 4, 5, 6] for i, x in enumerate(a):    if x == 3:        a.pop(i)        continue    if x == 4:        a.push(88)    print i, i, x, x I'd like to iterate over a list and change that list while

Re: Intercepting binding?

2009-09-24 Thread Rhodri James
On Thu, 24 Sep 2009 13:39:57 +0100, andrew cooke and...@acooke.org wrote: On Sep 24, 5:20 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: Speaking as a user (although not of Andrew's domain specific language), I'd like to say to developers PLEASE PLEASE PLEASE don't try to

Re: iterate over list while changing it

2009-09-24 Thread Rhodri James
On Thu, 24 Sep 2009 21:32:53 +0100, Torsten Mohr tm...@s.netic.de wrote: Hello, a = [1, 2, 3, 4, 5, 6] for i, x in enumerate(a): if x == 3: a.pop(i) continue if x == 4: a.push(88) print i, i, x, x I'd like to iterate over a list and change that list

Re: Regex trouble

2009-09-24 Thread Rhodri James
On Thu, 24 Sep 2009 19:45:37 +0100, Simon Forman sajmik...@gmail.com wrote: FWIW this problem is too simple (IMHO) for regular expressions. Simply carve off the first three digits and check against sets of the prefixes you're interested in: #any number starting with these prefixes is not

Re: Re: Date using input

2009-09-24 Thread flebber . crue
Okay, thanks for the advice that sounds a good place to start. I used %2.os was an attempt to define width and precision to stop typo errors eg the user accidentally inputing 101/09/2009 or similar error. So that the __/__/ was adhered to. I will go back to the start get the basics

Re: Regex trouble

2009-09-24 Thread Simon Forman
On Thu, Sep 24, 2009 at 6:31 PM, Rhodri James rho...@wildebst.demon.co.uk wrote: On Thu, 24 Sep 2009 19:45:37 +0100, Simon Forman sajmik...@gmail.com wrote: FWIW this problem is too simple (IMHO) for regular expressions. Simply carve off the first three digits and check against sets of the

Re: PExpect on Windows System Using Cygwin

2009-09-24 Thread Dave Angel
Kevin Holleran wrote: Hello, I downloaded and installed the pexpect module and wrote a script. All is well and good, but the script proved to be pretty useful and now I was asked to run it as a scheduled task up on a server to run periodically. I was intending on simply packaging it up with

Re: Doubley imported module caused devastating bug

2009-09-24 Thread Daniel Stutzbach
On Thu, Sep 24, 2009 at 2:51 PM, Ethan Furman et...@stoneleaf.us wrote: I believe that modules are imported only once That's *mostly* true, but try this one: A.py: print 'Importing A' import B B.py: print 'Importing B' import A Cashew:/tmp$ python2.5 B.py Importing B Importing A Importing B

Re: IDE for python similar to visual basic

2009-09-24 Thread J Sisson
On Sun, Sep 13, 2009 at 6:25 AM, Nobody nob...@nowhere.com wrote: On Fri, 11 Sep 2009 05:27:59 -0700, r wrote: Sounds like somebody failed to get input from their users at design time. Or somebody has the inability to relate to their end users. You're assuming that there is some right

Re: Date using input

2009-09-24 Thread Sean DiZazzo
On Sep 24, 7:49 am, flebber flebber.c...@gmail.com wrote: On Sep 24, 11:10 pm, flebber flebber.c...@gmail.com wrote: On Sep 24, 10:58 pm, Dave Angel da...@ieee.org wrote: flebber.c...@gmail.com wrote: I am using python 2.6.2, I haven't updated to 3.0 yet. No I have no class or

Anyone with Experience Using WinTV Capture Cards?

2009-09-24 Thread W. eWatson
A friend is looking for some help with how to use Python to access a WinTV (Go Plus) capture card, and how to display an image from it. Is there some facility that might help him, or does anyone have experience with such use that might suggest sources? --

Re: Evaluate coding and style

2009-09-24 Thread Esmail
Brown, Rodrick wrote: I recently started playing with Python about 3 days now (Ex Perl guy) and wanted some input on style and structure of what I'm doing before I really start picking up some bad habits here is a simple test tool I wrote to validate home dirs on my system. Please evaluate

Re: Re: Re: Date using input

2009-09-24 Thread flebber . crue
I don't think I am using re.compile properly, but thought as this would make my output an object it would be better for later, is that correct? #Obtain date def ObtainDate(date): date = raw_input(Type Date dd/mm/year: ) re.split('[/]+', date) date year = date[-1] month = date[1] day = date[0]

  1   2   >