Re: Py3K idea: why not drop the colon?

2006-11-16 Thread Neil Cerutti
accept it as a given and get on with more productive activities? That's all very well if the language has a compromised and ad-hoc syntax. But since Python has a nice clean syntax, it makes me want to be associated with it by investing in its discussions. ;-) -- Neil Cerutti -- http

Re: remove a list from a list

2006-11-17 Thread Neil Cerutti
of troubling about mutating the list. Unless the list is needed in more than one place. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble writing results to files

2006-11-29 Thread Neil Cerutti
On 2006-11-29, Roberto Bonvallet [EMAIL PROTECTED] wrote: BTW, iterating over range(len(a)) is an anti-pattern in Python. Unless you're modifying elements of a, surely? -- Neil Cerutti You can't give him that cutback lane. He's so fast, and he sees it so well. He can also run away from you

Re: How to detect what type a variable is?

2006-11-29 Thread Neil Cerutti
) type 'str' i = 0 type(i) type 'int' That makes me wonder how he manages to store Python objects in xml. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble writing results to files

2006-11-29 Thread Neil Cerutti
On 2006-11-29, Roberto Bonvallet [EMAIL PROTECTED] wrote: Neil Cerutti wrote: On 2006-11-29, Roberto Bonvallet [EMAIL PROTECTED] wrote: BTW, iterating over range(len(a)) is an anti-pattern in Python. Unless you're modifying elements of a, surely? enumerate is your friend :) for n

Re: Trying to understand rfc822.Message() behaviour

2006-11-30 Thread Neil Cerutti
, ordinary file objects qualify. Instantiation reads headers from the input object up to a delimiter line (normally a blank line) and stores them in the instance. The message body, following the headers, is not consumed. -- Neil Cerutti We dispense with accuracy --sign at New York drug

Re: Automatic increment

2006-11-30 Thread Neil Cerutti
as the best way of removing the manual counters. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread Neil Cerutti
] -- Neil Cerutti I guess there are some operas I can tolerate and Italian isn't one of them. --Music Lit Essay -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread Neil Cerutti
On 2006-11-30, Neil Cerutti [EMAIL PROTECTED] wrote: On 2006-11-30, John Henry [EMAIL PROTECTED] wrote: If I have a list of say, 10 elements and I need to slice it into irregular size list, I would have to create a bunch of temporary variables and then regroup them afterwords, like: # Just

Re: Detecting recursion loops

2006-12-01 Thread Neil Cerutti
-(content)-relaying sends you around in a circle through a complex handler chain. Being in a cycle doesn't actually prove your program will never halt for that particular input, does it? -- Neil Cerutti Customers who consider our waitresses uncivil ought to see the manager --sign at New York

Re: converting dict to object

2006-12-02 Thread Neil Cerutti
'] Ok, I go out... -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: converting dict to object

2006-12-02 Thread Neil Cerutti
On 2006-12-02, John Machin [EMAIL PROTECTED] wrote: Neil Cerutti wrote: On 2006-12-02, Michel Claveau [EMAIL PROTECTED] wrote: Hi! Yes. But... Try:d = {'a': 1, 'b': 2, 'def': 123} Ok, I go out... How to convert a list of strings into a list of integers: a = ['82', '4

Re: text adventure question

2006-12-02 Thread Neil Cerutti
Design and implement a full-size game. Submit it to testing, fix all resulting bugs, help marketing design a package, ship the game, and sell at lest 250,000 units. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Execution time of lines within a function

2006-12-04 Thread Neil Cerutti
. That may help. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Execution time of lines within a function

2006-12-04 Thread Neil Cerutti
, but the rest seems at too low a level for me to understand which statements are causing the slow execution. hw6r3.py:276(main) hw6r3.py:73(findw)(100) 26700.865 Is this the print_callees output? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Neil Cerutti
another programmer who might be in the middle of something. The stuffed animal often provided all the assistance that was needed. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Why not just show the out-of-range index?

2006-12-07 Thread Neil Cerutti
. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-08 Thread Neil Cerutti
with practice. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Snake references just as ok as Monty Python jokes/references in python community? :)

