Re: xlrd 0.8.0 released!

2012-08-03 Thread pruebauno
On Wednesday, August 1, 2012 11:01:56 AM UTC-4, Chris Withers wrote: Hi All, I'm pleased to announce the release of xlrd 0.8.0: http://pypi.python.org/pypi/xlrd/0.8.0 This release finally lands the support for both .xls and .xlsx files. Many thanks to John Machin for all

Re: interval arithmetic libraries

2009-06-08 Thread pruebauno
On Jun 6, 8:15 am, srepmub mark.duf...@gmail.com wrote: Hi all, I'm looking for libraries that allow one to calculate with sets of (date) intervals. So for example, I'd like to be able to calculate the overlap between two sets of intervals, the union etc. Preferrably, this works with

Re: fastest way to test file for string?

2009-06-05 Thread pruebauno
On Jun 5, 7:50 am, kj no.em...@please.post wrote: Hi.  I need to implement, within a Python script, the same functionality as that of Unix's    grep -rl some_string some_directory I.e. find all the files under some_directory that contain the string some_string. I imagine that I can always

Re: DUDA !!!!!!!!!!

2009-06-05 Thread pruebauno
On Jun 4, 2:51 pm, Ariel Vazquez Riveron avazqu...@grm.uci.cu wrote: Hola:   Hoy en día me encuentro iniciandome dentro del python, en estos   momentos quiero saber de que forma puedo eliminar un archivo de un   compactado, ya sea zip, rar o cualquier otro. Estudie las librerías   zipfile

Re: Illegal seek with os.popen

2009-06-04 Thread pruebauno
On Jun 3, 3:36 pm, a...@pythoncraft.com (Aahz) wrote: In article 7c93031a-235e-4e13-bd37-7c9dbc6e8...@r16g2000vbn.googlegroups.com,  prueba...@latinmail.com wrote: Should I open a bug report for this? Python 2.5.1 (r251:54863, Sep 19 2007, 14:58:06) [C] on aix5 Type help, copyright,

Illegal seek with os.popen

2009-06-01 Thread pruebauno
Should I open a bug report for this? Python 2.5.1 (r251:54863, Sep 19 2007, 14:58:06) [C] on aix5 Type help, copyright, credits or license for more information. import os os.popen('cat','w') open file 'cat', mode 'w' at 0x110111990 Python 3.1rc1 (r31rc1:73054, Jun 1 2009, 10:49:24) [C] on

Re: Is there a better way to chose a slice of a list?

2009-05-09 Thread pruebauno
On May 8, 3:03 pm, walterbyrd walterb...@iname.com wrote: This works, but it seems like there should be a better way. -- week = ['sun','mon','tue','wed','thu','fri','sat'] for day in week[week.index('tue'):week.index('fri')]:    print day --- Depending on the

Re: Python 3.1 beta 1

2009-05-08 Thread pruebauno
On May 7, 11:57 am, bearophileh...@lycos.com wrote: Equality tests between OrderedDict objects are order-sensitive and are implemented as list(od1.items())==list(od2.items()). Equality tests between OrderedDict objects and other Mapping objects are order-insensitive very nice idea. I

Re: Python 3.1 beta 1

2009-05-08 Thread pruebauno
On May 7, 6:33 pm, Benjamin Peterson benja...@python.org wrote:  pruebauno at latinmail.com writes: Congratulations! Thanks! Is it just me or was some nice summary output added to the make process? I get a nice list of modules that didn't compile and the ones where the library could

Re: Python 2.6, File read() problems in Windows Xp

2009-05-08 Thread pruebauno
On May 8, 5:08 am, Li Wang li.wan...@gmail.com wrote: Hi  Dave: Thank you very much for you explanation:) Chances are you forgot the b parameter to open().  Unnecessary in Unix, it tells the library to *not* translate \r\n  to \n upon read, or the inverse on write.  In other words, with

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread pruebauno
On May 8, 3:04 pm, Casey Hawthorne caseyhhammer_t...@istar.ca wrote: I'm intrigued that Python has some functional constructions in the language. Would it be possible to more clearly separate the pure code (without side effects) from the impure code (that deals with state changes, I/O,

Re: Python 3.1 beta 1

2009-05-07 Thread pruebauno
On May 6, 9:32 pm, Benjamin Peterson benja...@python.org wrote: On behalf of the Python development team, I'm thrilled to announce the first and only beta release of Python 3.1. Python 3.1 focuses on the stabilization and optimization of features and changes Python 3.0 introduced.  For

Re: print(f) for files .. and is print % going away?

