filelike 0.3.0

2009-01-16 Thread Ryan Kelly
Hi All, I'm pleased to announce the v0.3.0 release of filelike, a module for easy creation and manipulation of objects that provide a rich file-like interface. New in this version we have: * support for seek() and tell() in FileLikeBase * much better support for intermingling reads and

Re: Suggested improvements for IDLE (non-official)

2009-01-16 Thread Terry Reedy
Tim H wrote: r wrote: On Jan 14, 4:43 pm, Terry Reedy tjre...@udel.edu wrote: OFF-TOPIC:(but related) What is the state of Tkinter at this point. Is an active effort under way to port TK 8.5 into Python? Tkinter and IDLE are very important to Python, but i understand there are much more

Re: Does Python really follow its philosophy of Readability counts?

2009-01-16 Thread Paul Rubin
Terry Reedy tjre...@udel.edu writes: Have you looked at Tim Sweeney's talk that I mentioned in another post? http://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/s... I did. He gives a really nice use case for Python's ability to dynamically modify classes imported from a

Re: Alphametric fun with Python

2009-01-16 Thread bearophileHUGS
Terry Reedy: It illustrates well the point you intended. I don't know what my point was. A suggestion: with that solver, to find solution in a faster way you have to write many equations. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python really follow its philosophy of Readability counts?

2009-01-16 Thread Hendrik van Rooyen
James Mills prolo...tcircuit.net.au wrote: At the most basic level do you really think a machine really cares about whether -you- the programmer has illegally accessed something you shouldn't have ? Yes it does - this is exactly why some chips have supervisor and user modes - to keep the

Re: Convention vs. fascism

2009-01-16 Thread Hendrik van Rooyen
Aaron Brady cas@gmail.com wrote: On Jan 15, 6:41 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Fri, 16 Jan 2009 10:24:19 +1100, Ben Finney wrote: Steven D'Aprano st...@remove-this-cybersource.com.au writes: On Fri, 16 Jan 2009 07:58:49 +1100, Ben Finney wrote:

Re: spam on the list - how are things now?

2009-01-16 Thread Hendrik van Rooyen
Terry Reedy tjre...@udel.edu wrote: James Mills wrote: On Fri, Jan 16, 2009 at 1:30 PM, s...@pobox.com wrote: We've been running SpamBayes on the news-to-mail gateway on mail.python.org for a couple weeks now. To me it seems like the level of spam leaking onto the list has dropped way

Re: [Python-Dev] multiprocessing vs. distributed processing

2009-01-16 Thread James Mills
On Fri, Jan 16, 2009 at 6:30 PM, Matthieu Brucher matthieu.bruc...@gmail.com wrote: 2009/1/16 James Mills prolo...@shortcircuit.net.au: I've noticed over the past few weeks lots of questions asked about multi-processing (including myself). Funny, I was going to blog about this, but not just

Re: Convention vs. fascism

2009-01-16 Thread Steven D'Aprano
On Fri, 16 Jan 2009 10:03:28 +0200, Hendrik van Rooyen wrote: Oh come on you lot - you are carrying on as if Diez were wearing his skull socks again - do me a favour and give him a break! Well, for what it's worth, I should say one final thing: I didn't disagree with what Diez said, only the

Re: reverse dict lookup Relation class

2009-01-16 Thread Aaron Brady
On Jan 14, 7:04 pm, Chris Rebert c...@rebertia.com wrote: On Wed, Jan 14, 2009 at 4:30 PM, Aaron Brady castiro...@gmail.com wrote: Hi, this is a continuation of something that comes up now and again about reverse lookups on dictionaries, as well as a follow-up to my pursuit of a Relation

RE: problem in implementing multiprocessing

2009-01-16 Thread gopal mishra
I create two heavy objects sequentially without using multipleProcessing then creation of the objects takes 2.5 sec.if i create these two objects in separate process then total time is 6.4 sec. i am thinking it is happening due to the pickling and unpickling of the objects.if i am right then what

Re: Does Python really follow its philosophy of Readability counts?

2009-01-16 Thread Éric Daigneault
Hendrik van Rooyento keep the monkeys away from the typewriter. Love it... just fully describes why we should keep some parts hidden from the pointyHairedBossHired Code monkeys... I'd like to think I know what I am doing... can't say the same of all people that have access to the code