2006-12-08 Thread Neil Cerutti
think the decent people of this newsgroup are sick and tired of being told that the decent people of this newsgroup are sick and tired. I'm certainly not! And I'm sick and tired of being told that I am. -- Neil Cerutti Sermon Outline: I. Delineate your fear II. Disown your fear III. Displace your

Re: merits of Lisp vs Python

2006-12-11 Thread Neil Cerutti
was supposed to be in the midst of the mind-boggling. I meant to get back to it but haven't yet. -- Neil Cerutti We will sell gasoline to anyone in a glass container. --sign at Santa Fe gas station -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-12 Thread Neil Cerutti
. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-12 Thread Neil Cerutti
On 2006-12-13, hit_the_lights [EMAIL PROTECTED] wrote: Neil Cerutti schrieb: a[i] = b[n] with (setf (aref a i) (aref b n)) and the attractions of Python may make more sense. Here Python and Lisp are equal, 7 tokens vs 7 tokens, but in Python one has to write less since

Re: merits of Lisp vs Python

2006-12-12 Thread Neil Cerutti
it cannot read the original programmer's mind, and you have to fix it manually, and risk screwing it up. It is very easy a manual process, possibly as simple as selecting the correct s-expr and pasting it into the right place in your code. -- Neil Cerutti -- http://mail.python.org/mailman

Re: Conditional iteration

2006-12-13 Thread Neil Cerutti
they would be redundant? This could be more convenient to you, but certainly not pythonic. Cheers, I tried it once myself. It seemed like a feasible thing that might work in Python. It didn't annoy me that it didn't work, but it did seem natural to me given the syntax of comprehensions. -- Neil

Re: merits of Lisp vs Python

2006-12-14 Thread Neil Cerutti
On 2006-12-14, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Neil Cerutti wrote: On 2006-12-13, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Expressions keep the same meaning even if you have to start breaking them across lines, etc. Yes, it's the same way in Python. Of course, not everything

Re: merits of Lisp vs Python

2006-12-14 Thread Neil Cerutti
On 2006-12-14, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Neil Cerutti wrote: On 2006-12-14, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Neil Cerutti wrote: On 2006-12-13, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Expressions keep the same meaning even if you have to start

Re: Routine for prefixing '' before every line of a string

2006-12-14 Thread Neil Cerutti
in textwrap.wrap(text, width=75)] The solution will need to be instrumented in case of text that is already quotes to one level. All in all, I recommend using Vim's gq command or Emacs' autofill mode, which arlready do the right thing. -- Neil Cerutti The Rev. Merriwether spoke briefly, much to the delight

Re: tuple.index()

2006-12-14 Thread Neil Cerutti
applies to strings, which now have plenty of methods. -- Neil Cerutti Weight Watchers will meet at 7 p.m. Please use large double door at the side entrance. --Church Bulletin Blooper -- http://mail.python.org/mailman/listinfo/python-list

Re: WHAT is [0] in subprocess.Popen(blah).communicate()[0]

2006-12-14 Thread Neil Cerutti
() -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-15 Thread Neil Cerutti
a house. It doesn't make me want to live in a cave. ;-) -- Neil Cerutti The third verse of Blessed Assurance will be sung without musical accomplishment. --Church Bulletin Blooper -- http://mail.python.org/mailman/listinfo/python-list

Re: array, a better shell

2006-12-20 Thread Neil Cerutti
: a.extend(hello) Traceback (most recent call last): File stdin, line 1, in module TypeError: an integer is required Try: a.fromstring(hello) -- Neil Cerutti I have opinions of my own -- strong opinions -- but I don't always agree with them. --George W. Bush -- http://mail.python.org/mailman

Re: DOS, UNIX and tabs

