Re: problem with split

2006-10-07 Thread hanumizzle
On 6 Oct 2006 23:09:08 -0700, MonkeeSage [EMAIL PROTECTED] wrote: On Oct 6, 11:33 pm, hanumizzle [EMAIL PROTECTED] wrote: import re snip if line.startswith('instr'): p = re.compile(r'(\d+)\s+;(.*)$') m = p.search(line) return (m.group(1), m.group(2)) You probably don't

Re: Subclassing built-in classes

2006-10-07 Thread hanumizzle
On 10/7/06, Gabriel Genellina [EMAIL PROTECTED] wrote: At Friday 6/10/2006 06:58, Maric Michaud wrote: As the first post said ...couldn't python (in theory)..., I was discussing if it would be possible for python (in some future version) to manage the literals so that they use the

Re: Rich text processor component

2006-10-07 Thread hanumizzle
On 10/6/06, Jorge Vilela [EMAIL PROTECTED] wrote: Hello, do anyone know if exists anything about rich text processor in python, as a component or good tutorial about it? http://pyrtf.sourceforge.net/ Regards, Theerasak -- http://mail.python.org/mailman/listinfo/python-list

Re: need some regular expression help

2006-10-07 Thread hanumizzle
On 7 Oct 2006 15:00:29 -0700, Diez B. Roggisch [EMAIL PROTECTED] wrote: Chris wrote: I need a pattern that matches a string that has the same number of '(' as ')': findall( compile('...'), '42^((2x+2)sin(x)) + (log(2)/log(5))' ) = [ '((2x+2)sin(x))', '(log(2)/log(5))' ] Can anybody

Re: Is there an alternative to os.walk?

2006-10-07 Thread hanumizzle
On 10/8/06, Tim Roberts [EMAIL PROTECTED] wrote: Umm, may I point out that you don't NEED the os.path.exists call, because you are already being HANDED a list of all the filenames in that directory? You could dirtest with this much faster routinee: def dirtest(a_dir,filenames): for f in

Re: Raw beginner....

2006-10-07 Thread hanumizzle
On 10/8/06, Colin Lehmann [EMAIL PROTECTED] wrote: I am new to Python although I have been using Delphi since version one, I have been employed as a C and C++ programmer so when I went to Linux (Ubuntu 5.10) I thought Python looked pretty good. I downloaded and installed 'Eric Python IDE'

Re: help on pickle tool

2006-10-06 Thread hanumizzle
On 5 Oct 2006 22:54:46 -0700, MonkeeSage [EMAIL PROTECTED] wrote: hanumizzle wrote: Why a subset? I don't think JSON is a subset of YAML. Apparent slip of the fingers by OP. From JSON website: JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans

Re: help on pickle tool

2006-10-06 Thread hanumizzle
On 5 Oct 2006 23:19:18 -0700, MonkeeSage [EMAIL PROTECTED] wrote: On Oct 6, 1:06 am, hanumizzle [EMAIL PROTECTED] wrote: I'm happy with my Pythonesque YAML syntax, thank you. :) YAML is a little more complex, and a little more mature. But JSON should not be ruled out. I actually like JSON

Re: profiling memory usage

2006-10-06 Thread hanumizzle
On 5 Oct 2006 16:21:50 -0700, Eddie [EMAIL PROTECTED] wrote: Hi, I am looking for a method to profile memory usage in my python program. The program provides web service and therefore is intended to run for a long time. However, the memory usage tends to increase all the time, until in a day

Re: help on pickle tool