Re: reverse dict lookup Relation class

2009-01-16 Thread Aaron Brady
On Jan 14, 7:54 pm, MRAB goo...@mrabarnett.plus.com wrote: Aaron Brady wrote: Hi, this is a continuation of something that comes up now and again about reverse lookups on dictionaries, as well as a follow-up to my pursuit of a Relation class from earlier. For a reverse lookup, you just

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-16 Thread Peter Otten
Terry Reedy wrote: Peter Otten wrote: List comprehensions delete the helper variable after completion: I do not believe they did in 2.4. Not sure of 2.5. As Mario said, 2.4, 2.5, and 2.6 all show the same behaviour. There is certainly a very different implementation in 3.0 and, I

Re: lazy evaluation is sometimes too lazy... help please.

2009-01-16 Thread James Stroud
Ken Pu wrote: Hi, below is the code I thought should create two generates, it[0] = 0,1,2,3,4,5, and it[1] = 0,10,20,30,..., but they turn out to be the same!!! from itertools import * itlist = [0,0] for i in range(2): itlist[i] = (x+(i*10) for x in count()) print what's in the bags: print

Re: Possible bug in Tkinter - Python 2.6

2009-01-16 Thread Eric Brunel
On Thu, 15 Jan 2009 19:09:00 +0100, José Matos jaoma...@gmail.com wrote: On Thursday 15 January 2009 15:28:36 r wrote: First of all be very careful using from module import * or you will have name conflicts. Tkinter is made to be imported this way and i do it all the time. for the others do.

Re: Possible bug in Tkinter - Python 2.6

