Re: base64

2006-04-12 Thread Fredrik Lundh
John Machin wrote: > > base64.encodestring(data) does all that in one step, of course. > > and it's tagged as part of the "legacy interface", and gives no control > over the chuck size, of course :-) if you read the documentation, it's clear that legacy means "base64 only", not "deprecated". it

Re: Regular Expression: Matching substring

2006-04-12 Thread Kevin CH
Thank you for your reply. > Perhaps you are using grep, or you have stumbled on the old deprecated > "regex" module and are using that instead of the "re" module. Perhaps > not as you are using only 2 plain vanilla RE operations which should > work the same way everywhere. Perhaps you are having t

Re: Why new Python 2.5 feature "class C()" return old-style class ?

2006-04-12 Thread Petr Prikryl
"Aahz" wrote... > Bruno Desthuilliers wrote: > >Aahz a écrit : [...] > >>>Please repeat this 101 times each morning: > >>>"thou shall not use old-style classes for they are deprecated". > >> Classic classes are *NOT* deprecated. > >Perhaps not *officially* yet... > > Not even unofficially. The poi

Re: Regular Expression: Matching substring

2006-04-12 Thread John Machin
On 13/04/2006 12:33 PM, Kevin CH wrote: > Hi, > > I'm currently running into a confusion on regex and hopefully you guys > can clear it up for me. > > Suppose I have a regular expression (0|(1(01*0)*1))* and two test > strings: 110_1011101_ and _101101_1. (The underscores are not part of > the st

Re: Regular Expression: Matching substring

2006-04-12 Thread Kevin CH
Oh yea, I see what's my confusion now. In the first string, I didn't consider 11 and 0 matches the pattern without the repetition. Actually what I did is I entered the pattern and the test strings into kudos (a python regexp debugger) and got the match groups, which didn't have 11 and 0 as matche

Re: quiet conversion functions

2006-04-12 Thread Carl Banks
Tim Chase wrote: > Is there some set of preexisting functions that do this sort > of "sensible" conversions without griping about crazy values > passed to them? No, because this isn't Perl. Seriously, it's a core principle of the Python language not to presume what a user considers to be "sensibl

Re: Regular Expression: Matching substring

2006-04-12 Thread Leon
You are right. In fact the procedure is as follows: The substr ``101101" is no problem, if stop here, match will successful. But the tailing `1' occurs, so we may imagine the working automata move to a state, which according to the regexp's outer most `)', and ready to repeat the whole regexp again

Re: symbolic links, aliases, cls clear

2006-04-12 Thread Barry Margolin
In article <[EMAIL PROTECTED]>, "Chris F.A. Johnson" <[EMAIL PROTECTED]> wrote: > In fact, my scripts are portable to other terminal types by use > of files for each terminal, generated with tput. Using a > different terminal is as easy as ". /usr/share/term-sh/$TERM" or > som

Re: Numpy and cPickle

2006-04-12 Thread Martin Manns
Robert Kern wrote: > Martin Manns wrote: >> If I cPickle a numpy array under Linux and un-cPickle it under Solaris >> 10, my arrays seem to be transposed. > Transposed? That's odd. There was a byteorder issue with pickles going across > differently-endianed platforms that was fixed in the past fe

Re: Regular Expression: Matching substring

2006-04-12 Thread Kevin CH
Leon wrote: > Hi Kevin, > > You may notice that, for matching the regex (0|(1(01*0)*1))*, the left > most > three characters of a string must not be ``101" while not followed by > an `0'. > After reading the first `1', automata expects `1' or ``00" or ``010" > or ``11", > right?:) Why it must e

pyzeroconf unicast question

2006-04-12 Thread Ralph Butler
Hi: I have been using pyzeroconf to register and discover services on a local network using the default multicast support. Now, I would like to register a service on a remote node and discover that service from my local machine. Neither machine is behind a firewall. This sort of thing is su

Re: Iterating command switches from a data file - have a working solution but it seems inefficient