2006-10-06 Thread hanumizzle
On 10/6/06, Fredrik Lundh [EMAIL PROTECTED] wrote: MonkeeSage wrote: YAML is a little more complex a little? when did you last look at the spec? and a little more mature. than JavaScript's expression syntax? are you sure you're not confusing libraries with standards here? (has

Re: help on pickle tool

2006-10-06 Thread hanumizzle
On 10/6/06, Fredrik Lundh [EMAIL PROTECTED] wrote: hanumizzle wrote: I guess I'll keep an open mind. But I like editing YAML for the same reason that I like editing Python. JSON is almost identical to Python's expression syntax, of course, while YAML isn't even close. Getting the source

Re: help on pickle tool

2006-10-06 Thread hanumizzle
On 5 Oct 2006 23:43:50 -0700, MonkeeSage [EMAIL PROTECTED] wrote: On Oct 6, 1:28 am, Fredrik Lundh [EMAIL PROTECTED] wrote: when did you last look at the spec? I'm fairly versed in JS objects, having written 10 or so extensions for firefox; but I've only used YAML for trivial tasks like

Re: Block Structure Parsing

2006-10-06 Thread hanumizzle
On 10/4/06, Blacktiger [EMAIL PROTECTED] wrote: Hi all, I'm new to this list because I had a question about parsing python block structure. I am taking a programming languages course this semester and for our final project we are writing an interperator in scheme(awful language) for whatever

Re: Strange sorting error message

2006-10-06 Thread hanumizzle
On 10/5/06, Neil Cerutti [EMAIL PROTECTED] wrote: It was a joke, based on you hiding what you are doing, he decided to hide the solution to your problem. Get it? What if it was for a proprietary software of some kind? -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list

Re: Why do this?

2006-10-06 Thread hanumizzle
On 10/6/06, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Thu, 5 Oct 2006 11:28:08 +0100, Matthew Warren [EMAIL PROTECTED] declaimed the following in comp.lang.python: Now, I started programming when I was 8 with BBC Basic. Remember what the acronym BASIC stands for?

Re: CGI Tutorial

2006-10-06 Thread hanumizzle
On 10/5/06, Sells, Fred [EMAIL PROTECTED] wrote: content is great, my comments are editorial. wrt what document? I prefer PDF with bookmarks rather than HTML. 1. easy to print the whole thing and read offline. 2. easy to find a secion from bookmarks, rather that chasing links 3. easy to

Re: Package to handle table text render (handle space or tab between the columns) ?

2006-10-06 Thread hanumizzle
On 10/6/06, KLEIN Stéphane [EMAIL PROTECTED] wrote: Hi, I would like print tabular values on terminal (stdout). Are there package to handle table text render ? Have a look at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/267662 -- Theerasak --

Re: Package to handle table text render (handle space or tab between the columns) ?

2006-10-06 Thread hanumizzle
On 10/6/06, KLEIN Stéphane [EMAIL PROTECTED] wrote: hanumizzle a écrit : On 10/6/06, KLEIN Stéphane [EMAIL PROTECTED] wrote: Hi, I would like print tabular values on terminal (stdout). Are there package to handle table text render ? Have a look at: http://aspn.activestate.com

Re: help on pickle tool

2006-10-06 Thread hanumizzle
On 6 Oct 2006 01:41:48 -0700, virg [EMAIL PROTECTED] wrote: Hi, The data is simple dictionary with one or more keys. If i use YAML at the client (webui) do i have to change serialisation method to YAML at server also. Without changing serialisation method at server, can i use any of the

Re: help on pickle tool

2006-10-06 Thread hanumizzle
On 10/6/06, Steve Holden [EMAIL PROTECTED] wrote: I have to agree that YAML, having started out with simplicity in mind, has become a monster that threatens to collapse under its own weight. The very existence of JSON is a good indicator that YAML has failed to meet its design goals for a

Re: help on pickle tool

2006-10-06 Thread hanumizzle
On 6 Oct 2006 02:03:07 -0700, virg [EMAIL PROTECTED] wrote: At the server, based on client request it does some computations , it sends the result as dictionary (serialized) to the client. If I interpret your message correctly, you are receiving a Python dictionary object from the server. Yes?

Re: What value should be passed to make a function use the default argument value?

2006-10-06 Thread hanumizzle
On 6 Oct 2006 09:21:11 GMT, Antoon Pardon [EMAIL PROTECTED] wrote: On 2006-10-06, Fredrik Lundh [EMAIL PROTECTED] wrote: Antoon Pardon wrote: Is this general rules documeted somewhere? My impression is that readers of the documentation will treat arguments as keyword arguments unless

Re: printing variables

2006-10-06 Thread hanumizzle
On 10/6/06, Gerrit Holl [EMAIL PROTECTED] wrote: import fnmatch var1, var2, var3 = foo, bar, baz for k in fnmatch.filter(locals(), var*): ... print locals()[k] ... foo baz bar This is evil. It's unpythonic. It's so evil, Perl 4 would look upon it in scorn. -- Theerasak --

Re: help on pickle tool

2006-10-06 Thread hanumizzle
On 6 Oct 2006 02:29:59 -0700, virg [EMAIL PROTECTED] wrote: Yes your are right. I will send a dictionary object from the server to the client. I already have client which is written in python. But we are migrating the python client which is a command line tool to Web UI client (java).

Re: HOST - Assembla Inc. Breakout - Copyright Violation by Mr. Andy Singleton

2006-10-06 Thread hanumizzle
On 10/6/06, Diez B. Roggisch [EMAIL PROTECTED] wrote: This is on the same level of interest to the communities of python, ruby java as the color of my socks this morning - a deep black with cute little skulls imprinted. Where did you get these? -- Theerasak --

Re: Names changed to protect the guilty

2006-10-06 Thread hanumizzle
On 6 Oct 2006 16:27:51 -0700, Aahz [EMAIL PROTECTED] wrote: The following line of lightly munged code was found in a publicly available Python library... if schema.elements.has_key(key) is False: if not schema.elements.has_key(key): or, actually, if not key in schema.elements: is how I

Re: What value should be passed to make a function use the default argument value?

2006-10-06 Thread hanumizzle
On 6 Oct 2006 10:57:01 GMT, Antoon Pardon [EMAIL PROTECTED] wrote: Again that is not the fault of those that read the documentation. If this discinction can't be easily made in python 2.X, you can't fault the reader for coming to a conclusion that seems to follow rather naturally from how

Re: Can't get around IndexError: list index out of range

2006-10-06 Thread hanumizzle
On 6 Oct 2006 16:57:23 -0700, erikcw [EMAIL PROTECTED] wrote: I ended up using len(sys.argv) 1 for this particular problem. But I think slicing is closer to the tool I was looking for. I found a.has_key(k) or k in a for dictionaries - but haven't found anything similar for lists. Does it

Re: dictionary containing a list

2006-10-06 Thread hanumizzle
On 6 Oct 2006 14:37:59 -0700, Ben [EMAIL PROTECTED] wrote: Is there a way to acheive what I was attempting ? I have done something almost identical with classes in a list before, and in that case a new instance was created for each list entry... Not sure what you're trying to pull off, but

Re: [Linux] Detect a key press

2006-10-06 Thread hanumizzle
On 10/6/06, Sergei Organov [EMAIL PROTECTED] wrote: Try print -%s\r % ch or just sys.stdout.write(ch) Ah! -- http://mail.python.org/mailman/listinfo/python-list

Re: Recursive descent algorithm able to parse Python?

2006-10-06 Thread hanumizzle
On 10/6/06, Diez B. Roggisch [EMAIL PROTECTED] wrote: Lawrence D'Oliveiro schrieb: In message [EMAIL PROTECTED], Diez B. Roggisch wrote: I have to admit that I have difficulties to compare LR(k) to recursive descent, but the fact that the latter contains backtracking makes it at least

Re: Skullsocks to the rescue - was [irrelevant squabble of IL]

2006-10-06 Thread hanumizzle
On 10/6/06, Diez B. Roggisch [EMAIL PROTECTED] wrote: Fredrik Lundh schrieb: Diez B. Roggisch wrote: This is on the same level of interest to the communities of python, ruby java as the color of my socks this morning - a deep black with cute little skulls imprinted. are they

Re: extract certain values from file with re

2006-10-06 Thread hanumizzle
On 6 Oct 2006 13:16:13 -0700, Matteo [EMAIL PROTECTED] wrote: Coming from C++, using exceptions in this way still feels a bit creepy to me, but I've been assured that this is very pythonic, and I'm slowly adopting this style in my python code. Parsing the line can be easy too:

Re: problem with split

2006-10-06 Thread hanumizzle
On 6 Oct 2006 21:07:43 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I want comment returned in an array and instr_number returned in an array. Let me see if I understand what you want: if there is a line that starts with instr (best tested with line.startswith('instr') :)), you want the

