Re: Splitting strings - by iterators?

2005-02-25 Thread John Machin
Jeremy Sanders wrote: On Fri, 25 Feb 2005 17:14:24 +0100, Diez B. Roggisch wrote: Maybe [c]StringIO can be of help. I don't know if it's iterator is lazy. But at least it has one, so you can try and see if it improves performance :) Excellent! I somehow missed that module. StringIO speeds

Re: Converting HTML to ASCII

2005-02-25 Thread Michael Spencer
Mike Meyer wrote: It also fails on tags with a in a string in the tag. That's well-formed but ill-used HTML. mike True enough...however, it doesn't fail too horribly: striptags(sometag attribute = ''the text/sometag) 'the text and I think that case could be rectified rather

Re: variable declaration

2005-02-25 Thread Serge Orlov
Alexander Zatvornitskiy wrote: Hello All! I'am novice in python, and I find one very bad thing (from my point of view) in language. There is no keyword or syntax to declare variable, like 'var' in Pascal, or special syntax in C. It can cause very ugly errors,like this: epsilon=0 S=0

Yet another logo design...

2005-02-25 Thread Mark
Hi, I'm relatively new to python and have been reading some of the topics on the Python logo and marketing issues etc. Long story short here is a contemporary logo design by myself: http://www.imagezilla.com/img.php?im=1182129642_logo.png Any comments welcome... *runs* --

cgi: getting at raw POST data?