2009-01-16 Thread Eric Brunel
On Thu, 15 Jan 2009 23:49:22 +0100, Terry Reedy tjre...@udel.edu wrote: Eric Brunel wrote: [snip] And BTW, if this is actually a bug, where can I report it? bugs.python.org Thanks. I reported the problem. -- python -c print ''.join([chr(154 - ord(c)) for c in

Re: Client Socket Connection to Java server

2009-01-16 Thread bieffe62
On 16 Gen, 08:10, TechieInsights gdoerm...@gmail.com wrote: I am having problems with a socket connection to a Java server.  In java I just open the socket, pass the length and then pass the bits across the socket. I created a socket object: import socket class MySocket:         def

Re: Python 3 isinstance

2009-01-16 Thread Duncan Booth
Carl Banks pavlovevide...@gmail.com wrote: On Jan 15, 1:08 pm, Duncan Booth duncan.bo...@invalid.invalid wrote: Carl Banks pavlovevide...@gmail.com wrote: I don't see what the big deal is.  Right now isinstance accepts a typ e or a tuple of types.  The code could be changed to allow a

Re: Alphametric fun with Python

2009-01-16 Thread Terry Reedy
bearophileh...@lycos.com wrote: Terry Reedy: It illustrates well the point you intended. I don't know what my point was. I quoted and was responding to Raymond. A suggestion: with that solver, to find solution in a faster way you have to write many equations. I did... one for each

Re: lazy evaluation is sometimes too lazy... help please.

2009-01-16 Thread Michael Hartl
James Stroud schrieb: Ken Pu wrote: Hi, below is the code I thought should create two generates, it[0] = 0,1,2,3,4,5, and it[1] = 0,10,20,30,..., but they turn out to be the same!!! from itertools import * itlist = [0,0] for i in range(2): itlist[i] = (x+(i*10) for x in count()) print

Re: English-like Python

2009-01-16 Thread alex23
On Jan 16, 5:39 pm, Erik Max Francis m...@alcyone.com wrote: Inform 7 has some interesting ideas, but I think the general problem with English-like programming language systems is that once you get into the nitty gritty details, you end up having to know exactly the right things to type, This

Re: Does Python really follow its philosophy of Readability counts?

2009-01-16 Thread Terry Reedy
Paul Rubin wrote: Terry Reedy tjre...@udel.edu writes: Have you looked at Tim Sweeney's talk that I mentioned in another post? http://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/s... I did. He gives a really nice use case for Python's ability to dynamically modify classes

PyPlot

2009-01-16 Thread Shah Sultan Alam
Hi , I need Pyplot module , How to get and install ( plug in with my python 2.4 distribution ) !!! TIA. Shah. -- http://mail.python.org/mailman/listinfo/python-list

Problem using python C API

2009-01-16 Thread shi dingan
Hi, I'm trying to use the Python C API but I have a problem when importing my new module. Here is my (short) code: #include Python.h long sumList(PyObject *list) { int i, n; long total = 0; PyObject *item; n = PyList_Size(list); if (n 0) return NULL; for (i = 0; i n; i++) {

Re: Does Python really follow its philosophy of Readability counts?

2009-01-16 Thread Paul Rubin
Terry Reedy tjre...@udel.edu writes: If the library framework were written in Python, one would have a choice between creating a parallel class hierachy (through inheritance) that dupicates *every* class in the original hierachy and dynamically patching just those classes that need to be

Re: lazy evaluation is sometimes too lazy... help please.

2009-01-16 Thread Boris Borcic
The minimal correction, I guess, is to write itlist[i] = (x+(i*10) for i in [i] for x in count()) instead of itlist[i] = (x+(i*10) for x in count()) although itlist[i] = (x+(i*10) for i,s in (i,count()) for x in s) will better mimic generalizations in the sense that the minimal

Re: lazy evaluation is sometimes too lazy... help please.

2009-01-16 Thread Boris Borcic
itlist[i] = (x+(i*10) for i,s in (i,count()) for x in s) oops, that would be itlist[i] = (x+(i*10) for i,s in [(i,count())] for x in s) or equivalent, kind of ugly anyway. -- http://mail.python.org/mailman/listinfo/python-list

Re: lazy evaluation is sometimes too lazy... help please.

2009-01-16 Thread alex23
James Stroud jstr...@mbi.ucla.edu wrote: I'm going to get flamed pretty hard for this, but it doesn't seem to be the intuitive behavior to me either. Given this is the second time this issue has come up today, I'd have to agree with you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Ordering of urlencoded tuples incorrect

2009-01-16 Thread benlucas99
On Jan 16, 1:44 am, John Machin sjmac...@lexicon.net wrote: On Jan 16, 11:59 am, benluca...@googlemail.com wrote: I'm having problems with the ordering of the tuples produced by urllib.urlencode. Taking an example straight from the docs and so doing the following: What are the docs you

Re: reverse dict lookup Relation class

2009-01-16 Thread Steven D'Aprano
On Wed, 14 Jan 2009 16:30:36 -0800, Aaron Brady wrote: Hi, this is a continuation of something that comes up now and again about reverse lookups on dictionaries, as well as a follow-up to my pursuit of a Relation class from earlier. [...] What's the best way to construct this class? Or, do

Re: Python 3 isinstance

2009-01-16 Thread Steven D'Aprano
On Fri, 16 Jan 2009 09:58:53 +, Duncan Booth wrote: That still leaves the question whether anyone has ever actually taken advantage of this feature. You can do isinstance(x, (IntType, LongType, StringTypes)) but I didn't even know that StringTypes existed until a couple of moments ago,

multiprocessing question/error

2009-01-16 Thread Eduardo Lenz
Hi, I was using the former processing package with python 2.5 with no problems. After switching to python 2.6.1 I am having some problems with the same code. The problem seems to be related to the fact that I am using Pool.map with a bounded method, since it is inside a class. To clarify a

Re: lazy evaluation is sometimes too lazy... help please.

2009-01-16 Thread Steven D'Aprano
On Fri, 16 Jan 2009 02:51:43 -0500, Ken Pu wrote: Hi, below is the code I thought should create two generates, it[0] = 0,1,2,3,4,5, and it[1] = 0,10,20,30,..., but they turn out to be the same!!! [...] I see what Python is doing -- lazy evaluation doesn't evaluate (x+(i*10) for x in

Re: mimetypes oddity

2009-01-16 Thread Sion Arrowsmith
In article mailman.7301.1232043685.3487.python-l...@python.org, s...@pobox.com wrote: [mimetype weirdness reported] Sion Is this a bug? Might be. Can you file a bug report in the Python issue tracker with a small script that demonstrates the behavior? http://bugs.python.org/issue4963

Re: multiprocessing vs. distributed processing

2009-01-16 Thread Jesse Noller
On Fri, Jan 16, 2009 at 12:52 AM, James Mills prolo...@shortcircuit.net.au wrote: I've noticed over the past few weeks lots of questions asked about multi-processing (including myself). For those of you new to multi-processing, perhaps this thread may help you. Some things I want to start off

Integrating awk in Python

2009-01-16 Thread Alfons Nonell-Canals
Hello, I'm developing a software package using python. I've programmed all necessary tools but I have to use other stuff from other people. Most of these external scripts are developed using awk. At the beggining I thought to translate them and program them in python but I prefer to avoid it

Re: process/thread instances and attributes

2009-01-16 Thread Jesse Noller
On Thu, Jan 15, 2009 at 10:37 PM, James Mills prolo...@shortcircuit.net.au wrote: After some work ... I've taken Laszlo's suggestion of using Value (shared memory) objects to share state between the -pseudo- Process (manager) object and it's underlying multiprocessing.Process instance (and

Re: Integrating awk in Python

2009-01-16 Thread Willi Richert
Hi, take a look at the 5th link at http://tinyurl.com/7s8kfq It's called pyawk. Regards, wr Am Freitag, 16. Januar 2009 13:02:59 schrieb Alfons Nonell-Canals: Hello, I'm developing a software package using python. I've programmed all necessary tools but I have to use other stuff from other

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-16 Thread ajaksu
On Jan 16, 5:09 am, mario ruggier mario.rugg...@gmail.com wrote: Laboriously doing all these checks on each expr eval will be very performance heavy, so I hope to be able to limit access to all these more efficiently. Suggestions? None regarding the general issue, a try:except to handle this

Re: Does Python really follow its philosophy of Readability counts?

2009-01-16 Thread Steve Holden
Russ P. wrote: [...] I spent *way* too much time on that post. I really need to quit spending my time refuting the baloney that passes for wisdom here. He who cannot ignore baloney is doomed to refute it. regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC

vb2py status?

2009-01-16 Thread axtens
G'day everyone So is vb2py dead? If not, any idea when it'll support python 3? Kind regards, Bruce. -- http://mail.python.org/mailman/listinfo/python-list

Experiment: Church lists in Python

2009-01-16 Thread Ertugrul Söylemez
Hello there Pythoners, It was almost a week ago, when I got bored and thought, Python is quite a boring language, so I'd need to do some evil functional programming again. I thought, I'd share the result. ;) This time, I added a Church style representation for lists [1] to Python. The problem

Re: Soap Client

2009-01-16 Thread Doug
I believe that I have answered my own question. If anyone else is interested in what I did ... using iPython's code completion (. then hit tab tab) I noticed that msg had a _request attribute. I set that attribute to GetEventListMonth1/Month/GetEventList and that sent the message that I needed!

Re: English-like Python

2009-01-16 Thread John Roth
On Jan 16, 3:15 am, alex23 wuwe...@gmail.com wrote: On Jan 16, 5:39 pm, Erik Max Francis m...@alcyone.com wrote: Inform 7 has some interesting ideas, but I think the general problem with English-like programming language systems is that once you get into the nitty gritty details, you end

Re: Readline and Python 2.6.1 on a Mac

2009-01-16 Thread James Brady
s/bind ^I rl_complete/tab: complete/ http://tiswww.case.edu/php/chet/readline/readline.html --  Ned Deily,  n...@acm.org Perfect, thanks Ned! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3 isinstance

2009-01-16 Thread Duncan Booth
Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Fri, 16 Jan 2009 09:58:53 +, Duncan Booth wrote: That still leaves the question whether anyone has ever actually taken advantage of this feature. You can do isinstance(x, (IntType, LongType, StringTypes)) but I didn't even

Re: Does Python really follow its philosophy of Readability counts?

2009-01-16 Thread Luis Zarrabeitia
Quoting Russ P. russ.paie...@gmail.com: On Jan 15, 12:21 pm, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: Once again, the important point is that there's a *clear* distinction between interface and implementation, and that you *shouldn't* mess with implementation.

Re: Does Python really follow its philosophy of Readability counts?

2009-01-16 Thread mk
Paul Rubin wrote: 1) Parallelism. Commodity desktop computers now have 8 effective cpu cores or maybe even 16 soon (Mac Pro, Intel Core i7) but Python still has the evil GIL that forces all threads to run on one core. Java, Erlang, and Haskell (GHC) all beat Python in this area. By the time