Re: problem with split

2006-10-06 Thread hanumizzle
On 10/7/06, goyatlah goyatlah wrote: Think you need a regex like this: regex = r\s*instr\s+([0-9]+)\s*(;.*)? [0-9] maybe written simply as \d (d for digit) Then: import re test = re.compile(regex) Regexes are usually passed as literals directly to re.compile(). testing is done as

Re: How do I put % in a format sting?

2006-10-05 Thread hanumizzle
On 10/5/06, Gregory Piñero [EMAIL PROTECTED] wrote: Thanks guys, putting it twice is all it took! This rule holds true for a lot of string formatting conventions. (such as in regexes) -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list

Re: CGI Tutorial

2006-10-05 Thread hanumizzle
On 5 Oct 2006 14:56:54 -0700, Jim [EMAIL PROTECTED] wrote: * You need a DEBUG variable: from defaults import DEBUG : if DEBUG: .. WADR, there is a more formal way to do this: http://docs.python.org/ref/assert.html Use -O to remove the assert statements, essentially: -O

Re: dictionary of list from a file

2006-10-05 Thread hanumizzle
On 4 Oct 2006 06:09:21 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi guys, this is my first post. my programming background is perlish scripting and now I am learning python. I need to create a dictionary of list from a file. Normally in perl I use to do like: You may wish to consider