2007-01-02 Thread Neil Cerutti
of choice (by historical accident) Vim, doesn't yet support it. -- Neil Cerutti I've had a wonderful evening, but this wasn't it. --Groucho Marx -- http://mail.python.org/mailman/listinfo/python-list

Re: array of class / code optimization

2007-01-03 Thread Neil Cerutti
: int x, y; }; The only difference between struct and class in C++ is the default access specification of its members. -- Neil Cerutti For those of you who have children and don't know it, we have a nursery downstairs. --Church Bulletin Blooper -- http://mail.python.org/mailman/listinfo/python

Re: Sorting on multiple values, some ascending, some descending

2007-01-04 Thread Neil Cerutti
. a = [(Neil Cerutti, 8025552954), (Ted Smith, 8025552281), (Barny Fife, 8025551105)] b = [( .join(reversed(x.split())), y) for (x, y) in a] b [('Cerutti Neil', '8025552954'), ('Smith Ted', '8025552281'), ('Fife Barny', '8025551105')] b.sort() b [('Cerutti Neil', '8025552954'), ('Fife Barny

Re: Sorting on multiple values, some ascending, some descending

2007-01-04 Thread Neil Cerutti
On 2007-01-04, Peter Otten [EMAIL PROTECTED] wrote: Neil Cerutti wrote: Another trick is to factor the key application out of the sort. This may be a good idea if when you want to minimize the number of times your key function is called. The idea is to mangle the list temporarily so you can

Re: Why less emphasis on private data?

2007-01-08 Thread Neil Cerutti
a = A() a.foo() print a._B__x a.bar() print a._B__x Sure enough, mod2 messes up mod1's private variable. When faced with this situation, is there any way to proceed besides using composition instead? -- Neil Cerutti We've got to pause and ask ourselves: How much clean air do we

Re: recursive function

2007-01-08 Thread Neil Cerutti
, in this case it should return: [((3, 4), (5, 4), (16, 1)), ((3, 4), (21, 3), (0, 2)), ((5, 8), (19, 2), (0, 2))] What do you mean by most inner tuple? A simple list comprehension would be enough if only I knew the number of keys/lists beforehand len(dict.keys()). -- Neil Cerutti Next

Re: Why less emphasis on private data?

2007-01-08 Thread Neil Cerutti
struct idiom to hide data. For example, the standard FILE pointer. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Why less emphasis on private data?

2007-01-08 Thread Neil Cerutti
On 2007-01-08, Jussi Salmela [EMAIL PROTECTED] wrote: Neil Cerutti kirjoitti: In C one uses the pointer to opaque struct idiom to hide data. For example, the standard FILE pointer. To Neil Cerutti: If a programmer in C has got a pointer to some piece of memory, that piece is at the mercy

Re: Colons, indentation and reformatting.

2007-01-09 Thread Neil Cerutti
way to determine where the block is supposed to end. -- Neil Cerutti Remember in prayer the many who are sick of our church and community. --Church Bulletin Blooper -- http://mail.python.org/mailman/listinfo/python-list

Re: Determine an object is a subclass of another

2007-01-09 Thread Neil Cerutti
Dog(Animal): pass -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

A simple lexer

2007-01-09 Thread Neil Cerutti
) ix = m(o_bracket, ix) ix = m(c_bracket, ix) ix = m(colon, ix) if ix == old: print Parse error at %s of %s % (proto[ix:], proto) ix = len(proto) return lexed_line if __name__ == __main__: import doctest doctest.testmod() -- Neil Cerutti

An iterator with look-ahead

2007-01-10 Thread Neil Cerutti
= self.iter.next() except StopIteration: if self.exhausted: raise else: self.exhausted = True return item -- Neil Cerutti We've got to pause and ask ourselves: How much clean air do we really need? --Lee Iacocca -- http

Working with named groups in re module

2007-01-10 Thread Neil Cerutti
in r.groupindex: if m.group(k): # Find the token type. token = (k, m.group()) I wish I could do something obvious instead, like m.name(). -- Neil Cerutti After finding no qualified candidates for the position of principal, the school board is pleased to announce the appointment of David

Re: An iterator with look-ahead

2007-01-10 Thread Neil Cerutti
. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Working with named groups in re module

2007-01-10 Thread Neil Cerutti
On 2007-01-10, Fredrik Lundh [EMAIL PROTECTED] wrote: Neil Cerutti wrote: A found some clues on lexing using the re module in Python in an article by Martin L÷wis. Here, each alternative in the regular expression defines a named group. Scanning proceeds in the following steps: 1

Re: Need startup suggestions for writing a MSA viewer GUI in python

2007-01-10 Thread Neil Cerutti
. -- Neil Cerutti The concert held in Fellowship Hall was a great success. Special thanks are due to the minister's daughter, who labored the whole evening at the piano, which as usual fell upon her. --Church Bulletin Blooper -- http://mail.python.org/mailman/listinfo/python-list

Re: An iterator with look-ahead

2007-01-10 Thread Neil Cerutti
On 2007-01-10, Steven Bethard [EMAIL PROTECTED] wrote: Neil Cerutti wrote: For use in a hand-coded parser I wrote the following simple iterator with look-ahead. There's a recipe for this: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/304373 Note that the recipe efficiently

Re: Print message with Colors

2007-01-11 Thread Neil Cerutti
because Python on those platforms in a console application, which on NT, 2000 and XP doesn't support ANSI escape sequences. It makes IPython's appearance less cool. :-( Try http://effbot.org/downloads/#console for color output that works. -- Neil Cerutti We're going to be exciting. Of course

Re: Type casting a base class to a derived one?

2007-01-11 Thread Neil Cerutti
, base_object): # ( copy all attributes ) ... This looks expensive. Moreover __init__ () may not be available if it needs to to something else. Thanks for suggestions How does it make sense to cast a base to a derived in your application? -- Neil Cerutti I'm traveling to all 51 states

Re: __init__ vs __new__

2007-01-11 Thread Neil Cerutti
the below idiom might save you from a gotcha someday. class JsubroutineParameters(list): def __init__(self, alist=None): if alist is None: alist = [] for objekt in alist: _validateParameter(objekt) list.__init__(self, alist) You will no longer need to call append. -- Neil Cerutti

Re: What happened to SPE?

2007-01-11 Thread Neil Cerutti
/projects/spe/ -- Neil Cerutti We don't necessarily discriminate. We simply exclude certain types of people. --Colonel Gerald Wellman -- http://mail.python.org/mailman/listinfo/python-list

Re: Fixed keys() mapping

2007-01-11 Thread Neil Cerutti
see any problem with it. It sounds cool. -- Neil Cerutti It isn't pollution that is hurting the environment; it's the impurities in our air and water that are doing it. --Dan Quayle -- http://mail.python.org/mailman/listinfo/python-list

Re: passing a variable to an external program

2007-01-11 Thread Neil Cerutti
' + pathname + '\test.vbs') Use / instead of \, or \\ instead of \. -- Neil Cerutti Ushers will eat latecomers. --Church Bulletin Blooper -- http://mail.python.org/mailman/listinfo/python-list

Re: Matching Directory Names and Grouping Them

2007-01-12 Thread Neil Cerutti
, to suppress that trailing blank line, but I kept getting confused and couldn't sort it out. It would better to use the os.path module, but I couldn't find the function in there lets me pull out path tails. I didn't filter out stuff that didn't match the date path convention you used. -- Neil

Re: Boilerplate in rich comparison methods

2007-01-13 Thread Neil Cerutti
] Anyone want to argue that this is a worthwhile optimization? :) Perhaps. But first test it with ==. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Anyone has a nice view_var procedure ?