2006-04-12 Thread John Machin
On 13/04/2006 12:26 PM, James Stroud wrote: > John Machin wrote: >> On 13/04/2006 11:23 AM, James Stroud wrote: > >>> opt_map = {'m': 'Queue Manager', 's': 'Server', 'p': 'Port', >>>'o': 'Object', 'k': 'Key', 't': 'To', >>>'c': 'Check', 'd': 'Report',

Re: CGI module: get form name

2006-04-12 Thread Tim Roberts
"ej" wrote: > >I'm not seeing how to get at the 'name' attribute of an HTML element. > >form = cgi.FieldStorage() > >gives you a dictionary-like object that has keys for the various named >elements *within* the form... > >I could easily replicate the form name in a hidden field, but there ought t

Re: Regular Expression: Matching substring

2006-04-12 Thread Leon
Hi Kevin, You may notice that, for matching the regex (0|(1(01*0)*1))*, the left most three characters of a string must not be ``101" while not followed by an `0'. After reading the first `1', automata expects `1' or ``00" or ``010" or ``11", right?:) Kevin CH 寫道: > Hi, > > I'm currently run

Re: CGI module: get form name

2006-04-12 Thread Ben Cartwright
ej wrote: > I'm not seeing how to get at the 'name' attribute of an HTML element. > > form = cgi.FieldStorage() > > gives you a dictionary-like object that has keys for the various named > elements *within* the form... > > I could easily replicate the form name in a hidden field, but there ought t

Re: quiet conversion functions

2006-04-12 Thread Paul McGuire
"Tim Chase" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Are there existing "quiet" conversion functions? Kin of > int() and float()? > > My aim would be to call a function that would guarntee that > the result was of the defined type, choosing sensible > defaults if needed. Exam

Re: Numpy and cPickle

2006-04-12 Thread Robert Kern
Martin Manns wrote: > Hi > > If I cPickle a numpy array under Linux and un-cPickle it under Solaris > 10, my arrays seem to be transposed. Is there any way to get the same > behavior on both platforms without testing which platform the python > script runs on and then transposing the array? > > I

how to install PYCURL 7.15.2 on windows 2003?

2006-04-12 Thread Ju Hui
I download it from http://pycurl.sourceforge.net/ and then extract it to D:\usr\pycurl-7.15.2 then D:\usr\pycurl-7.15.2>setup.py install --curl-dir=d:\usr\pycurl-7.15.2 Using curl directory: d:\usr\pycurl-7.15.2 Traceback (most recent call last): File "D:\usr\pycurl-7.15.2\setup.py", line 197, i

Re: I wanna use urllib2 to get a page with a socks 5 proxy, who can give me a sample code ?

2006-04-12 Thread Ju Hui
thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list

Numpy and cPickle

2006-04-12 Thread Martin Manns
Hi If I cPickle a numpy array under Linux and un-cPickle it under Solaris 10, my arrays seem to be transposed. Is there any way to get the same behavior on both platforms without testing which platform the python script runs on and then transposing the array? I am using python 2.4.2 and numpy 0.9

Regular Expression: Matching substring

2006-04-12 Thread Kevin CH
Hi, I'm currently running into a confusion on regex and hopefully you guys can clear it up for me. Suppose I have a regular expression (0|(1(01*0)*1))* and two test strings: 110_1011101_ and _101101_1. (The underscores are not part of the string. They are added to show that both string has a sub

Re: Iterating command switches from a data file - have a working solution but it seems inefficient