Re: [Linux] Detect a key press

2006-10-05 Thread hanumizzle
On 5 Oct 2006 21:45:47 -0700, Jia,Lu [EMAIL PROTECTED] wrote: Hi all I write a program to detect key press,but , why there is a *space* before the character I typed.?? Puzzles me too, but I know this is really easy in Curses (on top of that, it isn't specific to Linux; curses works on many

Re: help on pickle tool

2006-10-05 Thread hanumizzle
On 5 Oct 2006 21:52:56 -0700, virg [EMAIL PROTECTED] wrote: Hi, i have client-server application which is written in python using XMLRPC protocol. The existing client is a command line. Now client application we are converting it as Web UI using java. I have seen some problems in writing

Re: A Universe Set

2006-10-05 Thread hanumizzle
On 10/4/06, Wildemar Wildenburger [EMAIL PROTECTED] wrote: Jorgen Grahn wrote: - the wildcard object, which compares equal to everything else - infinite xrange()s - the black hole function 'def f(*args): pass' - the identity function 'def f(x): return x' Any use cases for these? I used

Re: was python implemented as a object oriented langage at the beginning ?

2006-10-05 Thread hanumizzle
On 10/4/06, Bruno Desthuilliers [EMAIL PROTECTED] wrote: has wrote: Python's type/class distinction Which type/class distinction ? I think he means pre 2.2. (?) -- http://mail.python.org/mailman/listinfo/python-list

Re: help on pickle tool

2006-10-05 Thread hanumizzle
On 5 Oct 2006 22:25:58 -0700, Paddy [EMAIL PROTECTED] wrote: You might try picking the data with a different pickle formatter that your Java can use. Maybe an XML pickler (http://www.gnosis.cx/download/Gnosis_Utils.More/Gnosis_Utils-1.2.1.ANNOUNCE untested by me). You might also use a

kudos

2006-10-03 Thread hanumizzle
After a long hiatus, I finally found *something* as a vehicle to learn Python. My friends and I are (hopefully) getting together to play FEAR RPG and I decided to use Python to write chargen utilities and such. What do I have to say? Except for not having TrueClosures, which can be emulated with

Re: python html rendering

2006-10-03 Thread hanumizzle
On 10/3/06, Colin J. Williams [EMAIL PROTECTED] wrote: Another approach is to use PyScripter (an editor and IDE). One can generate documentation and then save the generated html doc. Also PyDoc can be used directly. And if you want to go the traditional way, Emacs and Vim can both be used to

Re: Resuming a program's execution after correcting error

2006-10-03 Thread hanumizzle
On 3 Oct 2006 16:58:17 -0700, MRAB [EMAIL PROTECTED] wrote: I like your idea Matthew but I don't know how to pickle the many variables in one file. Do I need to pickle each and every variable into a seperate file? var1,var2 pickle.dump(var1,f) pickle.dump(var2,f2) Using the

Re: Dive Into Python -- Still Being Updated?

2006-07-25 Thread hanumizzle
Alan Franzoni wrote: Il 22 Jul 2006 15:48:36 -0700, [EMAIL PROTECTED] ha scritto: http://diveintopython.org/getting_to_know_python/indenting_code.html The function called fib (presumably short for Fibonacci) appears to produce factorials. Anyway, 'fib' should really be called 'hem'. :)

Re: Which Pyton Book For Newbies?

2006-07-24 Thread hanumizzle
Bob Sinclar wrote: Web programming is all about stdin stdout. Recommanded practice before going further. It's actually a little more (at least as far as CGI is concerned)...it bears some level of abstraction, namely, a decent CGI lib. -- http://mail.python.org/mailman/listinfo/python-list

Re: Type signature

2006-07-22 Thread hanumizzle
Yacao Wang wrote: Hi, I'm a newbie to Python. I've recently read some books about this language and none of them have answered my question. As a dynamically-typed language Python doesn't need any form of type signature which makes the syntax very clean and concise. OK... However, type

Dive Into Python -- Still Being Updated?

2006-07-22 Thread hanumizzle
I find Dive Into Python generally an excellent text, and I am not surprised to see people recommending it...but I have noticed a few errors already: http://diveintopython.org/getting_to_know_python/indenting_code.html The function called fib (presumably short for Fibonacci) appears to produce

Re: Which Pyton Book For Newbies?

2006-07-22 Thread hanumizzle
W. D. Allen wrote: I want to write a retirement financial estimating program. Python was suggested as the easiest language to use on Linux. I have some experience programming in Basic but not in Python. I have two questions: 1. What do I need to be able to make user GUIs for the program,

Re: Very, Very Green Python User

2006-03-17 Thread hanumizzle
Dhanyavaad (thank you) -- http://mail.python.org/mailman/listinfo/python-list

Re: Very, Very Green Python User

2006-03-15 Thread hanumizzle
Scott David Daniels wrote: [EMAIL PROTECTED] wrote: ... Is the Python debugger fairly stable? Yes, but it is not massively featured. The Pythonic way is to rarely use a debugger (test first and straightforward code should lead to shallow bugs). Often for most of us judiciously placed

Re: Very, Very Green Python User

2006-03-15 Thread hanumizzle
Exactly...this is how most of my Perl modules are written and tested, actually. -- http://mail.python.org/mailman/listinfo/python-list

Re: Very, Very Green Python User

2006-03-15 Thread hanumizzle
Scott David Daniels wrote: [EMAIL PROTECTED] wrote: Scott David Daniels wrote: [EMAIL PROTECTED] wrote: ... Is the Python debugger fairly stable? Yes, but it is not massively featured. The Pythonic way is to rarely use a debugger (test first and straightforward code should lead to

Re: Very, Very Green Python User

2006-03-15 Thread hanumizzle
Dennis Lee Bieber wrote: On 12 Mar 2006 17:58:43 -0800, [EMAIL PROTECTED] declaimed the following in comp.lang.python: Double-underscore methods are rewritten with the class name? That's an ugly hack, but remember I'm coming from Perl. If the language doesn't pull many other hijinks,

Re: Very, Very Green Python User

2006-03-15 Thread hanumizzle
bruno at modulix wrote: [EMAIL PROTECTED] wrote: I have used Perl for a long time, but I am something of an experimental person and mean to try something new. Most of my 'work' with Vector Linux entails the use of Perl (a bit of a misnomer as it is not now a paid position -- I am not yet

Very, Very Green Python User

2006-03-12 Thread hanumizzle
I have used Perl for a long time, but I am something of an experimental person and mean to try something new. Most of my 'work' with Vector Linux entails the use of Perl (a bit of a misnomer as it is not now a paid position -- I am not yet even out of K-12), and there a lot of things I love about