2007-01-16 Thread Neil Cerutti
releases. In other words, dir is just for fun, like monkey bars. ;) -- Neil Cerutti The eighth-graders will be presenting Shakespeare's Hamlet in the church basement on Friday at 7 p.m. The congregation is invited to attend this tragedy. --Church Bulletin Blooper -- http://mail.python.org

Re: whats wrong with my reg expression ?

2007-01-16 Thread Neil Cerutti
('value') AttributeError: 'NoneType' object has no attribute 'group' When the regex doesn't match, match returns None. -- Neil Cerutti Strangely, in slow motion replay, the ball seemed to hang in the air for even longer. --David Acfield -- http://mail.python.org/mailman/listinfo/python-list

Re: assert versus print [was Re: The curious behavior of integer objects]

2007-01-16 Thread Neil Cerutti
. ;-) -- Neil Cerutti Facts are stupid things. --Ronald Reagan -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular expressions question

2007-01-16 Thread Neil Cerutti
= re.search('\*\s+(\d+)', g) r.group() '* 4' r.group(1) '4' -- Neil Cerutti We're not afraid of challenges. It's like we always say: If you want to go out in the rain, be prepared to get burned. --Brazillian soccer player -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular expressions question

2007-01-16 Thread Neil Cerutti
On 2007-01-16, Victor Polukcht [EMAIL PROTECTED] wrote: On Jan 16, 5:40 pm, Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-01-16, Victor Polukcht [EMAIL PROTECTED] wrote: Actually, i'm trying to get the values of first field (Global) , fourth (200, 4), and fifth (100%) and sixth (100