2009-04-30 Thread pruebauno
On Apr 30, 8:30 am, Esmail ebo...@hotmail.com wrote: Matt Nordhoff wrote: Esmail wrote: Hello all, I use the print method with % for formatting my output to the console since I am quite familiar with printf from my C days, and I like it quite well. I am wondering if there is a way

Re: dict is really slow for big truck

2009-04-29 Thread pruebauno
On Apr 29, 1:05 pm, Scott David Daniels scott.dani...@acm.org wrote: Bruno Desthuilliers wrote: d = {} for line in open(thefile):    arr = line.strip().split()    d[arr[0]] = arr Sorry, not picking on Bruno in particular, but I keep seeing this formulation around various places. When

Re: Help AIX 5.3 build on Python-3.1a2

2009-04-29 Thread pruebauno
On Apr 28, 10:07 am, Jeroen Ruigrok van der Werven asmo...@in- nomine.org wrote: -On [20090427 20:31], prueba...@latinmail.com (prueba...@latinmail.com) wrote: ./Modules/ld_so_aix xlc_r -q64 -bI:Modules/python.exp build/ temp.aix-5.3-3.1//ptst/Python-3.1a2/Modules/_tkinter.o build/

Re: Help AIX 5.3 build on Python-3.1a2

2009-04-27 Thread pruebauno
On Apr 26, 5:14 am, Jeroen Ruigrok van der Werven asmo...@in- nomine.org wrote: -On [20090425 19:17], Aahz (a...@pythoncraft.com) wrote: In article acf6ccbd-fcdb-4141-b2ef-0c83cae99...@x5g2000yqk.googlegroups.com, prueba...@latinmail.com wrote: Include/token.h, line 42.9: 1506-213 (S)

Re: Help AIX 5.3 build on Python-3.1a2

2009-04-27 Thread pruebauno
On Apr 27, 10:26 am, Jeroen Ruigrok van der Werven asmo...@in- nomine.org wrote: -On [20090427 15:00], prueba...@latinmail.com (prueba...@latinmail.com) wrote: Thanks Jeroen. I know that AIX isn't as supported as other platforms, but I thought it wouldn't hurt to ask anyway. At least now

Help AIX 5.3 build on Python-3.1a2

2009-04-24 Thread pruebauno
OPT=-O2 LDFLAGS=-s ./configure --prefix=/ptst --with-gcc=xlc_r -q64 --with-cxx=xlC_r -q64 --disable-ipv6 AR=ar -X64 --without-locale -- without-ctypes checking for --with-universal-archs... 32-bit checking MACHDEP... aix5 checking machine type as reported by uname -m... 00023AAA4C00 checking for

Re: Python, MS SQL, and batch inserts