2005-02-25 Thread Erik Johnson
I am trying to work with a program that is trying make an HTTP POST of text data without any named form parameter. (I don't know - is that a normal thing to do?) I need to write a CGI program that accepts and processes that data. I'm not seeing how to get at data that's not a named form parameter.

possible python/linux/gnome issue!!

2005-02-25 Thread bruce
hi... i'm running rh8.0 with gnome.. i'm not sure of the version (it's whatever rh shipped). i've recently updated (or tried to update) python to the latest version. when i try to run the 'Server Settings/Services' Icon within gnome, nothing happens... i tried to run the 'start services'

Re: fdups: calling for beta testers

2005-02-25 Thread John Machin
Patrick Useldinger wrote: fdups' homepage is at http://www.homepages.lu/pu/fdups.html, where you'll also find a link to download the tar. fdups has no installation program. Just change into a temporary directory, and type tar xfj fdups.tar.bz. You should also chown the files according to

netmask arithmetic?

2005-02-25 Thread Dan Stromberg
Before I go and reinvent the wheel, does anyone already have python code that can do netmask arithmetic - for example, determining if a list of hostnames are on subnets described by a list of networks+netmasks like: 128.200.34.0/24 128.195.16.128/25 ...and so on? Thanks! --

Code evaluation at function definition execution time (was Re: Compile time evaluation (aka eliminating default argument hacks))

2005-02-25 Thread Nick Coghlan
Steven Bethard wrote: So just to clarify, the issue you're trying to address is when you want early binding like function default arguments get, but you don't want to declare the names as function arguments? Basically, yeah. Although I later realised I got the name of the feature I want wrong -

weird strings question

2005-02-25 Thread Lucas Raab
Is it possible to assign a string a numerical value?? For example, in the string test can I assign a number to each letter as in t = 45, e = 89, s = 54, and so on and so forth?? TIA -- http://mail.python.org/mailman/listinfo/python-list

Re: weird strings question

2005-02-25 Thread John Machin
Lucas Raab wrote: Is it possible to assign a string a numerical value?? For example, in the string test can I assign a number to each letter as in t = 45, e = 89, s = 54, and so on and so forth?? TIA for c in 'abcd': ...print c, ord(c) ... a 97 b 98 c 99 d 100 If that isn't what you

Re: weird strings question

2005-02-25 Thread Robert Kern
Lucas Raab wrote: Is it possible to assign a string a numerical value?? For example, in the string test can I assign a number to each letter as in t = 45, e = 89, s = 54, and so on and so forth?? Use a dictionary with the strings as keys. string2num = {} string2num['t'] = 45 string2num['e'] =

Re: Code evaluation at function definition execution time (was Re: Compile time evaluation (aka eliminating default argument hacks))

2005-02-25 Thread Nick Coghlan
Nick Coghlan wrote: Basically, yeah. Although I later realised I got the name of the feature I want wrong - default arguments are evaluated when the def statement is executed, not when the code is compiled. So it's a matter of being able to execute some code in the functions local namespace at

Re: Converting HTML to ASCII

2005-02-25 Thread Kent Johnson
gf gf wrote: Hi. I'm looking for a Python lib to convert HTML to ASCII. You might find these threads on comp.lang.python interesting: http://tinyurl.com/5zmpn http://tinyurl.com/6mxmb Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Code evaluation at function definition execution time (was Re: Compile time evaluation (aka eliminating default argument hacks))

2005-02-25 Thread Steven Bethard
Nick Coghlan wrote: Anyway, if others agree that the ability to execute a suite at def exeuction time to preinitialise a function's locals without resorting to bytecode hacks is worth having, finding a decent syntax is the next trick :) I'm not certain how many use cases really require a full

Re: Dealing with config files what's the options

2005-02-25 Thread Tom Willis
On Fri, 25 Feb 2005 15:02:04 -0700, Dave Brueck [EMAIL PROTECTED] wrote: Jorgen Grahn wrote: On Tue, 22 Feb 2005 20:38:28 -0500, Tom Willis [EMAIL PROTECTED] wrote: How are the expert pythoneers dealing with config files? ... Any ideas? How about writing them in Python?

Re: web status display for long running program

2005-02-25 Thread Peter Hansen
Paul Rubin wrote: Kamilche [EMAIL PROTECTED] writes: I was inspired to enhance your code, and perform a critical bug-fix. Your code would not have sent large files out to dialup users, because it assumed all data was sent on the 'send' command. I added code to check for the number of bytes sent,

Re: wxpython tutorials

2005-02-25 Thread Peter Hansen
Harlin Seritt wrote: Tkinter is easier to learn. It is better documented IMO. Tkinter is just as functional as any other GUI toolkit for Python. Creating your own widget sets is usually a breeze. Tkinter is not ugly if done properly. Tkinter apps are ported easily. On and on :-) In this forum, no

Re: Yet another logo design...

2005-02-25 Thread Stephen Waterbury
Mark wrote: Long story short here is a contemporary logo design by myself: http://www.imagezilla.com/img.php?im=1182129642_logo.png Any comments welcome... *runs* Heh. As a graphic design, I think it's very nice. Unfortunately, it's probably a bit too scary as a logo for Python the language.

Re: Dealing with config files what's the options

2005-02-25 Thread Dave Brueck
Tom Willis wrote: On Fri, 25 Feb 2005 15:02:04 -0700, Dave Brueck How about writing them in Python? Depending on who will be editing the config files, this can be a great approach. [snip] I actually thought of this, and I was kind of on the fence due to the intended audience. I don't think it's

It's worth a Try!

2005-02-25 Thread amonje_avon
Please read and believe: Turn $6 into $60,000 in 90 days, GUARANTEED I found this in a news group and decided to try it. A little while back, I was browsing through news groups, just like you are now and came across a message just like this, that said you could make thousands of dollars within

Mask Array

2005-02-25 Thread oliverm
hi all, i have read a tutorial about "gemath" and it has a dependency called MA (Mask Array), the problem is i cannot find any link where to download this thing, anyone knows where i could get Mask Array? thanks. --

Which module is set in?

2005-02-25 Thread Anthony Liu
I want to use the set function like mylist = ['a', 'b', 'b', 'd', 'e', 'a'] myset = set (mylist) But I don't know what to import, I tried sys, sets, they don't work. What's the easy way to find out the module that contains a particular function?

Re: Which module is set in?

2005-02-25 Thread Steven Bethard
Anthony Liu wrote: I want to use the set function like mylist = ['a', 'b', 'b', 'd', 'e', 'a'] myset = set (mylist) But I don't know what to import, I tried sys, sets, they don't work. If you're using Python 2.4, they're builtin. If you're using Python 2.3, you'll probably want to do

Re: Which module is set in?

2005-02-25 Thread Anthony Liu
Thanks a lot, mine is Python 2.3, and from sets import Set as set works great! --- Steven Bethard [EMAIL PROTECTED] wrote: Anthony Liu wrote: I want to use the set function like mylist = ['a', 'b', 'b', 'd', 'e', 'a'] myset = set (mylist) But I don't know what to

Re: Trees

2005-02-25 Thread Nick Coghlan
Diez B. Roggisch wrote: Or writing a Node-class is also so straightforward that few care about them being part of the core: Writing a *simple* node class is easy, but a full-featured one that supports things like comparison and easy iteration is a bit more work. So various people write partial

Re: strange SyntaxError

2005-02-25 Thread Attila Szabo
2005, Feb 25 - Scott David Daniels wrote : Attila Szabo wrote: Hi, def main(): lambda x: 'ABC%s' % str(x) for k in range(2): exec('print %s' % k) OK, to no real effect, in main you define an unnamed function that you can never reference. Pretty silly, but I'll bite. This

Re: sockets question

2005-02-25 Thread Artificial Life
On Sat, 26 Feb 2005 00:35:57 -0500, Mohammed Smadi wrote: hi; i have the following piece of code: = s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) s.bind((,port)) s.sendto(data,(MY_GW,port)) data = s.recvfrom(1024) data contains some instructions