Re: English-like Python

2009-01-16 Thread MRAB
[Hit Reply instead of Reply All. Sorry alex23.] alex23 wrote: On Jan 16, 5:39 pm, Erik Max Francis m...@alcyone.com wrote: Inform 7 has some interesting ideas, but I think the general problem with English-like programming language systems is that once you get into the nitty gritty details, you

Re: Client Socket Connection to Java server

2009-01-16 Thread MRAB
TechieInsights wrote: I am having problems with a socket connection to a Java server. In java I just open the socket, pass the length and then pass the bits across the socket. I created a socket object: import socket class MySocket: def __init__(self, host='localhost', port = 28192,

Re: Start two threads in same time

2009-01-16 Thread koranthala
On Jan 16, 7:36 pm, vedrandeko...@gmail.com wrote: Hello, Does anybody know how can I start two threads in same time? Regards, John Use threading module. Creating a new thread is as easy as -- --- import threading class

Re: Convention vs. fascism [OT]

2009-01-16 Thread Hendrik van Rooyen
Steven D'Aprano st...@remove-thisurce.com.au wrote: And... skull socks? Cool. Where can I get some? Don't you remember? - Google the group - there was some dust raised about them some time ago. I think he got them from KDW - Kaufhaus Der Welt aka Klau Dir Was :-) - Hendrik --

