Python-URL! - weekly Python news and links (Jan 28)

2008-01-29 Thread Gabriel Genellina
QOTW: The nice thing with Pyrex is that you can use the Python interpreter, or not use it, more or less depending on your way to declare things and your way to code. So, in a way, you have full control over the compromise between speed and facility. The temptation is always strong to use Python

Storm 0.12 is out!

2008-01-29 Thread Gustavo Niemeyer
On behalf of the Storm development team, I'm proud to announce that the release 0.12 is out! This is a very exciting release, as it brings several fixes and quite a few new features. Thank you very much to everyone who contributed. Storm is available at: https://storm.canonical.com

Pydev 1.3.12 Released

2008-01-29 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.3.12 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions:

Re: [HELP] SMTPlib not sending my mail

2008-01-29 Thread ashok.raavi
Hi, I am also facing the same problem, smtplib used to send mail a while back but it stopped sending mails. when i run this in interpreter import smtplib s = smtplib.SMTP(localhost) s.sendmail(from, to, message) {} though it is not giving any error, it is not sending mail. Any help is

Re: Encryption Recommendation

2008-01-29 Thread Michael Ströder
Diez B. Roggisch wrote: [EMAIL PROTECTED] wrote: I'm still using Python 2.4. In my code, I want to encrypt a password and at another point decrypt it. What is the standard way of doing encryption in python? Is it the Pycrypto module? Usually, one doesn't store clear-text passwords.

Re: Just for fun: Countdown numbers game solver

2008-01-29 Thread david . hotham
On Jan 28, 10:11 pm, Arnaud Delobelle [EMAIL PROTECTED] wrote: My strategy was to walk through each solution only once (for a certain definition of only once :), thus I was hoping not to need a hashtable. Yes, that seems like it should be preferable (and indeed necessary for a more general

Announcing the Python core sprint at PyCon 2008

2008-01-29 Thread Brett Cannon
As has occurred since the inception of PyCon, there will be a sprint on the Python core at this year's conference! If you will be attending PyCon (or will be in Chicago during the dates of the sprints), attending the sprint is a great way to give back to Python. Working on Python itself tends to

Intra-package References?? (again)

2008-01-29 Thread marcroy . olsen
Hi Python list, I have been struggleling with this before, but have never been able to find a good solution. The thing I dont understand is, I follow the guide here: http://docs.python.org/tut/node8.html#SECTION00842 And have the same setup as the packages howto here:http://

Re: [HELP] SMTPlib not sending my mail

2008-01-29 Thread Lars Johansen
have you checked your mail server logs ? tir, 29.01.2008 kl. 00.24 -0800, skrev ashok.raavi: Hi, I am also facing the same problem, smtplib used to send mail a while back but it stopped sending mails. when i run this in interpreter import smtplib s = smtplib.SMTP(localhost)

Re: Python self-evaluating strings

2008-01-29 Thread Ant
In the spirit of Simple is better than complex. and totally bypassing the intention of quines (though not necessarily the definition): --- probably_not_a_real_quine.py import sys for line in open(sys.argv[0]): print line, -- ;-) -- Ant. --

Re: Python Standardization: Wikipedia entry