2006-04-12 Thread James Stroud
John Machin wrote: > On 13/04/2006 11:23 AM, James Stroud wrote: >> opt_map = {'m': 'Queue Manager', 's': 'Server', 'p': 'Port', >>'o': 'Object', 'k': 'Key', 't': 'To', >>'c': 'Check', 'd': 'Report', 'q': 'Display} >> > > 'Queue Manager' is not suit

Re: quiet conversion functions

2006-04-12 Thread Robert Kern
Tim Chase wrote: > Are there existing "quiet" conversion functions? Kin of > int() and float()? Not in the standard library. Nor will there be. It goes against the development philosophy of the core Python development team. > My aim would be to call a function that would guarntee that > the re

quiet conversion functions

2006-04-12 Thread Tim Chase
Are there existing "quiet" conversion functions? Kin of int() and float()? My aim would be to call a function that would guarntee that the result was of the defined type, choosing sensible defaults if needed. Example problems include: int("3.14") int(None) int(__builtins__) int("hello") For

Re: Iterating command switches from a data file - have a working solution but it seems inefficient

2006-04-12 Thread John Machin
On 13/04/2006 11:23 AM, James Stroud wrote: > News wrote: >> Hi everyone, >> My goal is to pull command switches/options from a file and then assign >> the values to select variables which would eventually be included in a >> class object. >> The data file looks something like this but the switches

Re: list.clear() missing?!?

2006-04-12 Thread Dan Christensen
Raymond Hettinger <[EMAIL PROTECTED]> writes: > Felipe Almeida Lessa writes: > > > I love benchmarks, so as I was testing the options, I saw something very > > strange: > > > > $ python2.4 -mtimeit 'x = range(10); ' > > 100 loops, best of 3: 6.7 msec per loop > > $ python2.4 -mtimeit 'x = ran

RE: object instance after if isalpha()

2006-04-12 Thread Marcelo Urbano Lima
ops, I forgot to use the self. so in this example what i was trying to do worked. I'll look further in my original program. sorry to bother you. >From: "Marcelo Urbano Lima" <[EMAIL PROTECTED]> >To: python-list@python.org >Subject: object instance after if isalpha() >Date: Wed, 12 Apr 2006 20:4

Re: Iterating command switches from a data file - have a working solution but it seems inefficient

2006-04-12 Thread James Stroud
News wrote: > Hi everyone, > > My goal is to pull command switches/options from a file and then assign > the values to select variables which would eventually be included in a > class object. > > The data file looks something like this but the switches could be in any > order and not all may be u

Re: Python2CPP ?

2006-04-12 Thread Luis M. González
You should check Shed Skin (Python-to-C++ Compiler): http://shed-skin.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterating command switches from a data file - have a working solution but it seems inefficient

2006-04-12 Thread James Stroud
News wrote: > Hi everyone, > > My goal is to pull command switches/options from a file and then assign > the values to select variables which would eventually be included in a > class object. > > The data file looks something like this but the switches could be in any > order and not all may be u

Re: list.clear() missing?!?

2006-04-12 Thread Terry Reedy
"Peter Hansen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > It's not even clear that extend needs two lines: > > >>> s = range(5) > >>> more = list('abc') > >>> s[:] = s + more > >>> s > [0, 1, 2, 3, 4, 'a', 'b', 'c'] This is not the same as list.extend because it makes a separa

Re: list.clear() missing?!?

2006-04-12 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Peter Hansen <[EMAIL PROTECTED]> wrote: >Alan Morgan wrote: >> Right. I was wondering what would happen in this case: >> >> s=[1,2,3] >> t=s >> s.clear() >> t # [] or [1,2,3]?? >> >> If you know your basic python it is "obvious" what would happen >> if you do

Re: can't pass command-line arguments

2006-04-12 Thread BartlebyScrivener
Peter Hansen wrote: > But it is. To help others. Perhaps what you are encountering is a real > bug, and solving it could avoid us having to deal with the same issue in > the future (though it seems more likely it's something special to your > case, but at least then we'll have a clear answer).

CGI module: get form name

2006-04-12 Thread ej
I'm not seeing how to get at the 'name' attribute of an HTML element. form = cgi.FieldStorage() gives you a dictionary-like object that has keys for the various named elements *within* the form... I could easily replicate the form name in a hidden field, but there ought to be some way to get d

Re: object instance after if isalpha()

2006-04-12 Thread Ben Cartwright
Marcelo Urbano Lima wrote: > class abc: > def __init__(self): > name='marcelo' > print x.name > Traceback (most recent call last): > File "1.py", line 12, in ? > print x.name > AttributeError: abc instance has no attribute 'name' In Python, you explicitly include a reference to an obje

Re: Iterating command switches from a data file - have a working solution but it seems inefficient

2006-04-12 Thread Peter Hansen
News wrote: > Hi everyone, > > My goal is to pull command switches/options from a file and then assign > the values to select variables which would eventually be included in a > class object. > > The data file looks something like this but the switches could be in any > order and not all may be u

Re: list.clear() missing?!?

2006-04-12 Thread Peter Hansen
Steven D'Aprano wrote: > Convenience and obviousness are important for APIs -- that's why lists > have pop, extend and remove methods. The only difference I can see between > a hypothetical clear and these is that clear can be replaced with a > one-liner, while the others need at least two, e.g. fo

Re: list.clear() missing?!?

2006-04-12 Thread Peter Hansen
Alan Morgan wrote: > Right. I was wondering what would happen in this case: > > s=[1,2,3] > t=s > s.clear() > t # [] or [1,2,3]?? > > If you know your basic python it is "obvious" what would happen > if you do s=[] or s[:]=[] instead of s.clear() and I guess it is > equally "obvious" which on

Iterating command switches from a data file - have a working solution but it seems inefficient

2006-04-12 Thread News
Hi everyone, My goal is to pull command switches/options from a file and then assign the values to select variables which would eventually be included in a class object. The data file looks something like this but the switches could be in any order and not all may be used. -m quemanager -s serve

Re: Python editing with emacs/wordstar key bindings.

2006-04-12 Thread Carl Banks
Thomas Bartkus wrote: > Does anyone use emacs together with both WordStar key bindings and python > mode? I'm afraid that Wordstar editing key commands are burned R/O into my > knuckles! Old Borland C user? > I would like to play with emacs for Python editing but I'm having (2) > problems. > >

Re: symbolic links, aliases, cls clear

2006-04-12 Thread Chris F.A. Johnson
On 2006-04-12, Christos Georgiou wrote: > On Wed, 12 Apr 2006 15:59:05 -0400, rumours say that "Chris F.A. Johnson" ><[EMAIL PROTECTED]> might have written: > I still have a system which does not have tput. >>> >>> And that justifies everything else. Of course. >> >> If I want to write po

object instance after if isalpha()

2006-04-12 Thread Marcelo Urbano Lima
Hi I'm still learning python and I've been loving it, but, that's not the reason I'm writing. I'm trying to create an object only if a variable is alpha and see what I get. $ cat 1.py class abc: def __init__(self): name='marcelo' a='STRING' print a.isalpha() if a.isalpha(): x=abc() p

Re: list.clear() missing?!?

2006-04-12 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Wed, 12 Apr 2006 15:36:47 -0700, Alan Morgan wrote: > >> Serious question: Should it work more like "s=[]" or more like >> "s[:]=[]". I'm assuming the latter, but the fact that there is >> a difference is an argument f

Re: list.clear() missing?!?

2006-04-12 Thread Steven D'Aprano
On Wed, 12 Apr 2006 15:36:47 -0700, Alan Morgan wrote: > Serious question: Should it work more like "s=[]" or more like > "s[:]=[]". I'm assuming the latter, but the fact that there is > a difference is an argument for not hiding this operation behind > some syntactic sugar. Er, I don't see how

Re: Python editing with emacs/wordstar key bindings.

2006-04-12 Thread John J. Lee
"Thomas Bartkus" <[EMAIL PROTECTED]> writes: [...] > >1) When I load a .py file, emacs automatically overrides my wordstar-mode > with python-mode, forcing all the keybindings back to emacs native keys. > Why? > > Why should a python-mode care what key bindings are in use? > >2) We get

