Re: list unpack trick?

2005-01-23 Thread Bengt Richter
On Sun, 23 Jan 2005 15:43:43 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: >aurora wrote: >> I am think more in the line of string.ljust(). So if we have a >> list.ljust(length, filler), we can do something like >> >> name, value = s.split('=',1).ljust(2,'') > >Eh? > >Py> s.split('=',1).ljus

Re: Comments in configuration files

2005-01-23 Thread alex23
> I would like it to be editable, through a web browser or a GUI > application. With ConfigParser I can read the configuration file and > edit the options, but when I write the result all the comments are lost Hey Pierre, I came across a good review of a number of possible solutions for this at h

Re: [OT] XML design intent ... further musings

2005-01-23 Thread Stephen Waterbury
Paul Rubin wrote: Stephen Waterbury <[EMAIL PROTECTED]> writes: I should note that I have to deal with XML a lot, but always kicking and screaming (though much less now because of Fredrik's Elementtree package ;). Thanks, Fredrik and Peter, for the references. ;) I love this old rant about XML: h

Re: list unpack trick?

2005-01-23 Thread Bengt Richter
On Sun, 23 Jan 2005 08:22:36 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: >On Sun, 23 Jan 2005 15:43:43 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: > >>aurora wrote: >>> I am think more in the line of string.ljust(). So if we have a >>> list.ljust(length, filler), we can do something like >>

Re: getting file size

2005-01-23 Thread John Machin
Tim Roberts wrote: > Bob Smith <[EMAIL PROTECTED]> wrote: > > >Are these the same: > > > >1. f_size = os.path.getsize(file_name) > > > >2. fp1 = file(file_name, 'r') > >data = fp1.readlines() > >last_byte = fp1.tell() > > > >I always get the same value when doing 1. or 2. Is there a reason

Re: how to write a tutorial

2005-01-23 Thread Xah Lee
adding to my previosu comment... In the Python tutorial: http://python.org/doc/2.3.4/tut/node11.html the beginning two paragraphs should be deleted. Nobody gives a shit except a few smug academicians where the author wrote it for pleasing himself. For 99% of readers, it is incomprehensible and irr

Re: getting file size

2005-01-23 Thread John Machin
Tim Roberts wrote: > Bob Smith <[EMAIL PROTECTED]> wrote: > > >Are these the same: > > > >1. f_size = os.path.getsize(file_name) > > > >2. fp1 = file(file_name, 'r') > >data = fp1.readlines() > >last_byte = fp1.tell() > > > >I always get the same value when doing 1. or 2. Is there a reason

Re: how to write a tutorial

2005-01-23 Thread CBFalconer
Xah Lee wrote: > ... snip ... > > the first paragraph of 9.1 "A Word About Terminology" is epitome > of masturbation. The entire 9.1 is not necessary. > > Large part of 9.2 "Python Scopes and Name Spaces" is again > masturbatory. PLONK for excessive OT crossposting and trolling. -- "If you wa

Re: Insanity

2005-01-23 Thread Tim Daneliuk
Fredrik Lundh wrote: Tim Daneliuk wrote: Given an arbitrary string, I want to find each individual instance of text in the form: "[PROMPT:optional text]" I tried this: y=re.compile(r'\[PROMPT:.*\]') Which works fine when the text is exactly "[PROMPT:whatever]" didn't you leave something out h

Re: debugging xmlrpc servers

2005-01-23 Thread Diez B. Roggisch
I have difficulties understanding your probelem - is your own method giving you trouble (and the 'exceptions.ValueError:too many values to unpack') error or is it the remote debugger? Or do you simply not understand the error message itself. The error itself is raised in cases like this: a,b,c =

Re: re Insanity

2005-01-23 Thread Orlando Vazquez
Tim Daneliuk wrote: For some reason, I am having the hardest time doing something that should be obvious. (Note time of posting ;) Given an arbitrary string, I want to find each individual instance of text in the form: "[PROMPT:optional text]" I tried this: y=re.compile(r'\[PROMPT:.*\]') Whic

Textual markup languages (was Re: What YAML engine do you use?)

2005-01-23 Thread Alan Kennedy
[Effbot] ReST and YAML share the same deep flaw: both formats are marketed as simple, readable formats, and at a first glance, they look simple and read- able -- but in reality, they're messy as hell, and chances are that the thing you're looking at doesn't really mean what you think it means (unle

Re: Insanity

2005-01-23 Thread Fredrik Lundh
Tim Daneliuk wrote: > Thanks - very helpful. One followup - your re works as advertised. But > if I use: r'\[PROMPT:[^]].*\]' it seems not to. the '.*' instead of just '*' > it matches the entire string ... it's not "just '*'", it's "[^]]*". it's the "^]" set (anything but ]) that's repeate

Re: finding name of instances created

2005-01-23 Thread André
Nick Coghlan wrote: > André wrote: > > So, students will be able to write: > > pete = CreateRobot(2, 3) > > pete.move() > > > > learning about objects and methods. > > > > As for things like > > for robot in robots: > > do stuff > > > > that will be for my use only: drawing robots on the screen, u

Re: Textual markup languages (was Re: What YAML engine do you use?)

2005-01-23 Thread Paul Rubin
Alan Kennedy <[EMAIL PROTECTED]> writes: > However, I'm torn on whether to use ReST for textual content. On the > one hand, it's looks pretty comprehensive and solidly implemented. It seemed both unnecessary and horrendously overcomplicated when I looked at it. I'd stay away. > So, I'm hoping th

Re: Textual markup languages (was Re: What YAML engine do you use?)

2005-01-23 Thread Fredrik Lundh
Alan Kennedy wrote: > From what I've seen, pretty much every textual markup targetted for web > content, e.g. wiki markup, > seems to have grown/evolved organically, meaning that it is either > underpowered or overpowered, > full of special cases, doesn't have a meaningful object model, etc.

Re: finding name of instances created

2005-01-23 Thread André
Scott David Daniels wrote: > André Roberge wrote: > > Craig Ringer wrote: > > > >> On Fri, 2005-01-21 at 16:13 -0800, André wrote: > >> > >>> Short version of what I am looking for: > >>> > >>> Given a class "public_class" which is instantiated a few times e.g. > >>> > >>> a = public_class() > >>>

Re: What YAML engine do you use?

2005-01-23 Thread Daniel Bickett
Doug Holton wrote: > You might like programming in XML then: http://www.meta-language.net/ > :) http://www.meta-language.net/sample.html#class-metal I'm not so sure ;-) Daniel Bickett -- http://mail.python.org/mailman/listinfo/python-list

compile python to binary

2005-01-23 Thread sam
Hi, I have seen some software written in python and delivered as binary form. How does these binary code get generated by python compiler? Thanks Sam. -- http://mail.python.org/mailman/listinfo/python-list

Re: compile python to binary

2005-01-23 Thread Fredrik Lundh
"sam" <[EMAIL PROTECTED]> wrote: > I have seen some software written in python and delivered as binary form. > > How does these binary code get generated by python compiler? see section 6.1.2 in the tutorial: http://docs.python.org/tut/node8.html -- http://mail.python.org/mailman/list

Alternative Ways to install Python 2.4?

2005-01-23 Thread Michael Goettsche
Hello guys, I convinced my CS teacher to use Python in school. We currently have 2.2 installed on a Windows 2000 Terminal server. I asked the system administrator to upgrade to Python 2.4, but he didn't succeed in doing it. He used the microsoft installer package, which according to him crashed

Re: Reload Tricks

2005-01-23 Thread Kamilche
Well, I look forward to seeing the new version. I have the old version of the Python cookbook, it was very useful! -- http://mail.python.org/mailman/listinfo/python-list

is there better 32 clock() timing?

2005-01-23 Thread Ray Schumacher
I have a need for a time.clock() with >0.16 second (16us) accuracy. The sleep() (on Python 2.3, Win32, at least) has a .001s limit. Are they lower/better on other's platforms? Test code, 2.4GHz P4 Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on win32 import time t0

Re: Reload Tricks

2005-01-23 Thread Alex Martelli
Kamilche <[EMAIL PROTECTED]> wrote: > Well, I look forward to seeing the new version. I have the old version > of the Python cookbook, it was very useful! I hope the new one is even better -- many more recipes, all updated to Python 2.3 and 2.4. The old one will remain useful for all those who n

Re: is there better 32 clock() timing?

2005-01-23 Thread Michael Hoffman
Ray Schumacher wrote: I have a need for a time.clock() with >0.16 second (16us) accuracy. The sleep() (on Python 2.3, Win32, at least) has a .001s limit. Are they lower/better on other's platforms? The meaning of time.clock() is entirely different on other platforms. See the documentation. Yo

Re: is there better 32 clock() timing?

2005-01-23 Thread [EMAIL PROTECTED]
alternatively you could use the now() method of the datetime module, it has a resolution of 1 microsecond -- http://mail.python.org/mailman/listinfo/python-list

Re: how to write a tutorial

2005-01-23 Thread Dan Perl
"Xah Lee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > the beginning two paragraphs should be deleted. Nobody gives a shit > except a few smug academicians where the author wrote it for pleasing > himself. For 99% of readers, it is incomprehensible and irrelevant. > > the first p

ANN: eric3 3.6.0 released

2005-01-23 Thread Detlev Offenbach
Hi, this is to let you know about a new release of eric3, the Python IDE. It has a bunch of new functions. The most prominent ones are listed below. - added some dialog wrappers that make eric3 use KDE dialogs, if KDE and PyKDE are installed - added a previewer for UI files - added a previewer fo

PSE : Python Servlet Engine configuration

2005-01-23 Thread salvatore
Hello, Is there someone who use PSE ? I have a strange problem, i don't see how pse.conf is managed. Indeed althoug I make modifications on it nothind is take in account. I have also erases it !!! and PSE doesn't claim anything !!! Can someone help me ? Regards Salvatore -- http://mail.python.org/m

Re: is there better 32 clock() timing?

2005-01-23 Thread Paul Rubin
Ray Schumacher <[EMAIL PROTECTED]> writes: > I have a need for a time.clock() with >0.16 second (16us) accuracy. > The sleep() (on Python 2.3, Win32, at least) has a .001s limit. > > Are they lower/better on other's platforms? > > The alternative appears to be more C code... C code is your

Re: how to write a tutorial

2005-01-23 Thread Daniel Bickett
> Most texts in computing are written by authors to defend and showcase > their existence against their peers. When you aren't busy `showcasing' your ignorance, this is *all* i see in everything you write. > In a tutorial, nobody cares how > the language compared to x y and z, or what technicalit

ANN: cElementTree 0.9.8 (january 23, 2005)

2005-01-23 Thread Fredrik Lundh
effbot.org proudly presents release 0.9.8 of the cElementTree library, a fast and very efficient implementation of the ElementTree API, for Python 2.1 and later. On typical documents, it's 15-20 times faster than the Python version of ElementTree, and uses 2-5 times less memory. Here are some ben

Re: compile python to binary

2005-01-23 Thread Daniel Bickett
Fredrik Lundh wrote: > see section 6.1.2 in the tutorial: > [snip] I believe Sam was talking about "frozen" python scripts using tools such as py2exe: http://starship.python.net/crew/theller/py2exe/ As to how the actual process works, I'm not qualified to answer (having only read an article in t

best way to do a series of regexp checks with groups

2005-01-23 Thread Mark Fanty
In perl, I might do (made up example just to illustrate the point): if(/add (\d+) (\d+)/) { do_add($1, $2); } elsif (/mult (\d+) (\d+)/) { do_mult($1,$2); } elsif(/help (\w+)/) { show_help($1); } or even do_add($1,$2) if /add (\d+) (\d+)/; do_mult($1,$2) if /mult (\d+) (\d+)/; show_help($1

Re: compile python to binary

2005-01-23 Thread Daniel Bickett
Fredrik Lundh wrote: > oh, you mean that "python compiler" didn't mean "the python compiler". > [snip] I simply inferred that he was using the wrong terminology, being that he said "binary" twice ;-) sam wrote: > I have seen some software written in python and delivered as binary form. > > How do

Re: File objects? - under the hood question

2005-01-23 Thread EP
> My brain-teaser: What I'd like to do is read the last ~2K of a large > number of large files on arbitrary servers across the net, without > having to read each file from the beginning (which would be slow and > resource inefficient)... > Proper googling would have revealed that HTTP 1.1 i

Have you heard the GOOD NEWS?

2005-01-23 Thread google_groups_usa
http://www3.boxke.net << click link for the good news -- http://mail.python.org/mailman/listinfo/python-list

Re: File objects? - under the hood question

2005-01-23 Thread Jeremy Bowers
On Sun, 23 Jan 2005 08:27:49 -0800, EP wrote: > >> My brain-teaser: What I'd like to do is read the last ~2K of a large >> number of large files on arbitrary servers across the net, without >> having to read each file from the beginning (which would be slow and >> resource inefficient)... >> >>

Re: debugging xmlrpc servers

2005-01-23 Thread alan dot ezust at gmail dot com
Understandable - i had difficulties understanding my problem too! I don't really understand why I got that error message before - I believe it was due to the fact that some other exception was being raised inside results(). Anyway, the solution was to call rpdb.set_trace() inside the actual metho

Re: What YAML engine do you use?

2005-01-23 Thread rm
rm wrote: Paul Rubin wrote: Reinhold Birkenfeld <[EMAIL PROTECTED]> writes: For those of you who don't know what YAML is: visit http://yaml.org/! You will be amazed, and never think of XML again. Well, almost. Oh please no, not another one of these. We really really don't need it. well, I did lo

Re: list unpack trick?

2005-01-23 Thread aurora
On Sat, 22 Jan 2005 10:03:27 -0800, aurora <[EMAIL PROTECTED]> wrote: I am think more in the line of string.ljust(). So if we have a list.ljust(length, filler), we can do something like name, value = s.split('=',1).ljust(2,'') I can always break it down into multiple lines. The good thing abo

Dr. Dobb's Python-URL! - weekly Python news and links (Jan 23)

2005-01-23 Thread Josiah Carlson
QOTW: "XML with elementtree is what makes me never have [to] think about XML again." -- Istvan Albert "'Plays well with others' was a strong motivator for Python's design, and that often means playing by others' rules." -- Tim Peters Type mutability, and why some types are immutable. T

Re: best way to do a series of regexp checks with groups

2005-01-23 Thread [EMAIL PROTECTED]
what about something like this? >>> import re >>> m = re.match(r"""(?Padd|mult) (?P\d+) (?P\d+)""", 'add 3 5') >>> from operator import add, mul >>> op = {'add': add, 'mult: mul} >>> op[m.groupdict()['operator']](int(m.groupdict()['int_1']), int(m.groupdict()['int_2'])) 8 -- http://mail.python.or

Re: compile python to binary

2005-01-23 Thread Fredrik Lundh
Daniel Bickett wrote: > I believe Sam was talking about "frozen" python scripts using tools > such as py2exe: oh, you mean that "python compiler" didn't mean "the python compiler". here are links to some more tools, btw: http://effbot.org/zone/python-compile.htm -- http://mail.python

Re: how to write a tutorial

2005-01-23 Thread Hans Nowak
Xah Lee wrote: the first paragraph of 9.1 "A Word About Terminology" is epitome of masturbation. The entire 9.1 is not necessary. Large part of 9.2 "Python Scopes and Name Spaces" is again masturbatory. So I can just take a copy of the tutorial to the bathroom next time. Thanks for the tip, man!

Re: compile python to binary

2005-01-23 Thread Doug Holton
Fredrik Lundh wrote: Daniel Bickett wrote: I believe Sam was talking about "frozen" python scripts using tools such as py2exe: oh, you mean that "python compiler" didn't mean "the python compiler". I wouldn't assume a novice uses terms the same way you would. It was quite clear from his message

What is print? A function?

2005-01-23 Thread Frans Englich
Nah, I don't think it's a function, but rather a builtin "statement". But it's possible to invoke it as an function; print( "test" ) works fine. So I wonder, what _is_ exactly the print statement? The untraditional way of invoking it(without paranteses) makes me wonder. The reason I thinks abo

Re: What is print? A function?

2005-01-23 Thread Fredrik Lundh
Frans Englich wrote: > Nah, I don't think it's a function, but rather a builtin "statement". But it's > possible to invoke it as an function; print( "test" ) works fine. > > So I wonder, what _is_ exactly the print statement? The untraditional way of > invoking it(without paranteses) makes me wond

Re: What is print? A function?

2005-01-23 Thread Michael Hoffman
Frans Englich wrote: Nah, I don't think it's a function, but rather a builtin "statement". But it's possible to invoke it as an function; print( "test" ) works fine. That is not invoking it as a function. The parentheses are only for ordering the expression on the right You can do this too: >>>

Re: What is print? A function?

2005-01-23 Thread Fredrik Lundh
>> The reason I thinks about this is I need to implement a debug print for my >> program; very simple, a function/print statement that conditionally prints >> its message whether a bool is true. Not overly complex. >> >> I tried this by overshadowing the print keyword, but that obviously didn't >>

Re: What is print? A function?

2005-01-23 Thread Frans Englich
On Sunday 23 January 2005 18:04, Michael Hoffman wrote: > Frans Englich wrote: [...] > if command_line_debug_option: > debug = _debug_true > else > debug = _debug_false I find this a nice solution. The most practical would be if it was possible to do this with print, of course. But prin

on the way to find pi!

2005-01-23 Thread Ali Polatel
dear friends , I found a code which calculates pi with an interesting algorithm the programme code is below: from sys import stdout def f((q,r,t,k)):    n = (3*q+r) / t    if (4*q+r) / t == n:    return (10*q,10*(r-n*t),t,k,n)    else:    return (q*k, q*(4*k+2)+r*(2*k+1),t*(2*k+1),k+1) # C

Re: What is print? A function?

2005-01-23 Thread Fredrik Lundh
Frans Englich wrote: > I find this a nice solution. The most practical would be if it was possible to > do this with print, of course. But print won't budge. you can disable print, though: class dev_null: def write(self, text): pass sys.stdout = dev_null() or pipe al

Re: on the way to find pi!

2005-01-23 Thread Daniel Bickett
Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import math >>> math.pi 3.1415926535897931 Daniel Bickett -- http://mail.python.org/mailman/listinfo/python-list

Re: on the way to find pi!

2005-01-23 Thread Fredrik Lundh
Ali Polatel wrote: > I found a code which calculates pi with an interesting algorithm the > programme code is below: > [code snipped] > This code gives the number in an unusual format like "3.1415'None'" it has > a number part and a string part. are you sure? $ python pi.py How many d

Re: on the way to find pi!

2005-01-23 Thread Ali Polatel
that's just little near to pi... pi is so far away ;)__Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list

Re: on the way to find pi!

2005-01-23 Thread Ali Polatel
write the code type str(pi(5)) and see what I mean__Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list

OT: problems mirroring python-list to c.l.py?

2005-01-23 Thread Daniel Bickett
I'm not sure if it's just me (or, indeed, just google groups), but my "python-list" folder (label, that is) in my gmail account looks less and less similar to Google Groups' comp.lang.python with each day. Not only that, c.l.py has been acting rather strange. Example that happened just now: Ali Po

Re: Textual markup languages (was Re: What YAML engine do you use?)

2005-01-23 Thread Alan Kennedy
[Alan Kennedy] >> From what I've seen, pretty much every textual markup targetted >> for web content, e.g. wiki markup, seems to have grown/evolved >> organically, meaning that it is either underpowered or overpowered, >> full of special cases, doesn't have a meaningful object model, etc. [Fredrik

Re: Textual markup languages (was Re: What YAML engine do you use?)

2005-01-23 Thread Alan Kennedy
[Alan Kennedy] >>So, I'm hoping that the learned folks here might be able to give me >>some pointers to a markup language that has the following >>characteristics [Paul Rubin] > I'm a bit biased but I've been using Texinfo for a long time and have > been happy with it. It's reasonably lightweight

Re: on the way to find pi!

2005-01-23 Thread Fredrik Lundh
Ali Polatel wrote: > write the code type str(pi(5)) and see what I mean it helps if you post the code you want help with in your first post, so people don't have to guess. the pi function doesn't return anything, it prints the value to stdout (that's what the stdout.write things are doing). if

Re: OT: problems mirroring python-list to c.l.py?

2005-01-23 Thread Steve Holden
Daniel Bickett wrote: John Lenton wrote: On Sun, Jan 23, 2005 at 01:53:52PM -0500, Daniel Bickett wrote: Is there a reason that Google Groups isn't mirroring python-list exactly like it used to, or is it simply a conspiracy I'm not in on? You should not ask this kind of question in a public forum,

Re: specifying constants for a function (WAS: generator expressions: performance anomaly?)

2005-01-23 Thread Steven Bethard
Nick Coghlan wrote: Steven Bethard wrote: I wrote: > If you really want locals that don't contribute to arguments, I'd be > much happier with something like a decorator, e.g.[1]: > > @with_consts(i=1, deftime=time.ctime()) > def foo(x, y=123, *args, **kw): >return x*y, kw.get('which_time'

Re: OT: problems mirroring python-list to c.l.py?

2005-01-23 Thread John Lenton
> On Sun, Jan 23, 2005 at 01:53:52PM -0500, Daniel Bickett wrote: > > > > Is there a reason that Google Groups isn't mirroring python-list > > exactly like it used to, or is it simply a conspiracy I'm not in on? > > You should not ask this kind of question in a public forum, and *you* should kno

Help on project, anyone?

2005-01-23 Thread Georg Brandl
Hello, to train my Python skills I am looking for some project I can contribute to. I learned Python about one year ago, and had already some programming background behind (I contributed to SharpDevelop for instance), so I'm not the complete newbie. About myself: I'm a 20 year old German with str

Re: specifying constants for a function (WAS: generator expressions: performance anomaly?)

2005-01-23 Thread Steven Bethard
Bengt Richter wrote: On Sat, 22 Jan 2005 16:22:33 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: Steven Bethard wrote: I wrote: > If you really want locals that don't contribute to arguments, I'd be > much happier with something like a decorator, e.g.[1]: > > @with_consts(i=1, deftime=time.ctime()

Weekly Python Patch/Bug Summary

2005-01-23 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 273 open ( +1) / 2746 closed ( +9) / 3019 total (+10) Bugs: 797 open ( +4) / 4789 closed (+12) / 5586 total (+16) RFE : 166 open ( +1) / 141 closed ( +0) / 307 total ( +1) New / Reopened Patches __ fix distu

Re: re Insanity

2005-01-23 Thread Tim Daneliuk
Orlando Vazquez wrote: Tim Daneliuk wrote: For some reason, I am having the hardest time doing something that should be obvious. (Note time of posting ;) Given an arbitrary string, I want to find each individual instance of text in the form: "[PROMPT:optional text]" I tried this: y=re.compile

bdb

2005-01-23 Thread jimbo
Hi, I am trying to sort how to best programmatically run the debugger on a program, and another way that I am trying to explore is by using the bdb module. There isn't any documentation for this and I have tried reading through the source, which includes an example/test at the end of bdb.py on

Re: [python-win32] on the way to find pi!

2005-01-23 Thread Michel Claveau
Hi ! Very more simplistic, but easy for to code : def pi(nb): cpi=0 for i in xrange(1,nb,4): cpi=cpi+4./i-4./(i+2.) return(cpi) print pi(99) @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: make install with python

2005-01-23 Thread Christopher De Vries
On Sat, Jan 22, 2005 at 01:54:17AM +0100, Uwe Mayer wrote: > Any suggestions how I handle uninstallation? This was provided by automake > rather mechanically. I didn't find a section on that in the distutils > documentation... :( I've been using distutils for a couple of projects I've written for

python-dev Summary for 2004-12-01 through 2004-12-15

2005-01-23 Thread Brett C.
This is a summary of traffic on the `python-dev mailing list`_ from December 01, 2004 through December 15, 2004. It is intended to inform the wider Python community of on-going developments on the list. To comment on anything mentioned here, just post to `comp.lang.python`_ (or email python-l

Re: finding name of instances created

2005-01-23 Thread Steven Bethard
Michael Tobis wrote: I have a similar problem. Here's what I do: .def new_robot_named(name,indict=globals()): . execstr = name + " = robot('" + name + "')" . exec(execstr,indict) .class robot(object): . def __init__(self,name): . self.name = name . def sayhi(self): . print "Hi! I

Re: finding name of instances created

2005-01-23 Thread Georg Brandl
Michael Tobis wrote: > I have a similar problem. Here's what I do: > > .def new_robot_named(name,indict=globals()): > . execstr = name + " = robot('" + name + "')" > . exec(execstr,indict) > > .class robot(object): > . def __init__(self,name): > . self.name = name > > . def sayhi(se

Re: What is print? A function?

2005-01-23 Thread Roy Smith
Frans Englich <[EMAIL PROTECTED]> wrote: > Nah, I don't think it's a function, but rather a builtin "statement". But > it's possible to invoke it as an function; print( "test" ) works fine. That's not calling it as a function. The parens in this case are simply evaluated as grouping operators a

Fuzzy matching of postal addresses [1/1]

2005-01-23 Thread Andrew McLean
In case anyone is interested, here is the latest. I implemented an edit distance technique based on tokens. This incorporated a number of the ideas discussed in the thread. It works pretty well on my data. I'm getting about 95% matching now, compared with 90% for the simple technique I originall

Re: What is print? A function?

2005-01-23 Thread Georg Brandl
Roy Smith wrote: >> So I wonder, what _is_ exactly the print statement? The untraditional way of >> invoking it(without paranteses) makes me wonder. > > It's a statement, just like "write" in Fortran. When C came around, the > idea of a language having no built-in print statement and having to

Keyboard problems with Python shell over SSH

2005-01-23 Thread Nils Emil P.Larsen
Hello I'm not sure this is Python-related but it might be since Bash and vim works perfectly. I connect to my server using SSH and then run 'python' to enter the shell. I can't use the arrow buttons (up, down, left and right). Instead I get this ^[[A , ^[[B, ^[[C or ^[[D. How do I get my arro

Re: Keyboard problems with Python shell over SSH

2005-01-23 Thread Stian Soiland
På 23. jan 2005 kl. 21:55 skrev Nils Emil P.Larsen: I connect to my server using SSH and then run 'python' to enter the shell. I can't use the arrow buttons (up, down, left and right). Instead I get this ^[[A , ^[[B, ^[[C or ^[[D. Your Python installation is probably compiled without readline su

Re: What is print? A function?

2005-01-23 Thread Nelson Minar
Frans Englich <[EMAIL PROTECTED]> writes: > The reason I thinks about this is I need to implement a debug print for my > program; very simple, a function/print statement that conditionally prints > its message whether a bool is true. Not overly complex. As several folks have said, print is a sta

Re: finding name of instances created

2005-01-23 Thread Steven Bethard
Nick Coghlan wrote: It also directly addresses the question of aliasing. Think about how Steven's modified dictionary would react to this code: pete = CreateRobot(2, 3) dad = pete dad.move() pete.move() If you'd like to handle these cases, but you don't want to have to explain aliasing right off

Microsoft to Provide PyCon Opening Keynote

2005-01-23 Thread Steve Holden
Dear Python Colleague: The PyCon Program Committee is happy to announce that the opening keynote speech, at 9:30 am on Wednesday March 23 will be: Python on the .NET Platform, by Jim Hugunin, Microsoft Corporation Jim Hugunin is well-known in the Python world for his pioneering work on

Re: JPype and classpath (Was Re: embedding jython in CPython... )

2005-01-23 Thread johng2001
Thanks for the response. However, I continue to have problems. Allow me to give some more detail. For simplicity of testing, I hard coded the classpath and JVM path (BTW getDefaultJVMPath() returns None on my system) import os, os.path from jpype import * startJVM("C:/jdk1.5.0/jre/bin/client/jvm

Classical FP problem in python : Hamming problem

2005-01-23 Thread Francis Girard
Hi, First, My deepest thanks to Craig Ringer, Alex Martelli, Nick Coghlan and Terry Reedy for having generously answered on the "Need help on need help on generator" thread. I'm compiling the answers to sketch myself a global pictures about iterators, generators, iterator-generators and lazine

Re: What is print? A function?

2005-01-23 Thread Steven Bethard
Frans Englich wrote: The reason I thinks about this is I need to implement a debug print for my program; very simple, a function/print statement that conditionally prints its message whether a bool is true. Not overly complex. Sounds like you want to override sys.stdout: py> class ConditionalWrit

Set parity of a string

2005-01-23 Thread snacktime
Is there a module that sets the parity of a string? I have an application that needs to communicate with a host using even parity So what I need is before sending the message, convert it from space to even parity. And when I get the response I need to convert that from even to space parity. The

Re: Insanity

2005-01-23 Thread Tim Daneliuk
Fredrik Lundh wrote: Tim Daneliuk wrote: Thanks - very helpful. One followup - your re works as advertised. But if I use: r'\[PROMPT:[^]].*\]' it seems not to. the '.*' instead of just '*' it matches the entire string ... it's not "just '*'", it's "[^]]*". it's the "^]" set (anything but ])

Re: how to write a tutorial

2005-01-23 Thread Lucas Raab
Daniel Bickett wrote: Most texts in computing are written by authors to defend and showcase their existence against their peers. When you aren't busy `showcasing' your ignorance, this is *all* i see in everything you write. Um, maybe that was his point... -- http://mail.python.org/mailman/listinf

Re: Solutions for data storage?

2005-01-23 Thread Shalabh Chaturvedi
Leif K-Brooks wrote: I'm writing a relatively simple multi-user public Web application with Python. It's a rewrite of a similar application which used PHP+MySQL (not particularly clean code, either). My opinions on various Web frameworks tends to vary with the phase of the moon, but currently, I

Re: Classical FP problem in python : Hamming problem

2005-01-23 Thread Jeff Epler
Your formulation in Python is recursive (hamming calls hamming()) and I think that's why your program gives up fairly early. Instead, use itertools.tee() [new in Python 2.4, or search the internet for an implementation that works in 2.3] to give a copy of the output sequence to each "multiply by N

Re: finding name of instances created

2005-01-23 Thread Michael Tobis
I have a similar problem. Here's what I do: .def new_robot_named(name,indict=globals()): . execstr = name + " = robot('" + name + "')" . exec(execstr,indict) .class robot(object): . def __init__(self,name): . self.name = name . def sayhi(self): . print "Hi! I'm %s!" % self.nam

Weakref.ref callbacks and eliminating __del__ methods

2005-01-23 Thread Mike C. Fletcher
I'm looking at rewriting parts of Twisted and TwistedSNMP to eliminate __del__ methods (and the memory leaks they create). Looking at the docs for 2.3's weakref.ref, there's no mention of whether the callbacks are held with a strong reference. My experiments suggest they are not... i.e. I'm

Re: Set parity of a string

2005-01-23 Thread Fredrik Lundh
"snacktime" wrote: > Is there a module that sets the parity of a string? I have an > application that needs to communicate with a host using even parity > So what I need is before sending the message, convert it from space to > even parity. And when I get the response I need to convert that from

Re: OT: problems mirroring python-list to c.l.py?

2005-01-23 Thread Daniel Bickett
John Lenton wrote: > > On Sun, Jan 23, 2005 at 01:53:52PM -0500, Daniel Bickett wrote: > > > > > > Is there a reason that Google Groups isn't mirroring python-list > > > exactly like it used to, or is it simply a conspiracy I'm not in on? > > > > You should not ask this kind of question in a publi

Re: Fuzzy matching of postal addresses [1/1]

2005-01-23 Thread John Machin
Andrew McLean wrote: > In case anyone is interested, here is the latest. > def insCost(tokenList, indx, pos): > """The cost of inserting a specific token at a specific normalised position along the sequence.""" > if containsNumber(tokenList[indx]): > return INSERT_TOKEN_WITH_NUMBER

Re: Weakref.ref callbacks and eliminating __del__ methods

2005-01-23 Thread Alex Martelli
Mike C. Fletcher <[EMAIL PROTECTED]> wrote: > weakref.ref( self, self.close ) > > but the self.close reference in the instance is going away *before* the > object is called. Uh -- what's holding on to this weakref.ref instance? I guess the weakreference _itself_ is going away right afte

Re: rotor replacement

2005-01-23 Thread "Martin v. Löwis"
Paul Rubin wrote: There's tons of such examples, but python-dev apparently reached consensus that the Python maintainers were less willing than the maintainers of those other packages to deal with those issues. As Andrew says, it is not apparent that there was consensus. Martin, do you know more ab

Re: Alternative Ways to install Python 2.4?

2005-01-23 Thread "Martin v. Löwis"
Michael Goettsche wrote: I convinced my CS teacher to use Python in school. We currently have 2.2 installed on a Windows 2000 Terminal server. I asked the system administrator to upgrade to Python 2.4, but he didn't succeed in doing it. He used the microsoft installer package, which according to

Re: Set parity of a string

2005-01-23 Thread snacktime
On Sun, 23 Jan 2005 23:52:29 +0100, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > "snacktime" wrote: > > > Is there a module that sets the parity of a string? I have an > > application that needs to communicate with a host using even parity > > So what I need is before sending the message, convert i

Re: [perl-python] 20050121 file reading & writing

2005-01-23 Thread Fredrik Lundh
Erik Max Francis wrote: >> To do this efficiently on a large file (dozens or hundreds of megs), you >> should use the >> 'sizehint' parameter so as not to use too much memory: >> >> sizehint = 0 >> mylist = f.readlines(sizehint) > > It doesn't make any difference. .readlines reads the entire fi

  1   2   >