2008-01-29 Thread Terry Reedy
Roy Smith [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | But, surely Python has plenty of implementation defined aspects. | Especially in the libraries. I personally do not consider the libraries as part of the language (as opposed to the distribution) and was not referring to

Re: Encryption Recommendation

2008-01-29 Thread Paul Rubin
Michael Ströder [EMAIL PROTECTED] writes: But if the password checking is done with a challenge-response mechanism (e.g. HTTP-Digest Auth or SASL with DIGEST-MD5) it's required that the instance checking the password has the clear-text password available. So reversible encryption for storing

Re: optional static typing for Python

2008-01-29 Thread Ben Finney
Russ P. [EMAIL PROTECTED] writes: I would just like to thank you for reminding me about what losers hang out perpetually on sites like this one, thinking they are in some kind of real community. Being reminded of that will help prevent me from becoming such a loser myself. No, I didn't say

refcount

2008-01-29 Thread Simon Pickles
Hi, Is is possible to access the refcount for an object? Ideally, I am looking to see if I have a refcount of 1 before calling del Thanks Simon -- Linux Counter: User# 424693 -- http://mail.python.org/mailman/listinfo/python-list

Re: validate string is valid maths

2008-01-29 Thread Matthew_WARREN
It was a very loosely thought out problem, and my Maths isn't good enough to define 'sane' rules for collapsing the signs/operators to make a sensible expression; so take my constraints with a pinch of salt. I guess a better way of putting it may be - now it has been pointed out that 8+++9

Re: Error in parsing XML for following test data

2008-01-29 Thread Stefan Behnel
abhishek wrote: I am having problem parsing following data set from XML. Please provide hints on how to rectify this problem. I am using python2.4 version this is te test data that i am using -- 1!!!11 2@@@22 3###33 4$$$44 [...] How

Error in parsing XML for following test data

2008-01-29 Thread abhishek
Hello group, I am having problem parsing following data set from XML. Please provide hints on how to rectify this problem. I am using python2.4 version this is te test data that i am using -- 1!!!11 2@@@22 3###33 4$$$44 5%%%55

Re: py3k feature proposal: field auto-assignment in constructors

2008-01-29 Thread coldpizza
Hi, I appreciate everyone's feedback on the topic. Having reflected on what has been said here, I now realize that creating more complexity is not the way to go. I would rather favor something that relies on existing language features, something like the default keyword argument assignment in

Re: refcount

2008-01-29 Thread Duncan Booth
Simon Pickles [EMAIL PROTECTED] wrote: Is is possible to access the refcount for an object? import sys sys.getrefcount(42) 6 Ideally, I am looking to see if I have a refcount of 1 before calling del That's a pointless exercise: you probably don't understand what del does. All that del does

Re: REALLY simple xml reader

2008-01-29 Thread Stefan Behnel
Ricardo Aráoz wrote: What about : doc = moo bar99/bar /moo foo bar42/bar /foo That's not an XML document, so what about it? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Pydev 1.3.12 Released

2008-01-29 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.3.12 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions:

Re: Executing other python code

2008-01-29 Thread Diez B. Roggisch
Tim Rau wrote: I'm working on a game, and I'd like players to be able to define thier ships with scripts. Naturally, I don't want to give them the entire program as thier romping ground. I would like to invoke a seperate interpreter for these files, and give it a limited subset of the

Re: extending Python - passing nested lists

2008-01-29 Thread Christian Meesters
Thanks. Point is that all such approaches would require lots(!) of calls to the Python API - a way by which I won't gain the desired speed. I've tried pyrex and the corresponding C-file is so convoluted with dummy variables, incrementing decrementing references, and other stuff, that I want to

Changing module variables.

2008-01-29 Thread Albert van der Horst
I have made a sudoku solver, and discovered I simply can turn it into a hexadoku solver, like so: ___ # sudoku solver using sets import sudoku sudoku.symbols=0123456789ABCDEF sudoku.size=16 sudoku.sqs=4 # square root of size . ___ Example

Re: refcount

2008-01-29 Thread Benjamin
On Jan 29, 5:46 am, Christian Heimes [EMAIL PROTECTED] wrote: Simon Pickles wrote: Hi, Is is possible to access the refcount for an object? Ideally, I am looking to see if I have a refcount of 1 before calling del Help on built-in function getrefcount in module sys: getrefcount(...)

MySQLdb

2008-01-29 Thread [EMAIL PROTECTED]
hello, i have problem manipulating mySQL data. When i add values in a Table, i can recieve them instantly but when i check the table from another script, the new values dont exist. i'm not experienced in sql dbses so the problem might be something outside python. example (i do this to add

Mx.ODBC insert error

2008-01-29 Thread Greg Corradini
Hello, I've never gotten this traceback error before using mx.ODBC. Any ideas about resolving this issue? The statement and the error it generates are listed below. curse.execute(Insert into FHWA_StandSamp_2008(LRS_ID_NEW) values('040210') where LRS_ID = '0403700010') Traceback (most recent

Re: extending Python - passing nested lists

2008-01-29 Thread Christian Meesters
You didn't mention speed in your original post. Sorry, perhaps I considered this self-evident - which it is, of course, not. What about using array.array? Unless I am mistaken, these are just a thin wrapper around normal C arrays. The algorithm I want to implement requires several million

Re: optional static typing for Python

2008-01-29 Thread Chris Mellon
On Jan 28, 2008 10:31 AM, John Nagle [EMAIL PROTECTED] wrote: Arnaud Delobelle wrote: On Jan 27, 11:00 pm, Russ P. [EMAIL PROTECTED] wrote: On Jan 27, 2:49 pm, André [EMAIL PROTECTED] wrote: Perhaps this:http://www.python.org/dev/peps/pep-3107/mightbe relevant? André Thanks. If I read

runscript module, where are the docs...

2008-01-29 Thread glomde
Hi! I am going through some code and found import runscript BUT I cant find and information about this module. I searched Google did a grep in the /usr/lib/python directory. What is the purpose of this module and where can I find information about it. Or the source. Best regards, Toni --

Reflection and aspect programming in Python

2008-01-29 Thread Jean-François Houzard
Hello, I'm a student at UCL Belgium and I have to write a paper about reflection and introspection in Python. It is somewhat difficult to find advanced information about reflection in Python, not only introspection but also the other sides of reflection. I'm using the book: Programming Python,

Re: Removal of element from list while traversing causes the next element to be skipped

2008-01-29 Thread [EMAIL PROTECTED]
On Jan 29, 8:34 am, William McBrine [EMAIL PROTECTED] wrote: Look at this -- from Python 2.5.1: a = [1, 2, 3, 4, 5] for x in a: ... if x == 3: ... a.remove(x) ... print x ... 1 2 3 5 a [1, 2, 4, 5] Sure, the resulting list is correct. But 4 is never printed

RE: Python noob SOS (any [former?] Perlheads out there?)

2008-01-29 Thread Reedick, Andrew
-Original Message- From: [EMAIL PROTECTED] [mailto:python- [EMAIL PROTECTED] On Behalf Of kj Sent: Tuesday, January 29, 2008 11:39 AM To: python-list@python.org Subject: Python noob SOS (any [former?] Perlheads out there?) For many months now I've been trying to learn Python,

Re: Removal of element from list while traversing causes the next element to be skipped

2008-01-29 Thread Berteun Damman
On Tue, 29 Jan 2008 16:34:17 GMT, William McBrine [EMAIL PROTECTED] wrote: Look at this -- from Python 2.5.1: a = [1, 2, 3, 4, 5] for x in a: ... if x == 3: ... a.remove(x) ... print x ... 1 2 3 5 a [1, 2, 4, 5] You have to iterate over a copy of 'a', so for x in

Re: Module/package hierarchy and its separation from file structure

2008-01-29 Thread Carl Banks
On Jan 29, 7:48 am, Peter Schuller [EMAIL PROTECTED] wrote: You can also put, in animal/__init__.py: from monkey import Monkey and now you can refer to it as org.lib.animal.Monkey, but keep the implementation of Monkey class and all related stuff into .../animal/monkey.py The problem

Re: Python Standardization: Wikipedia entry

2008-01-29 Thread John Nagle
Paddy wrote: I would value the opinion of fellow Pythoneers who have also contributed to Wikipedia, on the issue of Is Python Standardized. Specifically in the context of this table: http://en.wikipedia.org/wiki/Comparison_of_programming_languages#General_comparison (Comparison of

Re: MySQLdb

2008-01-29 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: hello, i have problem manipulating mySQL data. When i add values in a Table, i can recieve them instantly but when i check the table from another script, the new values dont exist. i'm not experienced in sql dbses so the problem might be something outside python.

Re: refcount

2008-01-29 Thread Mel
Benjamin wrote: On Jan 29, 5:46 am, Christian Heimes [EMAIL PROTECTED] wrote: Simon Pickles wrote: Hi, Is is possible to access the refcount for an object? Ideally, I am looking to see if I have a refcount of 1 before calling del Help on built-in function getrefcount in module sys:

Re: Terse Syntax through External Methods

2008-01-29 Thread Bruno Desthuilliers
Jens a écrit : On Jan 25, 3:19 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: Jens schrieb: Hello Everyone I'm newbie to Zope and i have a few questions regarding external methods. (snip) This doesn't work because because the method doesn't have access to the environment. If it has to

Trouble loading dll via ctypes

2008-01-29 Thread subopt inTheVicinityOf geemail.com
I'm trying to load a dll via ctypes by doing this: cdll.LoadLibrary('/path/to/mylib.so') But i'm getting this: /path/to/mylib.so: cannot open shared object file: No such file or directory What am i doing wrong? The dll in question is in a directory mounted via NSF, but no part of

Re: Problems installing Python on server

2008-01-29 Thread jim-on-linux
On Tuesday 29 January 2008 01:20, Devraj wrote: Also be careful and setup all the paths that is required for compiling various Python modules etc. On Jan 29, 8:28 am, Yansky [EMAIL PROTECTED] wrote: I asked my hosting company if they would upgrade Python on my server to the latest

Re: Executing other python code

2008-01-29 Thread Martin Skou
Over-simplified yes, but it will work! Python is beautiful :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Standardization: Wikipedia entry

2008-01-29 Thread Roy Smith
In article [EMAIL PROTECTED], Terry Reedy [EMAIL PROTECTED] wrote: Roy Smith [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | But, surely Python has plenty of implementation defined aspects. | Especially in the libraries. I personally do not consider the libraries as part of

Re: Terse Syntax through External Methods

2008-01-29 Thread Jens
On Jan 25, 3:19 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: Jens schrieb: Hello Everyone I'm newbie to Zope and i have a few questions regarding external methods. What i wan't to do is provide a terse syntax for converting urls to special tracking urls: dtml-var

Re: [HELP] SMTPlib not sending my mail

2008-01-29 Thread ashok raavi
i checked it after your mail.. it is giving the following warning: no entropy for TLS key generation: disabling TLS support which was addressed here http://www.howtoforge.com/forums/showthread.php?t=781; after adding the line tlsmgr unix - - n 1000? 1 tlsmgr to /etc/postfix/master.cf it

Extending the import mechanism - what is recommended?

2008-01-29 Thread dbr517
I need to extend the import mechanism to support another file type. I've already written the necessary C library to read the file and return a python code object. I found one example which just sub-classed imputil.ImportManager like this: from myLib import pye_code as pye_code class

Re: extending Python - passing nested lists

2008-01-29 Thread Arnaud Delobelle
On Jan 29, 12:48 pm, Christian Meesters [EMAIL PROTECTED] wrote: Think, that I'm still at the wrong track. Point is that I cannot find any examples and don't know where to start here. Perhaps my problem boils down to two questions: I'd like to pass lists (in some cases nested ones) from Python

Re: Zipfile content reading via an iterator?

2008-01-29 Thread Tim Chase
I'm dealing with several large items that have been zipped up to get quite impressive compression. However, uncompressed, they're large enough to thrash my memory to swap and in general do bad performance-related things. I'm trying to figure out how to produce a file-like iterator out of

Re: Module/package hierarchy and its separation from file structure

2008-01-29 Thread Peter Schuller
You can reassign the class's module: from org.lib.animal.monkey import Monkey Monkey.__module__ = 'org.lib.animal' (Which, I must admit, is not a bad idea in some cases.) Is there a sense whether this is truly a supported way of doing this, in terms of not running into various unintended

Re: extending Python - passing nested lists

2008-01-29 Thread Christian Meesters
Think, that I'm still at the wrong track. Point is that I cannot find any examples and don't know where to start here. Perhaps my problem boils down to two questions: I'd like to pass lists (in some cases nested ones) from Python to C and convert those Python-lists to C-arrays (e. g. of doubles).

Re: REALLY simple xml reader

2008-01-29 Thread Ricardo Aráoz
Diez B. Roggisch wrote: Simon Pickles schrieb: Hi Can anyone suggest a really simple XML reader for python? I just want to be able to do something like this: xmlDoc = xml.open(file.xml) element = xmlDoc.GetElement(foo/bar) ... to read the value of: foo bar42/bar /foo Since

Re: Just for fun: Countdown numbers game solver

2008-01-29 Thread Arnaud Delobelle
On Jan 29, 9:02 am, [EMAIL PROTECTED] wrote: Oops I sent too quickly... If you've found an efficient way to walk through the possible solutions only once, then -  I expect that yours will be faster -  and well done! I guess I should try to understand your code... My code is quite naive

Re: Trying to understand Python web-development

2008-01-29 Thread Joe Riopel
On Jan 29, 2008 12:11 PM, walterbyrd [EMAIL PROTECTED] wrote: I am not really sure about what wsgi is supposed to accomplish. This will explain WSGI: http://www.python.org/dev/peps/pep-0333/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Removal of element from list while traversing causes the next element to be skipped

2008-01-29 Thread Santiago Romero
Look at this -- from Python 2.5.1: a = [1, 2, 3, 4, 5] for x in a: ... if x == 3: ... a.remove(x) ... print x Well ... you could use: for i in range(len(a)-1, -1, -1): ...print a[i] ...if a[i] == 3: del a[i] ... 5 4 3 2 1 print a [1, 2, 4, 5] Bye. --

Re: Trying to understand Python web-development

2008-01-29 Thread Bruno Desthuilliers
walterbyrd a écrit : I don't know much php either, but running a php app seems straight forward enough. Mmm... As long as the whole system is already installed and connfigured, *and* matches your app's expectations, kind of, yes. Python seems to always use some sort of development

Re: regular expression negate a word (not character)

2008-01-29 Thread Greg Bacon
In article [EMAIL PROTECTED], Dr.Ruud [EMAIL PROTECTED] wrote: : I negated the test, to make the regex simpler: [...] Yes, your approach is simpler. I assumed from the need it all in one pattern constraint that the OP is feeding the regular expression to some other program that is looking

Re: Python noob SOS (any [former?] Perlheads out there?)

2008-01-29 Thread Bruno Desthuilliers
kj a écrit : For many months now I've been trying to learn Python, but I guess I'm too old a dog trying to learn new tricks... For better or worse, I'm so used to Perl when it comes to scripting, that I'm just having a very hard time getting a hang of The Python Way. (snip) I'd written a

Re: MySQLdb

2008-01-29 Thread Tim Chase
i have problem manipulating mySQL data. When i add values in a Table, i can recieve them instantly but when i check the table from another script, the new values dont exist. Depending on your transaction settings (both on your mysql connection object in code, and the engine used for the

Re: Problem with Tkinter scrollbar callback

2008-01-29 Thread Ivan Van Laningham
Nope: 'repeatdelay': ('repeatdelay', 'repeatDelay', 'RepeatDelay', '300', '300'), And even after I set it, it looks funny: 'repeatdelay': ('repeatdelay', 'repeatDelay', 'RepeatDelay', '300', '1000'), And when I try it with the new repeatdelay (1000), the only thing that has changed is that it

Re: REALLY simple xml reader

2008-01-29 Thread Stefan Behnel
Hi, Ricardo Aráoz wrote: I don't know zit about xml, but I might need to, and I am saving the thread for when I need it. So I looked around and found some 'real' XML document (see below). The question is, how to access amounts from debits (any category) but not deposits. doc = ?xml

Re: extending Python - passing nested lists

2008-01-29 Thread Arnaud Delobelle
On Jan 29, 1:22 pm, Christian Meesters [EMAIL PROTECTED] wrote: Thanks. Point is that all such approaches would require lots(!) of calls to the Python API - a way by which I won't gain the desired speed. You didn't mention speed in your original post. What about using array.array? Unless I am

Re: Problem with Tkinter scrollbar callback

2008-01-29 Thread Ivan Van Laningham
No Joy. Waits the 1 second, then clicks the button once per second until the limit's reached. Sigh. Metta, Ivan On Jan 29, 2008 10:20 AM, Russell E Owen [EMAIL PROTECTED] wrote: Nope: 'repeatdelay': ('repeatdelay', 'repeatDelay', 'RepeatDelay', '300', '300'), And even after I set it, it

Re: Removal of element from list while traversing causes the next element to be skipped

2008-01-29 Thread Berteun Damman
On Tue, 29 Jan 2008 09:23:16 -0800 (PST), [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: If you're going to delete elements from a list while iterating over it, then do it in reverse order: Why so hard? Reversing it that way creates a copy, so you might as well do: a = [ 98, 99, 100 ] for i, x

Re: refcount

2008-01-29 Thread Christian Heimes
Simon Pickles wrote: Hi, Is is possible to access the refcount for an object? Ideally, I am looking to see if I have a refcount of 1 before calling del Help on built-in function getrefcount in module sys: getrefcount(...) getrefcount(object) - integer Return the reference count of

Re: Python noob SOS (any [former?] Perlheads out there?)

2008-01-29 Thread Paddy
On Jan 29, 4:39 pm, kj [EMAIL PROTECTED] wrote: It's not the Python syntax that I'm having problems with, but rather with larger scale issues such as the structuring of packages, techniques for code reuse, test suites, the structure of distributions,... Python and Perl seem to come from

Re: Python noob SOS (any [former?] Perlheads out there?)

2008-01-29 Thread Rick Dooling
On Jan 29, 10:39 am, kj [EMAIL PROTECTED] wrote: I'd written a Perl module to facilitate the writing of scripts. It contained all my boilerplate code for parsing and validating command-line options, generating of accessor functions for these options, printing of the help message and of the

Re: Just for fun: Countdown numbers game solver

2008-01-29 Thread Arnaud Delobelle
On Jan 29, 9:02 am, [EMAIL PROTECTED] wrote: If you've found an efficient way to walk through the possible solutions only once As discussed earlier in this thread, the definition of 'only once' is not as clear cut as one would first think (see Terry's thoughts on this). -- Arnaud --

Implementation of IBuyable or Interface?

2008-01-29 Thread Marcelo de Moraes Serpa
Hello! It's more a design question than anything python specific. If anyone could help me, I would be grateful. If it's not the right place for this subject, please advise. I've got a IBuyable interface. The app can sell both Products and Services (Both Buyables). I'm not sure if Product and

Re: Error in parsing XML for following test data

2008-01-29 Thread Paul McGuire
On Jan 29, 4:46 am, Stefan Behnel [EMAIL PROTECTED] wrote: How is this related to XML? Stefan I guess that's what makes so **nasty**! -- Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Module/package hierarchy and its separation from file structure

2008-01-29 Thread Peter Schuller
You can also put, in animal/__init__.py: from monkey import Monkey and now you can refer to it as org.lib.animal.Monkey, but keep the implementation of Monkey class and all related stuff into .../animal/monkey.py The problem is that we are now back to the identity problem. The class

Re: Executing other python code

2008-01-29 Thread Arnaud Delobelle
On Jan 29, 12:18 am, Tim Rau [EMAIL PROTECTED] wrote: I'm working on a game, and I'd like players to be able to define thier ships with scripts. Naturally, I don't want to give them the entire program as thier romping ground. I would like to invoke a seperate interpreter for these files, and

Re: REALLY simple xml reader

2008-01-29 Thread Ricardo Aráoz
What about : doc = moo bar99/bar /moo foo bar42/bar /foo That's not an XML document, so what about it? Stefan -- Ok Stefan, I will pretend it was meant in good will. I don't know zit about xml, but I might need to, and I am saving

Re: Executing other python code

2008-01-29 Thread Stefan Behnel
Hi, Tim Rau wrote: I'm working on a game, and I'd like players to be able to define thier ships with scripts. Naturally, I don't want to give them the entire program as thier romping ground. I would like to invoke a seperate interpreter for these files, and give it a limited subset of the

Re: Intra-package References?? (again)

2008-01-29 Thread Ron Adam
[EMAIL PROTECTED] wrote: Hi Python list, I have been struggleling with this before, but have never been able to find a good solution. The thing I dont understand is, I follow the guide here: http://docs.python.org/tut/node8.html#SECTION00842 And have the same setup as the

Re: extending Python - passing nested lists

2008-01-29 Thread Mel
Christian Meesters wrote: You didn't mention speed in your original post. Sorry, perhaps I considered this self-evident - which it is, of course, not. What about using array.array? Unless I am mistaken, these are just a thin wrapper around normal C arrays. The algorithm I want to

Removal of element from list while traversing causes the next element to be skipped

2008-01-29 Thread William McBrine
Look at this -- from Python 2.5.1: a = [1, 2, 3, 4, 5] for x in a: ... if x == 3: ... a.remove(x) ... print x ... 1 2 3 5 a [1, 2, 4, 5] Sure, the resulting list is correct. But 4 is never printed during the loop! What I was really trying to do was this: apps = [name for

Python noob SOS (any [former?] Perlheads out there?)

2008-01-29 Thread kj
For many months now I've been trying to learn Python, but I guess I'm too old a dog trying to learn new tricks... For better or worse, I'm so used to Perl when it comes to scripting, that I'm just having a very hard time getting a hang of The Python Way. It's not the Python syntax that I'm

Re: Removal of element from list while traversing causes the next element to be skipped

2008-01-29 Thread imageguy
On Jan 29, 12:34 pm, William McBrine [EMAIL PROTECTED] wrote: Look at this -- from Python 2.5.1: a = [1, 2, 3, 4, 5] for x in a: ...     if x == 3: ...         a.remove(x) ...     print x ... 1 2 3 5 a [1, 2, 4, 5] Sure, the resulting list is correct. But 4 is never printed

Trying to understand Python web-development

2008-01-29 Thread walterbyrd
I don't know much php either, but running a php app seems straight forward enough. Python seems to always use some sort of development environment vs production environment scheme. For development, you are supposed to run a local browser and load 127.0.0.1:5000 - or something like that. Then to

Telnet Program

2008-01-29 Thread [EMAIL PROTECTED]
I am having some issues writing a telnet program, using telnetlib. I am not sure if it is the telnet on the connections end or it is my program. A little background, when I log in straight from the Linux Command prompt. The only thing I get is a blinking cursor. Then I type in my command 'FOO'

Re: object vs class oriented -- xotcl

2008-01-29 Thread William Pursell
On Jan 24, 9:16 pm, Guilherme Polo [EMAIL PROTECTED] wrote: 2008/1/24, William Pursell [EMAIL PROTECTED]: referring to changing an objects class Can I do it in Python? class A(object): pass class B(object): pass a = A() a.__class__ = B That ? Maybe you meant something else. That is

Re: ISO with timezone

2008-01-29 Thread nik
On Jan 29, 10:56 am, nik [EMAIL PROTECTED] wrote: Thanks, that does help and now I have: from datetime import datetime, tzinfo, timedelta import time class TZ(tzinfo): ...def utcoffset(self,dt): return timedelta(seconds=time.timezone) ... print

Re: noob stuck on reading double

2008-01-29 Thread Joe Riopel
On Jan 29, 2008 1:35 PM, Hannah Drayson [EMAIL PROTECTED] wrote: It imports as a string of rubbish... i.e. open file 'data.bin', mode 'rb' at 0x5a2a8 text = f.read() print text ?F?C??y??? @[EMAIL PROTECTED]@???/???8[EMAIL PROTECTED]/[EMAIL

typename

2008-01-29 Thread Neal Becker
I want python code that given an instance of a type, prints the type name, like: typename (0) - 'int' I know how to do this with the C-api, (o-tp_name), but how do I do it from python? type(0) prints type 'int', not really what I wanted. -- http://mail.python.org/mailman/listinfo/python-list

Re: Error in parsing XML for following test data

2008-01-29 Thread John Machin
On Jan 29, 9:29 pm, abhishek [EMAIL PROTECTED] wrote: Hello group, I am having problem parsing following data set from XML. Please provide hints on how to rectify this problem. You have provided no hints on what your problem is. What output do you want? What have you tried? What output and/or

Decision (if, else) routine is not working as intended with CGI module

2008-01-29 Thread epsilon
All: I'm running into trouble figuring this one out. It seems that my decision routine is not working as intended. Does anyone know why my output continues to utilize the else portion of the routine. Thank you, Christopher ++ #!/usr/bin/python import cgi print Content-type:

Re: breaking out of outer loops

2008-01-29 Thread pataphor
On Tue, 29 Jan 2008 11:51:04 -0800 (PST) [EMAIL PROTECTED] wrote: Any elegant way of breaking out of the outer for loop than below, I seem to have come across something, but it escapes me for i in outerLoop: for j in innerLoop: if condition: break else:

Re: Fwd: Help! - Invoke setup.py file

2008-01-29 Thread Gabriel Genellina
En Mon, 21 Jan 2008 07:38:15 -0200, Vikas Jadhav [EMAIL PROTECTED] escribi�: We have setup of SVGMath* 0.3.2 (Converter- Mathml 2.0 coding to SVG). The setup folder contains setup.py file but we are not able to initiate this file. Kindly help us, resolution to this query will be

Re: Reflection and aspect programming in Python

2008-01-29 Thread Gabriel Genellina
En Tue, 29 Jan 2008 14:42:55 -0200, Jean-François Houzard [EMAIL PROTECTED] escribi�: I'm a student at UCL Belgium and I have to write a paper about reflection and introspection in Python. It is somewhat difficult to find advanced information about reflection in Python, not only

Re: optional static typing for Python

2008-01-29 Thread Kay Schluehr
On 29 Jan., 17:00, Chris Mellon [EMAIL PROTECTED] wrote: Given the difficulty of statically analyzing Python, and the limitations you need to add for either static typing or type inference to be practical, I think that the real future for faster Python code is JIT, not static optimizations.

Re: Removal of element from list while traversing causes the next element to be skipped

2008-01-29 Thread Duncan Booth
Berteun Damman [EMAIL PROTECTED] wrote: On Tue, 29 Jan 2008 09:23:16 -0800 (PST), [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: If you're going to delete elements from a list while iterating over it, then do it in reverse order: Why so hard? Reversing it that way creates a copy, so you might

Re: runscript module, where are the docs...

2008-01-29 Thread Gabriel Genellina
En Tue, 29 Jan 2008 13:48:58 -0200, glomde [EMAIL PROTECTED] escribi�: I am going through some code and found import runscript BUT I cant find and information about this module. I searched Google did a grep in the /usr/lib/python directory. What is the purpose of this module and where can

Re: Zipfile content reading via an iterator?

2008-01-29 Thread Gabriel Genellina
En Tue, 29 Jan 2008 11:06:12 -0200, Tim Chase [EMAIL PROTECTED] escribi�: Just to follow up on this, I dropped the the 2.6 version of zipfile.py in my project folder (where the machine is currently running Python2.4), used the ZipFile.open() and it worked fine. [...] Anyways, thanks to

Re: Module/package hierarchy and its separation from file structure

2008-01-29 Thread Robert Kern
Carl Banks wrote: On Jan 29, 7:48 am, Peter Schuller [EMAIL PROTECTED] wrote: You can also put, in animal/__init__.py: from monkey import Monkey and now you can refer to it as org.lib.animal.Monkey, but keep the implementation of Monkey class and all related stuff into .../animal/monkey.py

Re: Extending the import mechanism - what is recommended?

2008-01-29 Thread Steve Holden
[EMAIL PROTECTED] wrote: I need to extend the import mechanism to support another file type. I've already written the necessary C library to read the file and return a python code object. I found one example which just sub-classed imputil.ImportManager like this: from myLib import pye_code as

Re: Telnet Program

2008-01-29 Thread Rob Wolfe
[EMAIL PROTECTED] [EMAIL PROTECTED] writes: I am having some issues writing a telnet program, using telnetlib. I am not sure if it is the telnet on the connections end or it is my program. A little background, when I log in straight from the Linux Command prompt. The only thing I get is a

Re: Python noob SOS (any [former?] Perlheads out there?)

2008-01-29 Thread Wildemar Wildenburger
kj wrote: Is there any good reading (to ease the transition) for Perl programmers trying to learn Python? www.diveintopython.org While it is a bit dated by now (Python 2.2), that thing worked wonders for me. Shows you Python in action and presents a fair amount of its philosophy along the

Re: Mx.ODBC insert error

2008-01-29 Thread John Machin
On Jan 30, 3:27 am, Greg Corradini [EMAIL PROTECTED] wrote: Hello, I've never gotten this traceback error before using mx.ODBC. traceback error?? I see no problem with the traceback. Any ideas about resolving this issue? The statement and the error it generates are listed below. The error

Re: extending Python - passing nested lists

2008-01-29 Thread Arnaud Delobelle
On Jan 29, 4:00 pm, Christian Meesters [EMAIL PROTECTED] wrote: You didn't mention speed in your original post. Sorry, perhaps I considered this self-evident - which it is, of course, not. What about using array.array?  Unless I am mistaken, these are just a thin wrapper around normal C

noob stuck on reading double

2008-01-29 Thread Hannah Drayson
Hi all, I have a .bin file which python just won't play ball with- Does anyone know what I'm doing wrong- is it simply incompatible? I've read it fine using a C program - its 113 doubleword fields- apparently its possible to handle these in python in a very similar way to C. I can provide the c

  1   2   >