Re: Python editing with emacs/wordstar key bindings.

2006-04-12 Thread John J. Lee
"Thomas Bartkus" <[EMAIL PROTECTED]> writes: [...] > >1) When I load a .py file, emacs automatically overrides my wordstar-mode > with python-mode, forcing all the keybindings back to emacs native keys. > Why? > > Why should a python-mode care what key bindings are in use? No idea. Quite od

Re: list.clear() missing?!?

2006-04-12 Thread Steven D'Aprano
On Wed, 12 Apr 2006 12:40:52 -0700, Raymond Hettinger wrote: > Something this small doesn't need a PEP. I'll just send a note to > Guido asking for a pronouncement. Raymond, if you're genuinely trying to help get this sorted in the fairest, simplest way possible, I hope I speak for everyone when

Re: list.clear() missing?!?

2006-04-12 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Raymond Hettinger <[EMAIL PROTECTED]> wrote: >[Steven Bethard] >> I think these are all good reasons for adding a clear method, but being >> that it has been so hotly contended in the past, I don't think it will >> get added without a PEP. Anyone out there willing t

Re: writing captcha image file

2006-04-12 Thread John Draper
[EMAIL PROTECTED] wrote: >I changed the owner of the file to root using chown root newuser.cgi, >but still i m not able to write... > > > Are you running Apache in Chrooted mode? If so, then that might be your problem. John -- http://mail.python.org/mailman/listinfo/python-list

Re: list.clear() missing?!?

2006-04-12 Thread Ville Vainio
Ville Vainio wrote: > Assigning to slices is much less important, and is something I always > never do (and hence forget). ALMOST never, of course. -- http://mail.python.org/mailman/listinfo/python-list

Re: list.clear() missing?!?

2006-04-12 Thread Ville Vainio
Raymond Hettinger wrote: > * easier to figure-out, look-up, and remember than either s[:]=[] or > del s[:] Easier is an understatement - it's something you figure out automatically. When I want to do something w/ an object, looking at its methods (via code completion) is the very first thing. >