2009-04-22 Thread pruebauno
On Apr 21, 5:21 pm, Scott David Daniels scott.dani...@acm.org wrote: ericwoodwo...@gmail.com wrote: On Apr 21, 4:01 pm, ericwoodwo...@gmail.com wrote: On Apr 21, 3:36 pm, Scott David Daniels scott.dani...@acm.org wrote: I forget the name of the SQL Server bulk loader, bcp (bulk

Re: Help improve program for parsing simple rules

2009-04-20 Thread pruebauno
On Apr 17, 5:32 pm, Paul McGuire pt...@austin.rr.com wrote: On Apr 17, 2:40 pm, prueba...@latinmail.com wrote: On Apr 17, 11:26 am, Paul McGuire pt...@austin.rr.com wrote: On Apr 16, 10:57 am, prueba...@latinmail.com wrote: Another interesting task for those that are looking for

Re: when can i expect libraries and third party tools to be updated for python 3 ?

2009-04-20 Thread pruebauno
On Apr 20, 9:47 am, Deep_Feelings doctore...@gmail.com wrote: every one is telling dont go with python 3 , 3rd party tools and libraries have no compitability with python 3 so from previous experience : when can i expect libraries and third party tools to be updated for python 3 ? (especially

Re: Help improve program for parsing simple rules

2009-04-17 Thread pruebauno
On Apr 16, 3:59 pm, Aaron Brady castiro...@gmail.com wrote: On Apr 16, 10:57 am, prueba...@latinmail.com wrote: Another interesting task for those that are looking for some interesting problem: I inherited some rule system that checks for programmers program outputs that to be ported:

Re: Help improve program for parsing simple rules

2009-04-17 Thread pruebauno
On Apr 16, 9:29 pm, John Machin sjmac...@lexicon.net wrote: On Apr 17, 1:57 am, prueba...@latinmail.com wrote: COMP_REPLACERS={'LT':'', 'GT':'', 'LE':'=', 'GE':'=', '=':'==', '=':'=', '=':'='} What do the '=' and '=' represent? Why are you replacing each by itself? because of this:

Re: Help improve program for parsing simple rules

2009-04-17 Thread pruebauno
On Apr 17, 11:26 am, Paul McGuire pt...@austin.rr.com wrote: On Apr 16, 10:57 am, prueba...@latinmail.com wrote: Another interesting task for those that are looking for some interesting problem: I inherited some rule system that checks for programmers program outputs that to be ported:

Help improve program for parsing simple rules

2009-04-16 Thread pruebauno
Another interesting task for those that are looking for some interesting problem: I inherited some rule system that checks for programmers program outputs that to be ported: given some simple rules and the values it has to determine if the program is still working correctly and give the details of

Re: complaints about no replies last week

2009-04-01 Thread pruebauno
On Mar 31, 4:07 pm, Arnaud Delobelle arno...@googlemail.com wrote: prueba...@latinmail.com writes: [...] Well since I attracted a couple people's attention I will describe the problem in more detail. Describing the problem properly is probably as hard as solving it, so excuse me if I

Re: complaints about no replies last week

2009-03-31 Thread pruebauno
On Mar 31, 2:56 am, Arnaud Delobelle arno...@googlemail.com wrote: Arnaud Delobelle wrote: prueba...@latinmail.com writes: [...] I myself asked about how to write a library to efficiently do union and intersection of sets containing time intervals some time ago on this list and got

Re: complaints about no replies last week

2009-03-30 Thread pruebauno
On Mar 28, 11:07 am, Aaron Brady castiro...@gmail.com wrote: Hi, A week ago, I posted a question and an idea about Python's garbage collector.  I got a few replies.  Some days later, I posted a mock-up implementation of it, and got *NO* replies.  Does this mean: a) It works b) It doesn't

Re: Programming Python 4th Edition?

2009-03-27 Thread pruebauno
On Mar 26, 10:08 pm, Esmail ebo...@hotmail.com wrote: Hi, Does anyone know if there is a 4th edition of this book planned and if so, when it might be coming out? It looks like a good and comprehensive book but is getting a bit outdated(?). And I guess since I'm asking this, I might as

Re: Another form of dynamic import

2009-03-25 Thread pruebauno
On Mar 25, 10:23 am, Marco Nawijn naw...@gmail.com wrote: Hello, In short I would like to know if somebody knows if it is possible to re-execute a statement that raised an exception? I will explain the reason by providing a small introduction on why this might be nice in my case and some

Re: Unit testing frameworks

2009-03-24 Thread pruebauno
On Mar 24, 8:06 am, grkunt...@gmail.com wrote: I am looking for a unit testing framework for Python. I am aware of nose, but was wondering if there are any others that will automatically find and run all tests under a directory hierarchy. Thanks, Ralph *Nose *Trial *py.test --

Re: improve this newbie code/nested functions in Python?

2009-03-20 Thread pruebauno
On Mar 19, 10:21 pm, Esmail ebo...@gmail.com wrote: Hi, I'm new to writing Python code. This is a simple client I wrote, it works, but I feel it doesn't look as clean as it could. Can anyone make suggestions how to streamline this code? Also, I am using two nested functions, it seems that

Re: How complex is complex?

2009-03-19 Thread pruebauno
On Mar 19, 1:25 pm, Paul Hildebrandt paul_hildebra...@yahoo.com wrote: On Mar 19, 9:41 am, Kottiyath n.kottiy...@gmail.com wrote: On Mar 19, 9:33 pm, Kottiyath n.kottiy...@gmail.com wrote: On Mar 19, 8:42 pm, Paul McGuire pt...@austin.rr.com wrote: On Mar 19, 4:39 am, Kottiyath

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread pruebauno
On Mar 13, 7:06 am, Tim Rowe digi...@gmail.com wrote: 2009/3/12 Raymond Hettinger pyt...@rcn.com: If anyone here is interested, here is a proposal I posted on the python-ideas list. The idea is to make numbering formatting a little easier with the new format() builtin in Py2.6 and

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-12 Thread pruebauno
On Mar 12, 3:30 am, Raymond Hettinger pyt...@rcn.com wrote: If anyone here is interested, here is a proposal I posted on the python-ideas list. The idea is to make numbering formatting a little easier with the new format() builtin in Py2.6 and Py3.0:  

Re: Candidate for a new itertool

2009-03-12 Thread pruebauno
On Mar 7, 8:47 pm, Raymond Hettinger pyt...@rcn.com wrote: The existing groupby() itertool works great when every element in a group has the same key, but it is not so handy when groups are determined by boundary conditions. For edge-triggered events, we need to convert a boundary-event

Re: Candidate for a new itertool

2009-03-10 Thread pruebauno
On Mar 9, 6:55 pm, Raymond Hettinger pyt...@rcn.com wrote: [prueba] The data often contains objects with attributes instead of tuples, and I expect the new namedtuple datatype to be used also as elements of the list to be processed. But I haven't found a nice generalized way for that

Re: Candidate for a new itertool

2009-03-09 Thread pruebauno
On Mar 7, 8:47 pm, Raymond Hettinger pyt...@rcn.com wrote: The existing groupby() itertool works great when every element in a group has the same key, but it is not so handy when groups are determined by boundary conditions. For edge-triggered events, we need to convert a boundary-event

Re: Mapping 64 bit int from C to Python-2.2

2009-03-09 Thread pruebauno
On Mar 9, 11:51 am, Explore_Imagination mr.hassanshab...@gmail.com wrote: Hi I want to map 64 bit integers from C to python. I must use Python 2.2 BUT There is no support for 64 bits integers in Python2.2 (Supported in 2.5). Now the problem is that I have these four variables: unit32_t

Re: Perl python - regex performance comparison

2009-03-03 Thread pruebauno
On Mar 3, 12:38 pm, Ivan ivan@@gmail.com wrote: Hello everyone, I know this is not a direct python question, forgive me for that, but maybe some of you will still be able to help me. I've been told that for my application it would be best to learn a scripting language, so I looked around and

Re: starting a Python 2.5 executable without the DOS window

2009-02-27 Thread pruebauno
On Feb 27, 9:12 am, Greg Miller et1ssgmil...@gmail.com wrote: I am working on a program that controls a piece of equipment.  The GUI/ control software is written with Python2.5/wxPython.  I would like to know if there is a way of starting the GUI without the DOS window having to launch?  I

Re: is this pythonic?

2009-01-22 Thread pruebauno
On Jan 21, 4:23 pm, Scott David Daniels scott.dani...@acm.org wrote: prueba...@latinmail.com wrote: ... If you have duplicates this will not work. You will have to do something like this instead: o=[] i=0 ln=len(l) while iln:    if l[i]['title']=='ti':            

Re: is this pythonic?

2009-01-22 Thread pruebauno
On Jan 21, 4:23 pm, Scott David Daniels scott.dani...@acm.org wrote: prueba...@latinmail.com wrote: ... If you have duplicates this will not work. You will have to do something like this instead: o=[] i=0 ln=len(l) while iln:    if l[i]['title']=='ti':            

Re: is this pythonic?

2009-01-21 Thread pruebauno
On Jan 21, 12:34 pm, TP tribulati...@paralleles.invalid wrote: alex23 wrote: Try not to use 'dict' or the name of any of the other built-in types So my list is rather: l=[{title:to, color:blue, value:2} {title:ti, color:red, value:coucou}] So, I will rather use your solution: for index,

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: Encrypted Logging in python

2009-01-09 Thread pruebauno
On Jan 9, 8:02 am, koranth...@gmail.com wrote: Also, what I am asking is a generic option in logging - which can help the adoption of the logging framework in even closed source systems. It is not just about security - just that a closed source company might be much more comfortable in using

Re: Implementing file reading in C/Python

2009-01-09 Thread pruebauno
On Jan 9, 8:48 am, Johannes Bauer dfnsonfsdu...@gmx.de wrote: No - and I've not known there was a profiler yet have found anything meaningful (there seems to be an profiling C interface, but that won't get me anywhere). Is that a seperate tool or something? Could you provide a link? Thanks,

Re: Any news on when some libraries will be ported to Python 3.0?

2009-01-07 Thread pruebauno
On Jan 7, 3:48 am, Just Another Victim of the Ambient Morality ihates...@hotmail.com wrote:     Anyway, I'd love to hear some news about any of these things in particular or even anything in general.  Am I the only one who's psyched for this version of Python?     Thank you... There are many

Re: f.seek() unwanted output

2009-01-05 Thread pruebauno
On Jan 5, 8:52 am, thomasvang...@gmail.com thomasvang...@gmail.com wrote: I'm having trouble with a script that is printing the output of f.seek () whereas in the documentation it is quoted not to have any output: file.seek(offset[, whence])¶     Set the file’s current position, like

Re: SQL, lite lite lite

2008-12-30 Thread pruebauno
On Dec 29, 1:06 pm, Aaron Brady castiro...@gmail.com wrote: Hi all, About a year ago, I posted an idea I was having about thread synchronization to the newsgroup.  However, I did not explain it well, and I really erred on the side of brevity.  (After some finagling, Mr. Bieber and I decided

Re: 2to3 used in the Shootout

2008-12-29 Thread pruebauno
On Dec 23, 5:21 pm, Isaac Gouy igo...@yahoo.com wrote: On Dec 23, 11:51 am, bearophileh...@lycos.com wrote: They have translated the Python benchmarks of the Shootout site from Py2 to Py3 using 2to3: http://shootout.alioth.debian.org/u32/benchmark.php?test=all〈=pyt... So please re-write

Re: Is this pythonic?

2008-12-18 Thread pruebauno
On Dec 18, 11:08 am, ipyt...@gmail.com wrote: x.validate_output(x.find_text(x.match_filename (x.determine_filename_pattern(datetime.datetime.now() Is it even good programming form? Lisp and Scheme programmers love that style. You can tell by the number of parentheses :-). In Python people

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread pruebauno
On Dec 17, 10:19 am, walterbyrd walterb...@iname.com wrote: For a language as well structured as Python, this seems somewhat sloppy, and inconsistant.  Or is there some good reason for this? Here is what I mean: def a():     x = 99     print x def b():     print x a() b() # raises an

Re: stable algorithm with complexity O(n)

2008-12-15 Thread pruebauno
Non-comparison sorts are a useful technique, but it's changing the problem, and they are only useful in very limited circumstances. There's a good reason that most sort routines are based on O(n*log n) comparison sorts instead of O(n) bucket sorts or radix sorts. This is an assumption that I

Re: stable algorithm with complexity O(n)

2008-12-15 Thread pruebauno
On Dec 15, 11:05 am, prueba...@latinmail.com wrote: Non-comparison sorts are a useful technique, but it's changing the problem, and they are only useful in very limited circumstances. There's a good reason that most sort routines are based on O(n*log n) comparison sorts instead of O(n)

Re: Removing None objects from a sequence

2008-12-12 Thread pruebauno
On Dec 12, 8:08 am, Filip Gruszczyński grusz...@gmail.com wrote: I am not doing it, because I need it. I can as well use if not elem is None, but I just wanted to know, if there is some better way of doing this. I like to know :-) And I can't understand why you are becoming so aggressive

Re: StringIO in 2.6 and beyond

2008-12-10 Thread pruebauno
On Dec 10, 6:58 am, Bill McClain [EMAIL PROTECTED] wrote: On 2008-12-10, ajaksu [EMAIL PROTECTED] wrote: On Dec 9, 5:24 pm, Bill McClain [EMAIL PROTECTED] wrote: On 2008-12-09, MRAB [EMAIL PROTECTED] wrote: In Python 2.x unmarked string literals are bytestrings. In Python 3.x

Re: StringIO in 2.6 and beyond

2008-12-10 Thread pruebauno
On Dec 10, 10:06 am, [EMAIL PROTECTED] wrote: On Dec 10, 6:58 am, Bill McClain [EMAIL PROTECTED] wrote: On 2008-12-10, ajaksu [EMAIL PROTECTED] wrote: On Dec 9, 5:24 pm, Bill McClain [EMAIL PROTECTED] wrote: On 2008-12-09, MRAB [EMAIL PROTECTED] wrote: In Python 2.x

Re: StringIO in 2.6 and beyond

2008-12-09 Thread pruebauno
On Dec 9, 11:28 am, Bill McClain [EMAIL PROTECTED] wrote: On 2008-12-08, Bill McClain [EMAIL PROTECTED] wrote: On 2008-12-08, Christian Heimes [EMAIL PROTECTED] wrote: In this context 'str' means Python 3.0's str type, which is unicode in 2.x. Please report the misleading error message.

Re: When (and why) to use del?

2008-12-09 Thread pruebauno
On Dec 9, 11:35 am, Albert Hopkins [EMAIL PROTECTED] wrote: I'm looking at a person's code and I see a lot of stuff like this:         def myfunction():             # do some stuff stuff             my_string = function_that_returns_string()             # do some stuff with my_string        

Re: Python 3 For Python 2 Users

2008-12-09 Thread pruebauno
On Dec 9, 11:58 am, Tim Daneliuk [EMAIL PROTECTED] wrote: I code in Python 2.x intermittently and have only casually watched the 3.x development discussions.  Now it's time to get up to speed. Has someone written a tutorial for people in my situation.  Yes, I've looked at the release notes,

Re: funny generator behaviour

2008-12-04 Thread pruebauno
On Dec 4, 8:00 am, Edvin Fuglebakk [EMAIL PROTECTED] wrote: I have written a generator that puzzles me: The generator is supposed to create ordered selections of a set of objects. repetition of objects is allowed and the selections should be of a size determined by a pramter to the generator.

Re: funny generator behaviour

2008-12-04 Thread pruebauno
On Dec 4, 8:00 am, Edvin Fuglebakk [EMAIL PROTECTED] wrote: I have written a generator that puzzles me: The generator is supposed to create ordered selections of a set of objects. repetition of objects is allowed and the selections should be of a size determined by a pramter to the generator.

Re: funny generator behaviour

2008-12-04 Thread pruebauno
On Dec 4, 8:00 am, Edvin Fuglebakk [EMAIL PROTECTED] wrote: I have written a generator that puzzles me: The generator is supposed to create ordered selections of a set of objects. repetition of objects is allowed and the selections should be of a size determined by a pramter to the generator.

Re: Good introductory book?

2008-12-04 Thread pruebauno
On Dec 3, 9:44 am, Ken D'Ambrosio [EMAIL PROTECTED] wrote: Hi, all. I'm getting ready to do some projects in Python, and I've cut my teeth a little bit, but I've found the Learning|Programming Python books from O'Reilly to be more-or-less useless (to my surprise -- I'm usually an O'Reilly

Re: Dynamic features used

2008-11-21 Thread pruebauno
On Nov 21, 4:17 am, [EMAIL PROTECTED] wrote: What are the dynamic features of Python that you use in your code? The main ones is using configuration files that are plain Python instead of XML and not having to wait 5 minutes to compile larger programs. I also prefer structural typing over

Re: redirecting stdout/err to mysql table

2008-11-19 Thread pruebauno
On Nov 18, 2:07 pm, n00b [EMAIL PROTECTED] wrote: greetings, i need to log to the db directly and wrote a little script to do so. since i'm pretty new to python, i was wondering if a) you could review the enclosed code and b) provide suggestions to harden to code to turn it into a more

Re: duck-type-checking?

2008-11-14 Thread pruebauno
On Nov 14, 12:47 am, George Sakkis [EMAIL PROTECTED] wrote: On Nov 13, 10:55 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: Take this example: def foo(alist): alist.sort() alist.append(5) The argument can be any object with sort and append methods (assumed

Re: duck-type-checking?

2008-11-12 Thread pruebauno
On Nov 12, 1:22 pm, Joe Strout [EMAIL PROTECTED] wrote: On Nov 12, 2008, at 10:45 AM, Tim Rowe wrote: What do you actually mean by Quacks like a string? Supports the 'count()' method? Then you find out if it doesn't when you try to apply the 'count()' method. Supports some method that you

Re: Possible read()/readline() bug?

2008-10-23 Thread pruebauno
On Oct 23, 9:48 am, Mike Kent [EMAIL PROTECTED] wrote: To followup on this: Terry: Yes, I did in fact miss the 'buffer' parameter to open. Setting the buffer parameter to 0 did in fact fix the test code that I gave above, but oddly, did not fix my actual production code; it continues to get

Re: Possible read()/readline() bug?

2008-10-22 Thread pruebauno
On Oct 22, 2:54 pm, Mike Kent [EMAIL PROTECTED] wrote: Before I file a bug report against Python 2.5.2, I want to run this by the newsgroup to make sure I'm not being stupid. I have a text file of fixed-length records I want to read in random order. That file is being changed in real-time by

Re: Possible read()/readline() bug?

2008-10-22 Thread pruebauno
On Oct 22, 3:44 pm, [EMAIL PROTECTED] wrote: On Oct 22, 2:54 pm, Mike Kent [EMAIL PROTECTED] wrote: Before I file a bug report against Python 2.5.2, I want to run this by the newsgroup to make sure I'm not being stupid. I have a text file of fixed-length records I want to read in random

Re: Where/how to propose an addition to a standard module?

2008-10-13 Thread pruebauno
On Oct 10, 3:10 pm, Joe Strout [EMAIL PROTECTED] wrote: I would like to propose a new method for the string.Template class. What's the proper procedure for doing this? I've joined the python- ideas list, but that seems to be only for proposed language changes, and my idea doesn't require any

Re: Append a new value to dict

2008-10-13 Thread pruebauno
On Oct 13, 9:41 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Mon, 13 Oct 2008 14:10:43 +0200, Mathias Frey wrote: However incrementing a non-existing key throws an exception. So you either have to use a workaround: try: ... counter['B'] += 1 ... except KeyError: ...

Re: python 3: sorting with a comparison function

2008-10-10 Thread pruebauno
On Oct 10, 8:35 am, Kay Schluehr [EMAIL PROTECTED] wrote: On 9 Okt., 22:36, [EMAIL PROTECTED] wrote: Yes, that's a wonderful thing, because from the code I see around 99.9% of people see the cmp and just use it, totally ignoring the presence of the 'key' argument, that allows better and

Re: Dict Comprehension ?

2008-10-06 Thread pruebauno
On Oct 6, 8:59 am, Ernst-Ludwig Brust [EMAIL PROTECTED] wrote: Given 2 Number-Lists say l0 and l1, count the various positiv differences between the 2 lists the following part works: dif=[abs(x-y) for x in l0 for y in l1] da={} for d in dif: da[d]=da.get(d,0)+1 i wonder, if there is a

Re: Builing Python 2.6 on AIX 5.2

2008-10-06 Thread pruebauno
On Oct 6, 4:16 am, brasse [EMAIL PROTECTED] wrote: Hello! I am having some trouble building Python 2.6 on AIX. The steps I have taken are: export PATH=/usr/bin/:/usr/vacpp/bin/ ./configure --with-gcc=xlc_r --with-cxx=xlC_r --disable-ipv6 make This is the error message I'm seeing:

Re: Builing Python 2.6 on AIX 5.2

2008-10-06 Thread pruebauno
On Oct 6, 11:03 am, Jesse Noller [EMAIL PROTECTED] wrote: Looks like AIX is missing sem_timedwait - see:http://bugs.python.org/issue3876 Please add your error to the bug report just so I can track it. -jesse On Mon, Oct 6, 2008 at 4:16 AM, brasse [EMAIL PROTECTED] wrote: Hello! I am

Re: improving a huge double-for cycle

2008-09-19 Thread pruebauno
On Sep 18, 7:42 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Thu, 18 Sep 2008 20:43:00 +0200, Bruno Desthuilliers wrote: Now the obvious winner is pruebono - even unoptimized, using sets seems to be *way* faster than even the most optimized corrected version of your

Re: improving a huge double-for cycle

2008-09-18 Thread pruebauno
On Sep 18, 8:25 am, Alexzive [EMAIL PROTECTED] wrote: Hello there :) , I am a python newbie and need to run following code for a task in an external simulation programm called Abaqus which makes use of python to access the mesh (ensamble of nodes with xy coordinates) of a certain geometrical

Re: dict generator question

2008-09-18 Thread pruebauno
On Sep 18, 10:54 am, Simon Mullis [EMAIL PROTECTED] wrote: Hi, Let's say I have an arbitrary list of minor software versions of an imaginary software product: l = [ 1.1.1.1, 1.2.2.2, 1.2.2.3, 1.3.1.2, 1.3.4.5] I'd like to create a dict with major_version : count. (So, in this case:

Re: dict generator question

2008-09-18 Thread pruebauno
On Sep 18, 10:54 am, Simon Mullis [EMAIL PROTECTED] wrote: Hi, Let's say I have an arbitrary list of minor software versions of an imaginary software product: l = [ 1.1.1.1, 1.2.2.2, 1.2.2.3, 1.3.1.2, 1.3.4.5] I'd like to create a dict with major_version : count. (So, in this case:

Re: List of modules available for import inside Python?

2008-08-28 Thread pruebauno
On Aug 28, 12:21 am, ssecorp [EMAIL PROTECTED] wrote: Is there a way to view all the modules I have available for import from within Python? Like writing in the interpreter: import.modules Also, is there anything like Cpan for Python? Isn't the most obvious answer to the first question this

Re: Native Code vs. Python code for modules

2008-07-30 Thread pruebauno
On Jul 29, 11:56 pm, koblas [EMAIL PROTECTED] wrote: better if there was a way that if I have an interface compatible native (aka C) module that has better performance that there could be a way that python would give it preference. e.g. import random(version=1.2, lang=c) or import

Re: Why does list have no 'get' method?

2008-02-08 Thread pruebauno
On Feb 7, 4:36 pm, George Sakkis [EMAIL PROTECTED] wrote: On Feb 7, 4:25 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Thu, 07 Feb 2008 15:59:13 +0100, Wildemar Wildenburger wrote: Arnaud Delobelle wrote: Personally, between * foo if foo else bar * foo or

Re: Why does list have no 'get' method?

2008-02-07 Thread pruebauno
On Feb 7, 12:15 pm, [EMAIL PROTECTED] wrote: On Feb 7, 11:01 am, Denis Bilenko [EMAIL PROTECTED] wrote: Steve Holden wrote: These versions differ with respect to treatment of blank lines, which indicates how easy it is to go astray in this kind of semantic optimization. Your

Re: Why does list have no 'get' method?

2008-02-07 Thread pruebauno
On Feb 7, 11:01 am, Denis Bilenko [EMAIL PROTECTED] wrote: Steve Holden wrote: These versions differ with respect to treatment of blank lines, which indicates how easy it is to go astray in this kind of semantic optimization. Your example simply wouldn't work (though you could patch it

Re: Compiling python2.5 on IBM AIX

2007-07-17 Thread pruebauno
On Jul 17, 3:58 am, [EMAIL PROTECTED] wrote: I haven't compiled it myself, but I'm told that the installation I work with was compiled with: export PATH=$PATH:/usr/vacpp/bin:/usr/vacpp/lib ./configure --with-gcc=xlc_r -q64 --with-cxx=xlC_r -q64 --disable- ipv6 AR=ar -X64 make make

Re: Dict Help

2007-07-17 Thread pruebauno
On Jul 17, 5:57 am, Robert Rawlins - Think Blue [EMAIL PROTECTED] wrote: Morning Gabriel, I'm looking for a little more advice on this dictionary/list to defaultdict/set conversion that we were talking about, there were a few things I was looking to clarify. Firstly, what is the difference

Re: compiling on AIX 5.3 with vacpp

2006-11-01 Thread pruebauno
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I am trying to compile Python 2.5 on AIX 5.3. I used building '_locale' extension ./Modules/ld_so_aix xlc_r -q64 -bI:Modules/python.exp build/temp.aix-5.3-2.5/home/pxadm/.test/Python-2.5/Modules/_localemodule.o -L/usr/local/lib -o

compiling on AIX 5.3 with vacpp

2006-10-26 Thread pruebauno
I am trying to compile Python 2.5 on AIX 5.3. I used export PATH=/usr/bin:/usr/vacpp/bin OPT=-O2 ./configure --with-gcc=xlc_r -q64 --with-cxx=xlC_r -q64 --disable-ipv6 AR=ar -X64 make The following error stops make in its track: building '_locale' extension ./Modules/ld_so_aix xlc_r -q64

Re: definitive source on advanced python?

2006-04-06 Thread pruebauno
vdrab wrote: Hi all, Is there some sort of coherent source (dead tree format, maybe?) on some of the more advanced features of python (decorators, metaclasses, etc)? I'm sort of looking for a If you just want a good book in feature description I recomend Python in a Nutshell. It will

Re: How to debug python code?

2006-03-31 Thread pruebauno
[EMAIL PROTECTED] wrote: hi, I am new to Python programming.I am not getting exactly pdb.Can anyone tell me effective way to debug python code? Please give me any example. Looking for responce. Thank You. Sushant If you are having issues you also might want to

Re: tricky time interval billing problem

2005-12-06 Thread pruebauno
First of all, you need to use ordering to ensure that the database gives you the most convenient order for processing, as this will make your computations much easier. So I'd suggest sorting by clientNumber, ServiceNumber, Begindate and Enddate. That way you can consider each service

tricky time interval billing problem

2005-12-05 Thread pruebauno
I am currently working on a tricky problem at work. I googled around a bit, but time intervals did not come up with anything useful. Although I have some rough idea of how I could solve it, I still would value some input. I have information of (It has only couple dozen entries.) ServiceNum,

Re: anaconda.real in RH7.1

2005-09-02 Thread pruebauno
Allan Adler wrote: I'm using the book, Programming Python, by Mark Lutz, as a reference. No offence to Mark Lutz or O'Reilly but I consider Programming Python one of the worst books I have read (in my case an old first edition). It overwhelms the beginning programmer (Learning Python is probably

Re: Improving my text processing script

2005-09-01 Thread pruebauno
Paul McGuire wrote: match...), this program has quite a few holes. What if the word Identifier is inside one of the quoted strings? What if the actual value is tablename10? This will match your tablename1 string search, but it is certainly not what you want. Did you know there are trailing

Re: Improving my text processing script

2005-09-01 Thread pruebauno
Miki Tebeka wrote: Look at re.findall, I think it'll be easier. Minor changes aside the interesting thing, as you pointed out, would be using re.findall. I could not figure out how to. -- http://mail.python.org/mailman/listinfo/python-list

Re: Improving my text processing script

2005-09-01 Thread pruebauno
[EMAIL PROTECTED] wrote: Paul McGuire wrote: match...), this program has quite a few holes. tried run it though and it is not working for me. The following code runs but prints nothing at all: import pyparsing as prs And this is the point where I have to post the real stuff because your

Improving my text processing script

2005-08-31 Thread pruebauno
I am sure there is a better way of writing this, but how? import re f=file('tlst') tlst=f.read().split('\n') f.close() f=file('plst') sep=re.compile('Identifier (.*?)') plst=[] for elem in f.read().split('Identifier'): content='Identifier'+elem match=sep.search(content) if

  1   2   >