Re: A note on heapq module

2007-01-17 Thread Neil Cerutti
++'s std::priority_queue for that reason (unless I'm confused again). -- Neil Cerutti We will sell gasoline to anyone in a glass container. --sign at Santa Fe gas station -- http://mail.python.org/mailman/listinfo/python-list

Re: generate tuples from sequence

2007-01-17 Thread Neil Cerutti
(5.16.3). def grouper(n, iterable, padvalue=None): grouper(3, 'abcdefg', 'x') -- ('a','b','c'), ('d','e','f'), ('g','x','x') return izip(*[chain(iterable, repeat(padvalue, n-1))]*n) It's more general and cryptic than what you asked for, though. -- Neil Cerutti We're not afraid of challenges

Re: A note on heapq module

2007-01-18 Thread Neil Cerutti
On 2007-01-18, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Neil Cerutti: One more idea, cribbed from the linked list thread elsewhere: it might be nice if your Heap could optionally use an underlying collections.deque instead of a list. I don't know how excellent Python's deque is, but it's

Re: One more regular expressions question

2007-01-18 Thread Neil Cerutti
to help yourself. Also, use more helpful names. With names like var1 and var2 you might as well not used named groups. r = re.compile(r(?x) (?Perror [^(]+ ) (?Perrno \d+ ) \) \s+ (?Plineno \d+ )) This way it's clearer that there's a \) with no matching \(. -- Neil Cerutti

Re: A note on heapq module

2007-01-18 Thread Neil Cerutti
On 2007-01-18, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Neil Cerutti: One more idea, cribbed from the linked list thread elsewhere: it might be nice if your Heap could optionally use an underlying collections.deque instead of a list. I don't know how excellent Python's deque is, but it's

Re: Traversing the properties of a Class

2007-01-18 Thread Neil Cerutti
-- Neil Cerutti -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I create a linked list in Python?

2007-01-18 Thread Neil Cerutti
case in cdr, but I couldn't figure out a neat way to do it. -- Neil Cerutti I've had a wonderful evening, but this wasn't it. --Groucho Marx -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: OT Annoying Habits (Was: when format strings attack)

2007-01-20 Thread Neil Cerutti
, to Lotus Notes (ARRGH!), then a happy time using IMAP, and now back to (ARRGH!). -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Are there sprintf in Python???

2007-01-23 Thread Neil Cerutti
, *objects): return format % tuple(objects) Since strings are immutable it's not convenient to provide a pass-out parameter as in C. If you want to check for errors you'll have to catch the exceptions, rather than inspect the return value as you can in C. -- Neil Cerutti Symphonies of the Romantic