Re: New Karrigel page in Wikipedia

2006-04-12 Thread Eric S. Johansson
Ravi Teja wrote: > You don't need to do that. You can always use your favorite templating > system. I am using Cheetah. actually, I got burned lots of times using template systems. I think I live by the minimum new scar tissue metric. After all, the only intuitive user interface is the mammali

iPython and doctest

2006-04-12 Thread Michael Tobis
It appears that doctest does not work straightforwardly within iPython. I would like to be able to use doctest within a file conditionally, so that I can develop it within ipython and test it otherwise. It would seem that this would work: Python 2.4.1 (#2, Mar 31 2005, 00:05:10) [GCC 3.3 200303

Re: symbolic links, aliases, cls clear

2006-04-12 Thread Christos Georgiou
On Wed, 12 Apr 2006 15:59:05 -0400, rumours say that "Chris F.A. Johnson" <[EMAIL PROTECTED]> might have written: >>>I still have a system which does not have tput. >> >> And that justifies everything else. Of course. > > If I want to write portable scripts, then yes, it does. Well, either

Re: base64

2006-04-12 Thread John Machin
On 13/04/2006 7:22 AM, Fredrik Lundh wrote: > John Machin wrote: > >> *After* encoding it, you can break up the base64 string into >> bite-size chunks, append a newline (that's "\n", NOT "/n") to each >> chunk /.../ > > base64.encodestring(data) does all that in one step, of course. > and it's

ANN: ActivePython 2.4.3.12 is now available (bugfix for Windows)

2006-04-12 Thread Trent Mick
I'm happy to announce that ActivePython 2.4.3.12 builds for Windows are now available for free download from: http://www.ActiveState.com/Products/ActivePython/ This is a bug fix release to for one Windows issue: - Fix a bug that results in ".pyo" and ".pyc" being placed on the PATHEXT envir

Re: list.clear() missing?!?

2006-04-12 Thread Peter Hansen
Raymond Hettinger wrote: > Cons: > - > * learning slices is basic to the language (this lesson shouldn't be > skipped) And yet it doesn't appear to be in the tutorial. I could have missed it, but I've looked in a number of the obvious places, without actually going through it (again) from s

Re: New Karrigel page in Wikipedia

2006-04-12 Thread Ravi Teja
> editor and even then it's still difficult. Stuffing it into Python > strings is a double pain because you have to figure out how may times > you have to quote your percent signs depending on how may times you > render a string. You don't need to do that. You can always use your favorite templat

Re: iPython and doctest

2006-04-12 Thread Robert Kern
Michael Tobis wrote: > It appears that doctest does not work straightforwardly within iPython. > > I would like to be able to use doctest within a file conditionally, so > that I can develop it within ipython and test it otherwise. > > It would seem that this would work: > > Python 2.4.1 (#2, Ma

Re: Figure out month number from month abbrievation

2006-04-12 Thread John Salerno
John Machin wrote: > You can answer such questions yourself very easily, e.g. in this case: > > >>> import calendar > >>> calendar.month_abbr > > >>> list(calendar.month_abbr) > ['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', > 'Oct', 'Nov', 'Dec'] Ah thanks. I did try i

Re: base64

2006-04-12 Thread Fredrik Lundh
John Machin wrote: > *After* encoding it, you can break up the base64 string into > bite-size chunks, append a newline (that's "\n", NOT "/n") to each > chunk /.../ base64.encodestring(data) does all that in one step, of course. -- http://mail.python.org/mailman/listinfo/python-list

Re: Figure out month number from month abbrievation

2006-04-12 Thread Azolex
John Salerno wrote: > Bill wrote: > >> def month_number(monthabbr): >> """Return the month number for monthabbr; e.g. "Jan" -> 1.""" >> for index, day in enumerate(calendar.month_abbr): >> if day == monthabbr: >> return index >> >> which works well enough but isn't very

Re: Figure out month number from month abbrievation

2006-04-12 Thread John Machin
On 13/04/2006 7:02 AM, John Salerno wrote: > Bill wrote: > >> def month_number(monthabbr): >> """Return the month number for monthabbr; e.g. "Jan" -> 1.""" >> for index, day in enumerate(calendar.month_abbr): >> if day == monthabbr: >> return index >> >> which works wel

Re: Figure out month number from month abbrievation

2006-04-12 Thread John Salerno
Bill wrote: > def month_number(monthabbr): > """Return the month number for monthabbr; e.g. "Jan" -> 1.""" > for index, day in enumerate(calendar.month_abbr): > if day == monthabbr: > return index > > which works well enough but isn't very clever. I'm pretty new to >

Re: base64

2006-04-12 Thread John Machin
On 13/04/2006 4:07 AM, Jay wrote: > I have bean trying to get my head around reading .GIF files from base64 > strings, FROM base64? Sounds a tad implausible. > Basically I need to specify a filename and convert it to base64 then I > can copy/past the string to wear I want it. TO base64? That's b

Re: Figure out month number from month abbrievation

2006-04-12 Thread Christos Georgiou
On 12 Apr 2006 13:20:28 -0700, rumours say that "Bill" <[EMAIL PROTECTED]> might have written: >Hello -- >I'm parsing the output of the finger command, and was wondering >something...If I'm given a month abbrievation (such as "Jan"), what's >the best way to figure out the month number? Try impor

Re: Figure out month number from month abbrievation

2006-04-12 Thread Azolex
Bill wrote: > Hello -- > I'm parsing the output of the finger command, and was wondering > something...If I'm given a month abbrievation (such as "Jan"), what's > the best way to figure out the month number? > I see that there's > something called "month_abbr" in the calendar module. However, whe

Re: trouble with Tkinter and Tix

2006-04-12 Thread Christos Georgiou
On 11 Apr 2006 14:39:41 -0700, rumours say that "CT" <[EMAIL PROTECTED]> might have written: >I installed python 2.4.3, Tcl 8.4 Tk8.4 and also with Tix 8.4 >I got some error like _tkinter.TclError:ambigous option "-col": must be >column, etc with my LabelFrame from Tix. > >It seems that the pytho

Re: datetime: the date of the day one month ago...how?

2006-04-12 Thread Christos Georgiou
On Wed, 12 Apr 2006 13:42:15 +0200, rumours say that gabor <[EMAIL PROTECTED]> might have written: >i want the day that you get by intutively saying "one month ago". means >usually picking the same day in the previous month. if that day does not >exist, i want the nearest day that exist and was

Re: Figure out month number from month abbrievation

2006-04-12 Thread Fredrik Lundh
"Bill" wrote: > I'm parsing the output of the finger command, and was wondering > something...If I'm given a month abbrievation (such as "Jan"), what's > the best way to figure out the month number? I see that there's > something called "month_abbr" in the calendar module. However, when I > try

iPython and doctest

2006-04-12 Thread Michael Tobis
It appears that doctest does not work straightforwardly within iPython. I would like to be able to use doctest within a file conditionally, so that I can develop it within ipython and test it otherwise. It would seem that this would work: Python 2.4.1 (#2, Mar 31 2005, 00:05:10) [GCC 3.3 200303

Re: just one more question about the python challenge

2006-04-12 Thread Georg Brandl
John Salerno wrote: > Fredrik Lundh wrote: >> John Salerno wrote: >> At the second, don't rename the file, rename the URL. >>> Do you mean rename the URL *aside from* the file name? >> >> no, the URL you got when you followed georg's instructions will give you >> some data that you need to m

Figure out month number from month abbrievation

2006-04-12 Thread Bill
Hello -- I'm parsing the output of the finger command, and was wondering something...If I'm given a month abbrievation (such as "Jan"), what's the best way to figure out the month number? I see that there's something called "month_abbr" in the calendar module. However, when I try to do calendar.m

Re: symbolic links, aliases, cls clear

2006-04-12 Thread Floyd L. Davidson
"Chris F.A. Johnson" <[EMAIL PROTECTED]> wrote: >On 2006-04-12, Floyd L. Davidson wrote: >> Keith Thompson <[EMAIL PROTECTED]> wrote: tput clear >>> >>>(Or "clear".) >> >> But /clear/ merely uses "tput clear". > > Not on systems without tput. Shoot that thing, and put it (and yourself) o

Re: symbolic links, aliases, cls clear

2006-04-12 Thread Chris F.A. Johnson
On 2006-04-12, jpd wrote: > Begin <[EMAIL PROTECTED]> > On 2006-04-12, Chris F.A. Johnson <[EMAIL PROTECTED]> wrote: >>These days, the ISO-6429 standard (almost the same as the older >>ANSI x3.64) is so close to universal that I don't bother writing >>for anything else any more. > > Oh

Re: list.clear() missing?!?

2006-04-12 Thread Raymond Hettinger
[Felipe Almeida Lessa] > > I love benchmarks, so as I was testing the options, I saw something very > > strange: > > > > $ python2.4 -mtimeit 'x = range(10); ' > > 100 loops, best of 3: 6.7 msec per loop > > $ python2.4 -mtimeit 'x = range(10); del x[:]' > > 100 loops, best of 3: 6.35 msec

Re: just one more question about the python challenge

2006-04-12 Thread Duncan Booth
John Salerno wrote: > Thanks Fredrik. I think my problem lies in not knowing what the 'data' > is I need to move on to the next step of the puzzle. I now have 3 > images, along with gfx file. I know shuffling/unshuffling has > something to do with the puzzle, but I haven't figure out what yet. Am

Re: list.clear() missing?!?

2006-04-12 Thread Felipe Almeida Lessa
Em Qua, 2006-04-12 às 12:40 -0700, Raymond Hettinger escreveu: > * the existing alternatives are a bit perlish I love this argument =D! "perlish"... lol... Cheers, -- Felipe. -- http://mail.python.org/mailman/listinfo/python-list

Re: symbolic links, aliases, cls clear

2006-04-12 Thread jpd
Begin <[EMAIL PROTECTED]> On 2006-04-12, Chris F.A. Johnson <[EMAIL PROTECTED]> wrote: >These days, the ISO-6429 standard (almost the same as the older >ANSI x3.64) is so close to universal that I don't bother writing >for anything else any more. Oh, wonderful. ``All the world's a vax

Re: Regular Expressions

2006-04-12 Thread Tim Chase
> I am trying to grab the following string out of a text file using regular > expression (re module): While I'm all for using regexps when they're needed, are you sure you need the overhead of regexps? f = open("foo.txt", "r") for line in f.readlines(): #if '"DcaVer"=dword:' in line:

Re: just one more question about the python challenge

2006-04-12 Thread John Salerno
Fredrik Lundh wrote: > John Salerno wrote: > >>> At the second, don't rename the file, rename the URL. >> Do you mean rename the URL *aside from* the file name? > > no, the URL you got when you followed georg's instructions will give you > some data that you need to manipulate before you can see

Re: list.clear() missing?!?

2006-04-12 Thread Raymond Hettinger
[Steven Bethard] > I think these are all good reasons for adding a clear method, but being > that it has been so hotly contended in the past, I don't think it will > get added without a PEP. Anyone out there willing to take out the best > examples from this thread and turn it into a PEP? Somethin

Re: Best Python web-hosting?

2006-04-12 Thread John Salerno
John Salerno wrote: > walterbyrd wrote: > >> And they have mod_python. > > > You sure about that? I've learned to be skeptical, because a lot of > hosts don't even seem to understand the difference between supporting > "Python" (which in reality is just CGI for them) and mod_python. In > fact

Re: Regular Expressions

2006-04-12 Thread david brochu jr
Pete, Why do you have to use a regular _expression_? I don't, I just though this was the easiest way.> "DcaVer"=dword:0640Is all your other input pretty much identical in form?  Specifically,the number of interest is the last thing on the line, and always preceded by a colon?  The other informa

Re: Regular Expressions

2006-04-12 Thread Steve Juranich
david brochu jr wrote: > Hi, > > I am trying to grab the following string out of a text file using regular > expression (re module): > > "DcaVer"=dword:0640 > > What I need to do with that string is trim down " "DcaVer"=dword:" and > convert the remaining number from hex to dec. > > I have

Re: Python2CPP ?

2006-04-12 Thread cfbolz
Hi! Szabolcs Berecz schrieb: > On 4/12/06, Michael Yanowitz <[EMAIL PROTECTED]> wrote: > > 2) Efficiency. It is alot quicker to code something in Python. If I can > >write it in Python and auto-convert it to C++. I would save time coding. > > I don't think you will get a more efficient code. T

Re: Regular Expressions

2006-04-12 Thread Peter Hansen
david brochu jr wrote: > I am trying to grab the following string out of a text file using > regular expression (re module): Why do you have to use a regular expression? > "DcaVer"=dword:0640 Is all your other input pretty much identical in form? Specifically, the number of interest is th

Re: symbolic links, aliases, cls clear

2006-04-12 Thread Chris F.A. Johnson
On 2006-04-12, Floyd L. Davidson wrote: > Keith Thompson <[EMAIL PROTECTED]> wrote: >>>tput clear >> >>(Or "clear".) > > But /clear/ merely uses "tput clear". Not on systems without tput. -- Chris F.A. Johnson, author | Shell Scripting Recipes: |

Re: New Karrigel page in Wikipedia

2006-04-12 Thread Eric S. Johansson
Luis M. González wrote: > For those interested in the simplest, easiest and most pythonic web > framework out there, there's a new page in Wikipedia: this all depends on your criteria for simplest and easiest. For me HTML is pure hell. I avoid it whenever possible because it literally makes my

Re: symbolic links, aliases, cls clear

2006-04-12 Thread Floyd L. Davidson
Keith Thompson <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] (Floyd L. Davidson) writes: >> [EMAIL PROTECTED] wrote: >>>If I may recommend an alternative, >>> >>>print "\033[H\033[J" >>> >>>the ansi sequence to clear the screen. >> >> Or so you would hope (however, that is *not* what you have liste

Re: Sorting a list of objects by multiple attributes

2006-04-12 Thread Azolex
Raymond Hettinger wrote: > Azolex: >> Let's push the diagnosis a bit further : the aversion to the keyword >> "lambda" has to do with the fact that it ignores the english word used >> by all non-geeks to convey the meaning, eg "given" > > Right. However, Guido has said that lambda is here to stay

Regular Expressions

2006-04-12 Thread david brochu jr
Hi,   I am trying to grab the following string out of a text file using regular _expression_ (re module):   "DcaVer"=dword:0640   What I need to do with that string is trim down " "DcaVer"=dword:" and convert the remaining number from hex to dec.   I have been trying to figure this out for a w

Re: symbolic links, aliases, cls clear

2006-04-12 Thread Chris F.A. Johnson
On 2006-04-12, Floyd L. Davidson wrote: > [EMAIL PROTECTED] wrote: >>If I may recommend an alternative, >> >>print "\033[H\033[J" >> >>the ansi sequence to clear the screen. > > Or so you would hope (however, that is *not* what you have listed!). > > Unfortunately, it is poor practice to hard code

Re: Sorting a list of objects by multiple attributes

2006-04-12 Thread Raymond Hettinger
[Noah] > I suggested the above because it wasn't obvious to me how one would > pass the arbitrary set of attributes to the lambda expression (and I > envisioned them being specified as strings in this case, since the set > of attributes will be coming from a web form). > > So what about the followi

Re: Looking for a language/framework

2006-04-12 Thread Azolex
Alex Martelli wrote: > Jeffrey Froman <[EMAIL PROTECTED]> wrote: > >> Alex Martelli wrote: >> >>> I've never seen an "object-relational mapping" (technical >>> term for cruft that tries to avoid people having to learn and use SQL) >>> which doesn't drive me into a murderous, foam-at-mouth rage in

Re: Sorting a list of objects by multiple attributes

2006-04-12 Thread Raymond Hettinger
Azolex: > Let's push the diagnosis a bit further : the aversion to the keyword > "lambda" has to do with the fact that it ignores the english word used > by all non-geeks to convey the meaning, eg "given" Right. However, Guido has said that lambda is here to stay, so it's time to get over it. R

Re: list.clear() missing?!?

2006-04-12 Thread Mel Wilson
Ville Vainio wrote: > Fredrik Lundh wrote: >>because Python already has a perfectly valid way to clear a list, >>perhaps ? >> >>del l[:] > > > Ok. That's pretty non-obvious but now that I've seen it I'll probably > remember it. I did a stupid "while l: l.pop()" loop myself. Actually, it's in

New Karrigel page in Wikipedia

2006-04-12 Thread Luis M. González
For those interested in the simplest, easiest and most pythonic web framework out there, there's a new page in Wikipedia: http://en.wikipedia.org/wiki/Karrigell -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting a list of objects by multiple attributes

2006-04-12 Thread Azolex
Raymond Hettinger wrote: > > The cult of lambda avoidance has lost contact with reality. [...] > Lambda avoidance is rooted in two things, an aversion to the keyword > name [...] Let's push the diagnosis a bit further : the aversion to the keyword "lambda" has to do with the fact that it ignore

Re: just one more question about the python challenge

2006-04-12 Thread Fredrik Lundh
John Salerno wrote: > > At the second, don't rename the file, rename the URL. > > Do you mean rename the URL *aside from* the file name? no, the URL you got when you followed georg's instructions will give you some data that you need to manipulate before you can see what it is. to figure out how

  1   2   3   >