Re: Start two threads in same time

2009-01-16 Thread koranthala
On Jan 16, 7:46 pm, koranthala koranth...@gmail.com wrote: On Jan 16, 7:36 pm, vedrandeko...@gmail.com wrote: Hello, Does anybody know how can I start two threads in same time? Regards, John Use threading module. Creating a new thread is as easy as --

Re: Problem using python C API

2009-01-16 Thread Philip Semanchuk
On Jan 16, 2009, at 5:31 AM, shi dingan wrote: void initexample() { PyObject *m; m = Py_InitModule(example, exampleMethods); } When I try to import examplemodule, I obtain the following message: import examplemodule Traceback (most recent call last): File stdin, line 1, in ? ImportError:

Re: English-like Python

2009-01-16 Thread sturlamolden
On Jan 16, 8:39 am, Erik Max Francis m...@alcyone.com wrote: I was thinking of this as well when I saw his post. Inform 7 has some interesting ideas, but I think the general problem with English-like programming language systems is that once you get into the nitty gritty details, you end up

bubblefishymon

2009-01-16 Thread Andy Goldschmidt
Hi Guys I am trying to get bubblefishymon to work as a gdesklet. (app is written in python) The app seems to work, but it does display any water. I'm assuming its because it cant poll the network card etc. If I try run it on the command line it shows this error : $ python __init__.py

Re: Problem using python C API

2009-01-16 Thread marcglec
Right, thx for your reply, I completely overlooked examplemodule.so in the building step. Maybe I should sleep more these days :) Btw, I've now an other problem with PyArg_ParseTuple but I guess it is better to post in the capi-sig mailing list. Thx again, Marc. On Jan 16, 2009, at 5:31 AM,

Re: Does Python really follow its philosophy of Readability counts?

2009-01-16 Thread mk
Paul Rubin wrote: But, if something is done by convention, then departing from the convention is by definition unconventional. If you do something unconventional in a program, it could be on purpose for a reason, or it could be by accident indicating a bug. I for one would love to see at

confused about publishing more than one class in twisted server.

2009-01-16 Thread Krishnakant
hello, I am writing a twisted based rpc service where I am implementing a complete application as a service. I have many modules which make a package. Now when we publish a service in twisted, we have to create one instance of a certain class and then publish it with the help of reactor. but in

Start multiple listening servers in one file

2009-01-16 Thread Thomas W
I`m working on a django-project where I`m using the awsome pyftpdlib for ftpserver-functionality. I also have a simple worker deamon running in the background, but not listening to any port. How can I start all of these processes on one file? Tried using subprocess and popen but that resulted in