Re: Best way to document Python code...

2007-01-23 Thread Neil Cerutti
() at the interactive prompt to get started. -- Neil Cerutti Will the last person to leave please see that the perpetual light is extinguished --sign at New England church -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: match nested parenthesis

2007-01-23 Thread Neil Cerutti
. A stack-based solution (implemented using a list as a stack) should be easy enough. -- Neil Cerutti And now the sequence of events in no particular order. --Dan Rather -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Thoughts on using isinstance

2007-01-24 Thread Neil Cerutti
string. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Re-thinking my if-thens - a software engineering question

2007-01-24 Thread Neil Cerutti
solution informs the design of something better. 2. a) Got to 1. a) In the case above, I've tried to figure out what you're specifically doing, and failed. So I don't have more specific advice. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Static variables

2007-01-24 Thread Neil Cerutti
in range(5): ... foo(!) ... 0 ! 1 ! 2 ! 3 ! 4 ! The latter is not as nice, since your static variable is easy to clobber by passing something into the function. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Please have a look at this class

2007-01-25 Thread Neil Cerutti
without needing to copy them. Unfortunately it only works for one level of call. I think. -- Neil Cerutti -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: python+ncurses: I can't display accents

2007-01-26 Thread Neil Cerutti
to display those chars. What have you tried? -- Neil Cerutti -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: python+ncurses: I can't display accents

2007-01-26 Thread Neil Cerutti
have #!/usr/local/bin/python #coding: iso8859-15 Be sure to write your non-ASCII strings as unicode literals, and then encode them just before displaying or storing them somewhere. -- Neil Cerutti -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org

Re: Convert String to list of chars

2007-01-26 Thread Neil Cerutti
On 2007-01-27, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: How can I convert a string to a char list? for example hello -- ['h','e','l','l','o'] I have been searching but I can't find my answers list(hello) -- http://mail.python.org/mailman/listinfo/python-list

Re: python+ncurses: I can't display accents

2007-01-26 Thread Neil Cerutti
On 2007-01-27, Thomas Dickey [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote: I don't really expect it to work, but if anything will, that is it. Curses supports only ASCII and a some special symbol codes defined by curses. un - no. Curses supports whatever the flavor

Re: Help me understand this

2007-01-30 Thread Neil Cerutti
| enclosure literal ::= stringliteral | integer | longinteger | floatnumber | imagnumber An integer is a primary so 2.__add(1) should be valid. Not if the tokenizer passes the parser a float. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: division by 7 efficiently ???

2007-02-02 Thread Neil Cerutti
div7 (700) 98 div7 (7000) 984 Heh, heh. That's reminding of the fabulous O(n) Dropsort algorithm I saw linked from Effbot's blog. -- Neil Cerutti I'm tired of hearing about money, money, money, money, money. I just want to play the game, drink Pepsi, wear Reebok. --Shaquille O'Neal -- http

Re: How do I print out in the standard output coloured lines

2007-02-02 Thread Neil Cerutti
sequences. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: need help on a data structure problem

2007-02-02 Thread Neil Cerutti
, with your teacher. Also: comp.algorithms is the usual Usenet place for discussion of algorithms and data structures. However most of the talk there is pretty high-falutin'. -- Neil Cerutti It isn't pollution that is hurting the environment; it's the impurities in our air and water that are doing

Re: Overloading the tilde operator?

2007-02-02 Thread Neil Cerutti
here. You can override most of the operators, but you cannot change their arity, associativity, or precedence level. -- Neil Cerutti Let us join David and Lisa in the celebration of their wedding and bring their happiness to a conclusion. --Church Bulletin Blooper -- http://mail.python.org

Re: newbie/ merging lists of lists with items in common

2007-02-02 Thread Neil Cerutti
itertools import groupby def key_func(t): return t[0] groups = groupby(sorted(seq, key=key_func), key_func) seq = [] for item in groups: seq.append([item[0], [a[1] for a in item[1]]]) return seq -- Neil Cerutti Music gets more chromatic and heavy towards

Re: newbie/ merging lists of lists with items in common

2007-02-02 Thread Neil Cerutti
On 2007-02-02, Laurent Pointal [EMAIL PROTECTED] wrote: Neil Cerutti a écrit : On 2007-02-02, ardief [EMAIL PROTECTED] wrote: zip This is a job for... duhn-duhn-DH! Captain CHAOS! Er... I mean itertools.groupby. zip def key_func(t): return t[0] Not needed: -- from

Re: Writing pythonish code

2007-02-02 Thread Neil Cerutti
subclasses!) to access the member. Difficult though -- not impossible. I think it's best to never use such names in new code. Python's mangling is troubled, since it uses unqualified names in the mangle, resulting in ambiguity. -- Neil Cerutti Ushers will eat latecomers. --Church Bulletin Blooper