Re: Source Encoding GBK/GB2312

2005-02-25 Thread steven
Thank you All ! I am going to update ... -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib2 meta-refresh

2005-02-25 Thread Dave Brueck
Artificial Life wrote: urllib2 does not seem to be able to handle META-REFRESH in an html document. I just get back the html to the page that is supposed to forward me to the intended page. Right - urllib2 is for working with protocols (like HTTP) to transfer data, whereas META-REFRESH is an

Re: Which module is set in?

2005-02-25 Thread Michael Hartl
It's good that you're using Python 2.3, which does have sets available, as a previous poster mentioned. Users of Python 2.2 or earlier can get most of the Set functionality using the following class (from Peter Norvig's utils.py file): # class Set: # This implements the Set class from PEP

Re: Canonical way of dealing with null-separated lines?

2005-02-25 Thread Douglas Alan
Okay, here's the definitive version (or so say I). Some good doobie please make sure it makes its way into the standard library: def fileLineIter(inputFile, newline='\n', leaveNewline=False, readSize=8192): Like the normal file iter but you can set what string indicates newline. You can

Re: Code evaluation at function definition execution time (was Re: Compile time evaluation (aka eliminating default argument hacks))

2005-02-25 Thread Nick Coghlan
Steven Bethard wrote: Worth looking at is the thread: http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/58f53fe8bcc49664/ Huh - I thought I put something in the original post saying without resorting to bytecode hacks, but I must have deleted it before sending the

Re: rounding problem

2005-02-25 Thread Nick Coghlan
Dan Bishop wrote: Your statement is misleading, because it suggests that your processor stores digits. It doesn't; it stores *bits*. And where does the word 'bit' come from, hmm? It couldn't possibly be an abbreviation of Binary digIT, could it? Cheers, Nick. -- Nick Coghlan | [EMAIL

Re: Canonical way of dealing with null-separated lines?

2005-02-25 Thread Nick Coghlan
Douglas Alan wrote: Okay, here's the definitive version (or so say I). Some good doobie please make sure it makes its way into the standard library: def fileLineIter(inputFile, newline='\n', leaveNewline=False, readSize=8192): Like the normal file iter but you can set what string indicates

Watermark on images

2005-02-25 Thread export
Is there a way how to put a watermark on images by using Python? Lad. -- http://mail.python.org/mailman/listinfo/python-list

[ python-Bugs-1123727 ] gensuitemodule.processfile fails

2005-02-25 Thread SourceForge.net
Bugs item #1123727, was opened at 2005-02-16 07:17 Message generated for change (Comment added) made by hhas You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1123727group_id=5470 Category: Macintosh Group: Python 2.4 Status: Open Resolution: None Priority:

[ python-Feature Requests-1152248 ] Enhance file.readlines by making line separator selectable

2005-02-25 Thread SourceForge.net
Feature Requests item #1152248, was opened at 2005-02-26 17:24 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=1152248group_id=5470 Category: Python Interpreter Core Group: None

[ python-Feature Requests-1152248 ] Enhance file.readlines by making line separator selectable

2005-02-25 Thread SourceForge.net
Feature Requests item #1152248, was opened at 2005-02-26 08:24 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=1152248group_id=5470 Category: Python Interpreter Core Group: None Status: Open

<    1   2