Start two threads in same time

2009-01-16 Thread vedrandekovic
Hello, Does anybody know how can I start two threads in same time? Regards, John -- http://mail.python.org/mailman/listinfo/python-list

Skull Socks (was Re: Convention vs. fascism)

2009-01-16 Thread J. Cliff Dyer
On Fri, 2009-01-16 at 08:57 +, Steven D'Aprano wrote: On Fri, 16 Jan 2009 10:03:28 +0200, Hendrik van Rooyen wrote: Oh come on you lot - you are carrying on as if Diez were wearing his skull socks again - do me a favour and give him a break! And... skull socks? Cool. Where can I get

Re: Skull Socks (was Re: Convention vs. fascism)

2009-01-16 Thread Steven D'Aprano
On Fri, 16 Jan 2009 11:01:18 -0500, J. Cliff Dyer wrote: On Fri, 2009-01-16 at 08:57 +, Steven D'Aprano wrote: On Fri, 16 Jan 2009 10:03:28 +0200, Hendrik van Rooyen wrote: Oh come on you lot - you are carrying on as if Diez were wearing his skull socks again - do me a favour and give

Re: Client Socket Connection to Java server

2009-01-16 Thread Venkatraman.S.
Hint: Java sends a '\n' character at the end. -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python really follow its philosophy of Readability counts?

2009-01-16 Thread Paul Rubin
mk mrk...@gmail.com writes: I was flabbergasted to read that optional static typing was dropped by Guido due to lack of interest in community IIRC. I don't remember that happening. PEP 3107 still lists type checking as a use case for Python 3.0 function annotations. --

Re: Integrating awk in Python

2009-01-16 Thread Terry Reedy
Willi Richert wrote: Hi, take a look at the 5th link at http://tinyurl.com/7s8kfq It's called pyawk. Stupid link wanting to set yet another useless cookie. Answer will not always be 5th. Just say 'Google pyawk' or better give link http://pyawk.sourceforge.net/ Am Freitag, 16. Januar 2009

Re: English-like Python

2009-01-16 Thread Dotan Cohen
2009/1/16 The Music Guy music...@alphaios.net: Just out of curiousity, have there been any attempts to make a version of Python that looks like actual English text? I mean, so much of Python is already based on the English language that it seems like the next natural step would be to make a

Re: mimetypes oddity

2009-01-16 Thread Terry Reedy
Sion Arrowsmith wrote: In article mailman.7301.1232043685.3487.python-l...@python.org, s...@pobox.com wrote: [mimetype weirdness reported] Sion Is this a bug? Might be. Can you file a bug report in the Python issue tracker with a small script that demonstrates the behavior?

Python 2.6's multiprocessing lock not working on second use?