Re: Checking default arguments

2007-02-02 Thread Neil Cerutti
if the user supplies the second argument, and a list otherwise. def foo(x, *args): if len(args) == 0: y_provided = True y = bar else: y_provided = False y = args[0] if y_provided: return (x, y) else: return [x, y] -- Neil Cerutti Wonderful bargains for men with 16

Re: How to suppress DeprecationWarning: Old style callback, use cb_func(ok, store) instead

2007-02-03 Thread Neil Cerutti
: warnings.simplefilter(ignore,DeprecationWarning) (same as using option -Wignore::DeprecationWarning on the python command line) Ah, yes! The null module. Python should have more of these. I mean shouldn't. ;) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: confused about resizing array in Python

2007-02-05 Thread Neil Cerutti
will come fairly close to Python semantics. -- Neil Cerutti Eddie Robinson is about one word: winning and losing. --Eddie Robinson's agent Paul Collier -- http://mail.python.org/mailman/listinfo/python-list

Re: HELP NEEDED ... Regd. Regular expressions PyQt

2007-02-05 Thread Neil Cerutti
On 2007-02-03, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I am trying to work out a regular expression in a PyQt environment for time in hh:mm:ss format. Any suggestions? After you find your time in hh:mm:ss format, be sure to check out time.strptime for a quick conversion. -- Neil Cerutti

Re: Trouble fixing a broken ASCII string - replace mode in codec not working.

2007-02-06 Thread Neil Cerutti
on that must uses a Latin-1 byte-encoding internally, but displays on stdout in ascii. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Vim search under cursor

2007-02-07 Thread Neil Cerutti
for os.error rather than error. How to set this, any Idea? It's will to break things, but you can do this by editing the iskeyword string and adding in the '.'. :h 'iskeyword'. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: doctests for interactive functions

2007-02-08 Thread Neil Cerutti
done in these cases is create a file containing my test input, and before running the doctests I remap sys.stdin to my file of test data. Then you don't need test code cluttering up your functions. -- Neil Cerutti We don't necessarily discriminate. We simply exclude certain types of people

Re: doctests for interactive functions

2007-02-09 Thread Neil Cerutti
simple, or even absent. Note that sequestering the test input in a file doesn't allow for good examples, unfortunately. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Is Python for me?

2007-02-09 Thread Neil Cerutti
for a while. -- Neil Cerutti The recording I listened to had Alfred Brendel doing the dirty work of performing this sonata (Liszt B minor) --Music Lit Essay -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find all the same words in a text?

2007-02-11 Thread Neil Cerutti
actual words for the word you're looking for. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: gvim: doc string editing

2007-02-11 Thread Neil Cerutti
format_comments for the full dope. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular Expressions

2007-02-12 Thread Neil Cerutti
On 2007-02-10, Geoff Hill [EMAIL PROTECTED] wrote: What's the way to go about learning Python's regular expressions? I feel like such an idiot - being so strong in a programming language but knowing nothing about RE. A great way to learn regular expressions is to implement them. -- Neil

<    1   2   3   4   5   6   7   8   9   10   >