2009-01-16 Thread Frédéric Sagnes
Hi, I ran a few tests on the new Python 2.6 multiprocessing module before migrating a threading code, and found out the locking code is not working well. In this case, a pool of 5 processes is running, each trying to get the lock and releasing it after waiting 0.2 seconds (action is repeated

Re: Possible bug in Tkinter - Python 2.6

2009-01-16 Thread Terry Reedy
Eric Brunel wrote: On Thu, 15 Jan 2009 23:49:22 +0100, Terry Reedy tjre...@udel.edu wrote: Eric Brunel wrote: [snip] And BTW, if this is actually a bug, where can I report it? bugs.python.org Thanks. I reported the problem. When you report that you reported to problem to the tracker (a

Re: optimizing large dictionaries

2009-01-16 Thread pruebauno
On Jan 15, 4:39 pm, Per Freem perfr...@yahoo.com wrote: hello i have an optimization questions about python. i am iterating through a file and counting the number of repeated elements. the file has on the order of tens of millions elements... i create a dictionary that maps elements of the

Re: Beginner: Data type conversion question

2009-01-16 Thread flagg
On Jan 15, 11:35 pm, Terry Reedy tjre...@udel.edu wrote: flagg wrote: I am still fairly new to python and programming in general.  My question is regardingdataconversion, I am working on a script that will edit dns zone files, one of the functions i wrote handles updating the serial

Re: lazy evaluation is sometimes too lazy... help please.

2009-01-16 Thread Scott David Daniels
Ken Pu wrote: Hi, below is the code I thought should create two generates, it[0] = 0,1,2,3,4,5, and it[1] = 0,10,20,30,..., but they turn out to be the same!!! from itertools import * itlist = [0,0] for i in range(2): itlist[i] = (x+(i*10) for x in count()) ... print list(islice(itlist[0],

Re: Integrating awk in Python

2009-01-16 Thread mk
Alfons Nonell-Canals wrote: At the beggining I thought to translate them and program them in python but I prefer to avoid it because it means a lot of work and I should do it after each new version of this external stuff. I would like to integrate them into my python code. That's kind of

Re: Beginner: Data type conversion question

2009-01-16 Thread flagg
On Jan 15, 11:43 pm, Marc 'BlackJack' Rintsch bj_...@gmx.net wrote: On Thu, 15 Jan 2009 21:09:43 -0800, flagg wrote: def checkSerial():         Checks the current 'date' portion of the serial number and checks     the current 'counter'(the two digit number at the end of the serial    

Python 3: range objects cannot be sliced

2009-01-16 Thread Alan G Isaac
Is the behavior below expected? Documented? (The error msg is misleading.) Thanks, Alan Isaac x = range(20) s = slice(None,None,2) x[s] Traceback (most recent call last): File stdin, line 1, in module TypeError: sequence index must be integer, not 'slice' --

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-16 Thread mario ruggier
On Jan 16, 1:35 pm, ajaksu aja...@gmail.com wrote: On Jan 16, 5:09 am, mario ruggier mario.rugg...@gmail.com wrote: Laboriously doing all these checks on each expr eval will be very performance heavy, so I hope to be able to limit access to all these more efficiently. Suggestions? None

Re: Start multiple listening servers in one file

2009-01-16 Thread MRAB
Thomas W wrote: I`m working on a django-project where I`m using the awsome pyftpdlib for ftpserver-functionality. I also have a simple worker deamon running in the background, but not listening to any port. How can I start all of these processes on one file? Tried using subprocess and popen

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Fuzzyman
On Jan 16, 5:45 pm, Alan G Isaac alan.is...@gmail.com wrote: Is the behavior below expected? Documented? (The error msg is misleading.) Thanks, Alan Isaac   x = range(20)   s = slice(None,None,2)   x[s] Traceback (most recent call last):    File stdin, line 1, in module TypeError:

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Paul Rubin
Alan G Isaac alan.is...@gmail.com writes: x = range(20) s = slice(None,None,2) x[s] Traceback (most recent call last): File stdin, line 1, in module TypeError: sequence index must be integer, not 'slice' range is an iterator now. Try itertools.islice. --

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-16 Thread Paul Rubin
mario ruggier mario.rugg...@gmail.com writes: All the above attempts will be blocked this way. Any other disallow- sub-strings to add to the list above? I think what you are trying to do is fundamentally hopeless. You might look at web.py (http://webpy.org) for another approach, that puts a

Re: Integrating awk in Python

2009-01-16 Thread Grant Edwards
Am Freitag, 16. Januar 2009 13:02:59 schrieb Alfons Nonell-Canals: Hello, I'm developing a software package using python. I've programmed all necessary tools but I have to use other stuff from other people. Most of these external scripts are developed using awk. At the beggining I thought to

minidom, drilling down to a low node in one line?

2009-01-16 Thread Matt Brown - nyc
Hello, I hope this isn't completely redundant... I'm working with an example found of parsing XML with xml.dom.minidom and am having some issues getting a node down three levels. Here is the tutorial: http://diveintopython.org/xml_processing/parsing_xml.html Given the XML: _ ?xml

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Alan G Isaac
On 1/16/2009 1:15 PM Paul Rubin apparently wrote: range is an iterator now. Try itertools.islice. Well yes, it behaves like xrange did. But (also like xrange) it supports indexing. (!) So why not slicing? I expected this (to keep it functionally more similar to the old range). Alan Isaac --

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Christian Heimes
Alan G Isaac schrieb: On 1/16/2009 1:15 PM Paul Rubin apparently wrote: range is an iterator now. Try itertools.islice. Well yes, it behaves like xrange did. But (also like xrange) it supports indexing. (!) So why not slicing? I expected this (to keep it functionally more similar to the

Re: why o/p is different ???

2009-01-16 Thread Lie
On Jan 15, 1:34 pm, asit lipu...@gmail.com wrote: I recently faced a peculiar o/p. My objective is to remove the command name(my script name) from sys.argv[0]. I coded like this import urllib import sys print \n\n\t\tlipun4u[at]gmail[dot]com print \t\t apppath

FileCookieJar has not attribute _self_load

2009-01-16 Thread Dragos
I am trying to make a testing script to load/save cookies to a file with FileCookieJar, but it results in this error: FileCookieJar has not attribute _self_load This is my script: import urllib.request, urllib.parse,http.cookiejar url=http://localhost/test.php; cs=http.cookiejar.FileCookieJar()

Differences between class and function decorator

2009-01-16 Thread mk
Hello everyone, I rewrote an example someone posted here recently from: def print_method_name(method): def new_meth(*args, **kwargs): print method.func_name return method(*args, **kwargs) return new_meth @print_method_name def f2():

Re: Differences between class and function decorator

2009-01-16 Thread Duncan Booth
mk mrk...@gmail.com wrote: Note that function decorator returned None, while class decorator returned function. Why the difference in behavior? After all, print_method_name decorator also returns a function (well it's a new function but still a function)? That would be because the

Re: Does Python really follow its philosophy of Readability counts?

2009-01-16 Thread Russ P.
On Jan 16, 5:22 am, Steve Holden st...@holdenweb.com wrote: Russ P. wrote: [...] I spent *way* too much time on that post. I really need to quit spending my time refuting the baloney that passes for wisdom here. He who cannot ignore baloney is doomed to refute it. regards Steve --

Re: are there some special about '\x1a' symbol

2009-01-16 Thread Matthew Woodcraft
Steve Holden st...@holdenweb.com writes: Unknown wrote: On 2009-01-12, John Machin sjmac...@lexicon.net wrote: I didn't think your question was stupid. Stupid was (a) CP/M recording file size as number of 128-byte sectors, forcing the use of an in-band EOF marker for text files (b) MS

Re: Lazy List Generator Problem

2009-01-16 Thread Gerald Britton
For those interested in the Sieve of Eratosthenes, have a look at: http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf The examples in the paper are in Haskell, but I have been corresponding with the author who provided this Python version: def sieve(): innersieve = sieve() prevsquare =

Re: English-like Python

2009-01-16 Thread has
On 16 Jan, 05:42, Chris Rebert c...@rebertia.com wrote: On Thu, Jan 15, 2009 at 5:02 PM, The Music Guy music...@alphaios.net wrote: Just out of curiousity, have there been any attempts to make a version of Python that looks like actual English text? [...] Does the name AppleScript mean

Re: English-like Python

2009-01-16 Thread Erik Max Francis
alex23 wrote: On Jan 16, 5:39 pm, Erik Max Francis m...@alcyone.com wrote: Inform 7 has some interesting ideas, but I think the general problem with English-like programming language systems is that once you get into the nitty gritty details, you end up having to know exactly the right things

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Alan G Isaac
It is documented: http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range -- http://mail.python.org/mailman/listinfo/python-list

Class decorator with argument

2009-01-16 Thread mk
Hello, I wrote this class decorator with argument: class ChangeDoc(object): def __init__(self, docstring): self.docstring = docstring def __call__(self, func): func.__doc__ = self.docstring return func It seems to work:

Finding the full path of an executable

2009-01-16 Thread Michael Hoffman
Is there a portable way to find the full path of a filename that would be called by os.execvp()? Thanks, Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

tuple methods: documentation missing

2009-01-16 Thread Alan G Isaac
http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range I see no mention of the tuple methods? Right after the paragraph Most sequence types support the following operations. it seems appropriate to have one stating Most sequence types support the

*Advanced* Python book?

2009-01-16 Thread mk
Hello everyone, I looked for it I swear, but just can't find it. Most Python books seem to focus on examples of how to call functions from standard library. I don't need that, I have online Python documentation for that. I mean really advanced mental gymnastics, like gory details of how

  1   2   3   >