Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread Antoon Pardon
Op 2005-04-20, Roy Smith schreef <[EMAIL PROTECTED]>: > Antoon Pardon <[EMAIL PROTECTED]> wrote: >>Op 2005-04-20, Roy Smith schreef <[EMAIL PROTECTED]>: >>> Antoon Pardon <[EMAIL PROTECTED]> wrote: >>> Personnaly I would like to have the choice. Sometimes I prefer to start at 0, sometime

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread Antoon Pardon
Op 2005-04-20, Bill Mill schreef <[EMAIL PROTECTED]>: > On 20 Apr 2005 13:39:42 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: >> Op 2005-04-20, Bill Mill schreef <[EMAIL PROTECTED]>: >> >> You write this af if other solutions can't be consistent. > > Propose one, and I won't write it off without t

Re: Embedding & Extending Python &other scripting languages

2005-04-20 Thread Mike Meyer
Tommy Nordgren <[EMAIL PROTECTED]> writes: > I'm interested in doing a rather ambitious project concerning compiler > construction tools. > My tools will parse specification files containing for example lalr > parser specifications. > The specifications will contain embedded semantic actions whic

Re: Embedding & Extending Python &other scripting languages

2005-04-20 Thread Maurice LING
Hi Tommy, After reading what you've written, it is still very vague for me. Is it a program that reads a specification and outputs the corresponding codes in the langauge you want? Cheers Maurice Tommy Nordgren wrote: I'm interested in doing a rather ambitious project concerning compiler constru

Re: Array of Chars to String

2005-04-20 Thread "Martin v. Löwis"
James Stroud wrote: > astr = "Bob Carol Ted Alice" > letters = "adB" Apparently nobody has proposed this yet: >>> filter(letters.__contains__, astr) 'Bad' >>> filter(set(letters).__contains__, astr) 'Bad' Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Pattern Matching Given # of Characters and no String Input; use RegularExpressions?

2005-04-20 Thread Synonymous
tiissa <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Synonymous wrote: > > tiissa <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > > > >>tiissa wrote: > >> > >>>If you know the number of characters to match can't you just compare > >>>slices? > >> > >>If you

Re: Pattern Matching Given # of Characters and no String Input; use RegularExpressions?

2005-04-20 Thread Synonymous
John Machin <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > On 17 Apr 2005 18:12:19 -0700, [EMAIL PROTECTED] (Synonymous) > wrote: > > > > >I will look for a Left$(str) function that looks at the first X > >characters for python :)). > > > > Wild goose chase alert! AFAIK there

Re: Enumerating formatting strings

2005-04-20 Thread Greg Ewing
Peter Otten wrote: Greg Ewing wrote: This seems to happen even with a custom subclass of tuple, so it must be doing an exact type check. No, it doesn't do an exact type check, but always calls the tuple method: I guess you mean len(). On further investigation, this seems to be right, except that it

Re: Python instances

2005-04-20 Thread M.E.Farmer
[EMAIL PROTECTED] wrote: > Hi, > > How do python instances work? > Why does the code at the end of my posting produce this output: > > list in a: > [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] > list in b: > [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] > > instead of > > list in a: > [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] > list in b

Embedding & Extending Python &other scripting languages

2005-04-20 Thread Tommy Nordgren
I'm interested in doing a rather ambitious project concerning compiler construction tools. My tools will parse specification files containing for example lalr parser specifications. The specifications will contain embedded semantic actions which i want to allow writing in any object-oriented langu

Re: memory profiler?

2005-04-20 Thread Peter Hansen
John Reese wrote: Is there a memory or heap profiler for python programs? So that, for example, if a program was bloating over time I could see how many of each object there were and maybe even where the references were? The "gc" module has a variety of helpful features like that. -Peter -- http:/

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2005-04-20, Torsten Bronger schreef <[EMAIL PROTECTED]>: >> Hallöchen! >> >> [EMAIL PROTECTED] (Nick Efford) writes: >> >>> [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Many people I know ask why Python does slicing the way it does. >>>

memory profiler?

2005-04-20 Thread John Reese
Good afternoon, ha ha ha! Is there a memory or heap profiler for python programs? So that, for example, if a program was bloating over time I could see how many of each object there were and maybe even where the references were? -- http://mail.python.org/mailman/listinfo/python-list

python-dev Summary for 2005-04-01 through 2005-04-15

2005-04-20 Thread Tim Lesher
[The HTML version of this Summary is available at http://www.python.org/dev/summary/2005-04-01_2005-04-15.html] == Summary Announcements == --- New python-dev summary team --- This summary marks the first b

Re: Resolving 10060, 'Operation timed out'

2005-04-20 Thread Peter Hansen
Larry Bates wrote: My manual says that socket has a settimeout(value) but I don't seem to find anything on socket.setdefaulttimeout method you refer to. Larry, the module has a setdefaulttimeout() function, while socket objects themselves have a settimeout(). To the OP: did you already create your

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread Peter Hansen
James Carroll wrote: If you have five elements, numbered 0,1,2,3,4 and you ask for the elements starting with the first one, and so on for the length you would have [0:length]. So [0:5] gives you elemets 0,1,2,3,4. Think of the weirdess if you had to ask for [0:length-1] to get length elements.

Re: Enumerating formatting strings

2005-04-20 Thread Michael Spencer
Andrew Dalke wrote: I see you assume that only \w+ can fit inside of a %() in a format string. The actual Python code allows anything up to the balanced closed parens. Gah! I guess that torpedoes the regexp approach, then. Thanks for looking at this Michael -- http://mail.python.org/mailman/listin

Re: Faster os.walk()

2005-04-20 Thread fuzzylollipop
ding, ding, ding, we have a winner. One of the guys on the team did just this, he re-implemented the os.walk() logic and embedded the logic to the S_IFDIR, S_IFMT and S_IFREG directly into the transversal code. This is all going to run on unix or linux machines in production so this is not a big

Re: inner sublist positions ?

2005-04-20 Thread Steven Bethard
Bernard A. wrote: hello, while trying to play with generator, i was looking for an idea to get the position of a inner list inside another one, here is my first idea : - first find position of first inner element, - and then see if the slice starting from here is equal to the inner -> def subPo

Using Jython in Ant Build Process

2005-04-20 Thread Maurice LING
Hi, I am looking for a way to use Jython in Ant build process. I have some pure Python scripts (not using any C extensions) that I'll like to incorporate into Java using Jython. I heard that this can be done but you can I set up Ant to do this? Sorry, I'm no expert with Ant. By the way, I'm usi

Re: Python instances

2005-04-20 Thread EuGeNe
[EMAIL PROTECTED] wrote: Hi, How do python instances work? Why does the code at the end of my posting produce this output: list in a: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] list in b: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] instead of list in a: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] list in b: [] -

Re: Writing to stdout and a log file

2005-04-20 Thread Mike
Perfect. This is what I"ll use. Thanks! Mike -- http://mail.python.org/mailman/listinfo/python-list

SSL via Proxy (URLLIB2) on Windows gives Unknown Protocol error?

2005-04-20 Thread Benjamin Schollnick
Folks, With Windows XP, and Python v2.41 I am running into a problem The following code gives me an unknown protocol error And I am not sure how to resolve it... I have a API written for DocuShare for a non-SSL server, and I wanted to update it to support the SSL/S3 login So here's

Re: Enumerating formatting strings

2005-04-20 Thread Andrew Dalke
Michael Spencer wrote: > I have wrapped up my current understanding in the following class: I see you assume that only \w+ can fit inside of a %() in a format string. The actual Python code allows anything up to the balanced closed parens. >>> class Show: ... def __getitem__(self, text): ...

Re: Python Win32 Extensions and Excel 2003. OL 11.0 Supported?

2005-04-20 Thread John Machin
On Wed, 20 Apr 2005 13:05:54 -0400, Steve Holden <[EMAIL PROTECTED]> wrote: >Mudcat wrote: >> Howdy, >> >> I could have sworn I downloaded a version of python win that supported >> object library 11.0 at some point. However I just downloaded versions >> 204 and 203, and the highest version they h

inner sublist positions ?

2005-04-20 Thread Bernard A.
hello, while trying to play with generator, i was looking for an idea to get the position of a inner list inside another one, here is my first idea : - first find position of first inner element, - and then see if the slice starting from here is equal to the inner -> >>> def subPositions(alist,

Re: pyGTK on Mouse over event ?

2005-04-20 Thread tiissa
[EMAIL PROTECTED] wrote: def __init__(self): xml = gtk.glade.XML("/home/domenique/project1.glade") self.window = xml.get_widget("window1") self.img = xml.get_widget("image1") self.img.set_from_file("./test.svg") self.img.show() self.img.add_events(gtk.gdk.BUTTON_MOTION_MASK)

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread Terry Hancock
On Wednesday 20 April 2005 12:28 pm, Roy Smith wrote: > Terry Hancock wrote: > >> I used to make "off by one" errors all the time in both C and Fortran, > >> whereas I hardly ever make them in Python. > > Part of the reason may be that most loops over lists involve > iterators, > both endpoints

Re: pyGTK on Mouse over event ?

2005-04-20 Thread [EMAIL PROTECTED]
no problem i'll just keep using the eventbox but is there an event wich is triggert when the mouse moves over the eventbox ? -- http://mail.python.org/mailman/listinfo/python-list

Re: pyGTK on Mouse over event ?

2005-04-20 Thread tiissa
[EMAIL PROTECTED] wrote: def __init__(self): xml = gtk.glade.XML("/home/domenique/project1.glade") self.window = xml.get_widget("window1") self.img = xml.get_widget("image1") self.img.set_from_file("./test.svg") self.img.show() self.img.add_events(gtk.gdk.BUTTON_MOTION_MASK)

Re: Define Constants

2005-04-20 Thread Eric Nieuwland
codecraig wrote: My directory structure looks like... C:\ --> abc.py --> utils --> __init__.py --> CustomThing.py Ok, CustomThing looks like... TOP = 0 LEFT = 1 class CustomThing: def __init__(self): self.foo = "foo" so, from abc.py I have from utils.Custom

Re: Define Constants

2005-04-20 Thread Steven Bethard
codecraig wrote: Hi, I have a question about how to define constants. My directory structure looks like... C:\ --> abc.py --> utils --> __init__.py --> CustomThing.py Ok, CustomThing looks like... TOP = 0 LEFT = 1 class CustomThing: def __init__(self): self

Define Constants

2005-04-20 Thread codecraig
Hi, I have a question about how to define constants. My directory structure looks like... C:\ --> abc.py --> utils --> __init__.py --> CustomThing.py Ok, CustomThing looks like... TOP = 0 LEFT = 1 class CustomThing: def __init__(self): self.foo = "foo"

Re: pyGTK on Mouse over event ?

2005-04-20 Thread [EMAIL PROTECTED]
def __init__(self): xml = gtk.glade.XML("/home/domenique/project1.glade") self.window = xml.get_widget("window1") self.img = xml.get_widget("image1") self.img.set_from_file("./test.svg") self.img.show() self.img.add_events(gtk.gdk.BUTTON_MOTION_MASK) xml.signal_autoconne

Re: New Python regex Doc (was: Python documentation moronicities)

2005-04-20 Thread marco
Re: http://xahlee.org/perl-python/python_re-write/lib/module-re.html Bill Mill <[EMAIL PROTECTED]> writes: > Alright, I feel like I'm feeding the trolls just by posting in this > thread. Just so that nobody else has to read the "revised" docs, no it > doesn't: I find that Lee's version compleme

Re: What's the difference between these 2 statements?

2005-04-20 Thread tiissa
Peter Otten wrote: Still, for practical purposes you have to test for slicelen >= stringlen, so whether you choose None, -len(s)-1, or -sys.maxint as the second slice parameter doesn't matter much. Sure, for practical purposes you don't bother to write extra characters and leave it void. But we kn

Re: What's the difference between these 2 statements?

2005-04-20 Thread Peter Otten
tiissa wrote: > Peter Otten wrote: >> [EMAIL PROTECTED] wrote: >> >> >>>so if I want to reverse it fully using s[len(s)-1:x:-1] what would x be >>>or is it impossible to express it in this way ? >> >> >> This does not work for integers, because the theoretically correct value >> x = -1 already

Re: pyGTK on Mouse over event ?

2005-04-20 Thread tiissa
[EMAIL PROTECTED] wrote: if i add a motion_notify or even a butten_press event to an image object it does absolutly nothing :s I have tried coding a simple application in pyGTK and I remember I had trouble getting button_press event in a DrawingArea. I was using glade and despite having declared a

Re: building a small calculator

2005-04-20 Thread aleksander . helgaker
Thats great info. Thanks. I guess I would know about this if I read through all the manuals, but I'm awefull at reading that kind of stuff. I'll just have to plow through it somehow. -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the difference between these 2 statements?

2005-04-20 Thread tiissa
Peter Otten wrote: [EMAIL PROTECTED] wrote: so if I want to reverse it fully using s[len(s)-1:x:-1] what would x be or is it impossible to express it in this way ? This does not work for integers, because the theoretically correct value x = -1 already has another interpretation as the gap betwee

Re: pyGTK on Mouse over event ?

2005-04-20 Thread [EMAIL PROTECTED]
if i add a motion_notify or even a butten_press event to an image object it does absolutly nothing :s -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the difference between these 2 statements?

2005-04-20 Thread tiissa
[EMAIL PROTECTED] wrote: I'm sorry, I'm not really following your logic. Can you supply the statement with the three parameters ? so if I want to reverse it fully using s[len(s)-1:x:-1] what would x be or is it impossible to express it in this way ? Contrary to what I said above x should be _strict

Re: What's the difference between these 2 statements?

2005-04-20 Thread ATSkyWalker
Peter, I like the way you put it "the gap between the last and the last but one character" :-). I guess this is a side effect of of python's asymetric slice indexing approach which takes a little getting used to. AT -- http://mail.python.org/mailman/listinfo/python-list

Re: Enumerating formatting strings

2005-04-20 Thread Michael Spencer
Bengt Richter wrote: On Wed, 20 Apr 2005 11:01:28 +0200, Peter Otten <[EMAIL PROTECTED]> wrote: ... "%s %(x)s %(y)s" % D() My experiments suggest that you can have a maximum of one unnamed argument in a mapping template - this unnamed value evaluates to the map itself ... So under what circumstanc

Re: What's the difference between these 2 statements?

2005-04-20 Thread Peter Otten
[EMAIL PROTECTED] wrote: > so if I want to reverse it fully using s[len(s)-1:x:-1] what would x be > or is it impossible to express it in this way ? This does not work for integers, because the theoretically correct value x = -1 already has another interpretation as the gap between the last and

freeze question..

2005-04-20 Thread chong tan
I have the code that import the xml dom module: import xml.dom.minido that works OK. But the freeze version keeps getting me this error: ImportError: No module named dom I run freeze this way: freeze -q -E my.py any idea and suggestion ? thanks tan -- http://mail.python.org/mailman/lis

Re: What's the difference between these 2 statements?

2005-04-20 Thread ahmedt
I'm sorry, I'm not really following your logic. Can you supply the statement with the three parameters ? so if I want to reverse it fully using s[len(s)-1:x:-1] what would x be or is it impossible to express it in this way ? Thanks, AT -- http://mail.python.org/mailman/listinfo/python-list

Re: pyGTK on Mouse over event ?

2005-04-20 Thread tiissa
[EMAIL PROTECTED] wrote: hello, Is there an event simular to the java event onMouseOver ? I want to get the coordinates of the mouse pointer when it is over an image ( GTKImage widget) I've tried using the EventBox with the motion_notify but that only seems to work when the mouse is pressed ? Why d

Re: Array of Chars to String

2005-04-20 Thread Michael Spencer
Kent Johnson wrote: Michael Spencer wrote: Anyway, here are the revised timings... ... print shell.timefunc(func_translate1, "Bob Carol Ted Alice" * multiplier, 'adB') What is shell.timefunc? This snippet, which I attach to my interactive shell, since I find timeit awkward to use in that co

Re: What's the difference between these 2 statements?

2005-04-20 Thread Reinhold Birkenfeld
tiissa wrote: > Reinhold Birkenfeld wrote: >> ATSkyWalker wrote: >> >>>What's the difference between these 2 statements? >>> >>>If you have a String s="12345" >>> >>>s[len(s)::-1] = "54321" >>> >>>But >>> >>>s[len(s):0:-1] = "5432" >>> >>>Why? What's the difference? What number then can I use as t

Re: What's the difference between these 2 statements?

2005-04-20 Thread ahmedt
s[len(s):-1:-1] yields an empty list ! Test code : s = "12345" print s[len(s)::-1] -> prints "54321" print s[len(s):-1:-1] -> prints "" (nothing) -- http://mail.python.org/mailman/listinfo/python-list

python-text window vs. game/graphics window

2005-04-20 Thread D. Hartley
Hello, group! I am asking anyone who is knowledgeable about entering text into the text window while a game/graphics window is running (am using pygame). I have asked this on the 'tutor' mailing list and no one could/would answer it. I am making a space invaders clone for my Python Teacher's bir

Re: What's the difference between these 2 statements?

2005-04-20 Thread Reinhold Birkenfeld
ATSkyWalker wrote: > What's the difference between these 2 statements? > > If you have a String s="12345" > > s[len(s)::-1] = "54321" > > But > > s[len(s):0:-1] = "5432" > > Why? What's the difference? What number then can I use as the end of > the slice if I were to supply all 3 parameters?

Re: What's the difference between these 2 statements?

2005-04-20 Thread tiissa
Reinhold Birkenfeld wrote: ATSkyWalker wrote: What's the difference between these 2 statements? If you have a String s="12345" s[len(s)::-1] = "54321" But s[len(s):0:-1] = "5432" Why? What's the difference? What number then can I use as the end of the slice if I were to supply all 3 parameters? -1

Re: Array of Chars to String

2005-04-20 Thread Kent Johnson
Michael Spencer wrote: Anyway, here are the revised timings... ... print shell.timefunc(func_translate1, "Bob Carol Ted Alice" * multiplier, 'adB') What is shell.timefunc? Thanks, Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Faster os.walk()

2005-04-20 Thread Lonnie Princehouse
If you're trying to track changes to files on (e.g. by comparing current size with previously recorded size), fam might obviate a lot of filesystem traversal. http://python-fam.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

What's the difference between these 2 statements?

2005-04-20 Thread ATSkyWalker
What's the difference between these 2 statements? If you have a String s="12345" s[len(s)::-1] = "54321" But s[len(s):0:-1] = "5432" Why? What's the difference? What number then can I use as the end of the slice if I were to supply all 3 parameters? Thanks, AT -- http://mail.python.org/mail

pyGTK on Mouse over event ?

2005-04-20 Thread [EMAIL PROTECTED]
hello, Is there an event simular to the java event onMouseOver ? I want to get the coordinates of the mouse pointer when it is over an image ( GTKImage widget) I've tried using the EventBox with the motion_notify but that only seems to work when the mouse is pressed ? -- http://mail.python.org/

Re: pre-PEP: Suite-Based Keywords - syntax proposal

2005-04-20 Thread Ron
Steven Bethard wrote: Ron wrote: How about using ***name in the same way as *name, and **name are used? It extends the current argument options in a consistent manner and 'I believe' is easy to explain and visually says something different is happening here. This builds on the already present a

Re: Troll? was: Re: goto statement

2005-04-20 Thread Steve Holden
Maxim Kasimov wrote: André Roberge wrote: Maxim Kasimov wrote: by the way, "goto" statement will be useful for writing more powerful obfuscators Let me get that clear: you want a goto to help with debugging. And you want to obfuscate your code even more? !? Perhaps you need to write in Perl, or s

Re: using locales

2005-04-20 Thread vincent wehren
<[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] | | Is there some sort of tutorial on locales or the locale module? | | I can't seem to find a list showing all possible locales. I made 'en' | work alright, but when I tried 'de' or 'de_DE' or 'es_ES', etc. it said | that those we

Re: Array of Chars to String

2005-04-20 Thread Michael Spencer
Peter Otten wrote: Michael Spencer wrote: def func_join(s, letters): ... return "".join(letter for letter in s if letter in set(letters)) Make that def func_join(s, letters): letter_set = set(letters) return "".join(letter for letter in s if letter in letter_set) for a fair timing o

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread Javier Bezos
"James Stroud" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > I like this, it works for any integer. > >>> str="asdfjkl;" > >>> i=-400 > >>> print str[:i]+str[i:] > asdfjkl; > >>> i = 65534214 > >>> print str[:i]+str[i:] > asdfjkl; Actually, this has no relation with the half

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread Javier Bezos
<[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > Many people I know ask why Python does slicing the way it does. > > Can anyone /please/ give me a good defense/justification??? > > I'm referring to why mystring[:4] gives me > elements 0, 1, 2 and 3 but *NOT* mystring[4] (5th

Re: goto statement

2005-04-20 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Maxim Kasimov <[EMAIL PROTECTED]> wrote: . . . >>> if you need to comment a couple of code (and then uncomment ), what >>> are you doing then? >> >> >> Use comments? >> > >WOW, just greate!

Re: goto statement

2005-04-20 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Maxim Kasimov <[EMAIL PROTECTED]> wrote: >Simon Brunning wrote: >> On 4/20/05, Maxim Kasimov <[EMAIL PROTECTED]> wrote: >> >>>it would be quite useful for debuging porposes >> >> >> How does goto help you to remove bugs? >> >> I can certainly see how it helps yo

Re: goto statement

2005-04-20 Thread Robert Kern
Matt Feinstein wrote: On Wed, 20 Apr 2005 10:23:58 +0100 (BST), praba kar <[EMAIL PROTECTED]> wrote: Dear All, In Python what is equivalent to goto statement I'd like to that implemented in an interpreted language. Requires some time travel. Yes, to 2004-04-01. -- Robert Kern [EMAIL PROTECTED] "

Re: Python Debugger with source code tracking ability

2005-04-20 Thread Skip Montanaro
Tran> I am new to Python and desperated to look for a good Python Tran> debugger. I mean a debugger with source coding tracking. For Tran> C/C++, emacs and gud offers execellent development env. The source Tran> code tracking is extremely useful for recursive functions. There is

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread James Stroud
I like this, it works for any integer. >>> str="asdfjkl;" >>> i=-400 >>> print str[:i]+str[i:] asdfjkl; >>> i = 65534214 >>> print str[:i]+str[i:] asdfjkl; Please forgive my reassigning str. I am one of those type first think later programmers. -- James Stroud UCLA-DOE Institute for Genomics a

Re: Resolving 10060, 'Operation timed out'

2005-04-20 Thread Larry Bates
My manual says that socket has a settimeout(value) but I don't seem to find anything on socket.setdefaulttimeout method you refer to. settimeout( value) Set a timeout on blocking socket operations. The value argument can be a nonnegative float expressing seconds, or None. If a float is given, su

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread James Carroll
If you have five elements, numbered 0,1,2,3,4 and you ask for the elements starting with the first one, and so on for the length you would have [0:length]. So [0:5] gives you elemets 0,1,2,3,4. Think of the weirdess if you had to ask for [0:length-1] to get length elements... One based 1... n

Re: goto statement

2005-04-20 Thread Matt Feinstein
On Wed, 20 Apr 2005 10:23:58 +0100 (BST), praba kar <[EMAIL PROTECTED]> wrote: >Dear All, > > In Python what is equivalent to goto statement I'd like to that implemented in an interpreted language. Requires some time travel. Matt Feinstein -- There is no virtue in believing something that can

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread James Stroud
On Tuesday 19 April 2005 10:58 pm, [EMAIL PROTECTED] wrote: > Many people I know ask why Python does slicing the way it does. > > Can anyone /please/ give me a good defense/justification??? Here you go, no remembering "+1" or "-1". Also, see the hundreds of other times this topic has graced t

Re: newbie question

2005-04-20 Thread Tiziano Bettio
Cameron Laird wrote: In article <[EMAIL PROTECTED]>, Tiziano Bettio <[EMAIL PROTECTED]> wrote: . . . If u want to achieve high performance you'd rather use c++ and directly access libs like nvidias cg, ms directx or opengl... . . . Yes. Well, maybe. Python-coded progra

Resolving 10060, 'Operation timed out'

2005-04-20 Thread willitfw
Does anyone know how to prevent this error from occurring: IOError: [Errno socket error] (10060, 'Operation timed out'). I am using the following code without any luck. Obviously I am missing something. import socket socket.setdefaulttimeout(20) Thank you in advance. Tom Williams -- http://m

Re: Troll? was: Re: goto statement

2005-04-20 Thread Fredrik Lundh
Bill Mill wrote: I believe he meant obfuscating bytecode for a commercial product, to try and avoid decompilation, which is often a desirable function for commercial entities. there is no shortage of "jump" instructions on the bytecode level, so if he wants to obfuscate bytecode, all he has to do

Re: goto statement

2005-04-20 Thread Philippe C. Martin
I guess the point could be "where do you draw the line": you can break and continue in Python, but you cannot goto. Some people, so it seems ;-) , would like to see gotos in Python whereas other think breaks and continues should be excluded ...; Regards, Philippe Steve Holden wrote: > Philipp

Re: Faster os.walk()

2005-04-20 Thread Nick Craig-Wood
fuzzylollipop <[EMAIL PROTECTED]> wrote: > I am trying to get the number of bytes used by files in a directory. > I am using a large directory ( lots of stuff checked out of multiple > large cvs repositories ) and there is lots of wasted time doing > multiple os.stat() on dirs and files from di

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread Roy Smith
Terry Hancock wrote: >> I used to make "off by one" errors all the time in both C and Fortran, >> whereas I hardly ever make them in Python. Part of the reason may be that most loops over lists involve iterators, where the details of the index limits are hidden. In Python, you write: for item i

Re: Faster os.walk()

2005-04-20 Thread Kent Johnson
fuzzylollipop wrote: after extensive profiling I found out that the way that os.walk() is implemented it calls os.stat() on the dirs and files multiple times and that is where all the time is going. os.walk() is pretty simple, you could copy it and make your own version that calls os.stat() just o

Re: Python Debugger with source code tracking ability

2005-04-20 Thread Philippe C. Martin
Idle (does have source tracking) Eclipse + pydev Eric3 (Linux only) The problem I have with any of them (as well as my own debugger) is their speed: I believe they all use bdb that is currently fairly slow stepping over extensive amount of code Regards, Philippe Tran Tuan Anh wrote: > Hi a

Re: goto statement

2005-04-20 Thread Steve Holden
Philippe C. Martin wrote: I do not want to pollute the debate but: -) I remember a software QA managanager responsible for "C" coding rules also not allowing us to use 'break', 'continue', or 'return' (in the middle of a function). And I once worked (back in the 1970's) in a software shop where "

Re: Faster os.walk()

2005-04-20 Thread Philippe C. Martin
How about rerouting stdout/err and 'popening" something like /bin/find -name '*' -exec a_script_or_cmd_that_does_what_i_want_with_the_file {} \; ? Regards, Philippe fuzzylollipop wrote: > du is faster than my code that does the same thing in python, it is > highly optomized at the os leve

Re: (Python newbie) Using XP-SP2/MSVC6: No Python24_d.lib,winzip barfs on Python-2.4.1.tar, cannot download bzip2

2005-04-20 Thread Scott David Daniels
Bill Davy wrote: Thanks Jaime, I'm making gradual progress and am finding it quite satisfying. Resorted to tracing Python in MSVC6 to see what it was trying to IMPORT, which is a bit heavy but thank heavens for the sources. You might try running python from a command window and running it "-v"

Re: using locales

2005-04-20 Thread Damjan
> Is there some sort of tutorial on locales or the locale module? > > I can't seem to find a list showing all possible locales. I think this depends on the platform > Anyway, I'd love to have a method called get_available_locales to tell > me what I can use on my machine, or something like that

Re: Troll? was: Re: goto statement

2005-04-20 Thread Bill Mill
On 4/20/05, Robert Kern <[EMAIL PROTECTED]> wrote: > Maxim Kasimov wrote: > > André Roberge wrote: > > > >> Maxim Kasimov wrote: > >> > >>> > >>> by the way, "goto" statement will be useful for writing more powerful > >>> obfuscators > >>> > >> Let me get that clear: you want a goto to help with de

Re: building a small calculator

2005-04-20 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 2005-04-20 08:41: Sorry. This is my first day using Python. Is there an equivelent to the goto command? I want to find some way to take the user back to the main menu. When I first started learning Python some long time after having done some BASIC, I fo

Re: Python Win32 Extensions and Excel 2003. OL 11.0 Supported?

2005-04-20 Thread Steve Holden
Mudcat wrote: Howdy, I could have sworn I downloaded a version of python win that supported object library 11.0 at some point. However I just downloaded versions 204 and 203, and the highest version they have is OL 9.0. Does anyone know if this is a mistake or if Excel 2003 isn't yet supported with

Re: Faster os.walk()

2005-04-20 Thread fuzzylollipop
du is faster than my code that does the same thing in python, it is highly optomized at the os level. that said, I profiled spawning an external process to call du and over the large number of times I need to do this it is actually slower to execute du externally than my os.walk() implementation.

Re: pythonic use of properties?

2005-04-20 Thread Scott David Daniels
Michael Spencer wrote: ... of course there are cases where data must be validated. For data stored in one type, and used in many contexts - I would validate where stored. If the reverse, then validate at the point it is used... The big exception to this rule is "temporal" -- data used long af

Re: Troll? was: Re: goto statement

2005-04-20 Thread Robert Kern
Maxim Kasimov wrote: André Roberge wrote: Maxim Kasimov wrote: by the way, "goto" statement will be useful for writing more powerful obfuscators Let me get that clear: you want a goto to help with debugging. And you want to obfuscate your code even more? !? Perhaps you need to write in Perl, or s

Re: Troll? was: Re: goto statement

2005-04-20 Thread Maxim Kasimov
André Roberge wrote: Maxim Kasimov wrote: by the way, "goto" statement will be useful for writing more powerful obfuscators Let me get that clear: you want a goto to help with debugging. And you want to obfuscate your code even more? !? Perhaps you need to write in Perl, or some other similar lan

Re: goto statement

2005-04-20 Thread Philippe C. Martin
Loop bodies (for break) Grant Edwards wrote: > On 2005-04-20, Philippe C. Martin <[EMAIL PROTECTED]> wrote: > >> Although I find them 'cleaner' than goto, would not use goto, >> and certainly do use 'return' in the middle of functions, I >> also agree that some people might think the former do

Re: goto statement

2005-04-20 Thread Grant Edwards
On 2005-04-20, Philippe C. Martin <[EMAIL PROTECTED]> wrote: > Although I find them 'cleaner' than goto, would not use goto, > and certainly do use 'return' in the middle of functions, I > also agree that some people might think the former do reduce > code readibility - ex: I , somehow, do not fee

Re: Python Debugger with source code tracking ability

2005-04-20 Thread Steve Holden
Richard Eibrand wrote: On 4/20/05, Jaime Wyant <[EMAIL PROTECTED]> wrote: I haven't tried the customizations listed at the site below. If it works, let me know. http://page.sourceforge.net/tricks.html jw On 19 Apr 2005 19:45:05 -0700, Tran Tuan Anh <[EMAIL PROTECTED]> wrote: Hi all, I am new to Py

Re: goto statement

2005-04-20 Thread Philippe C. Martin
I do not want to pollute the debate but: -) I remember a software QA managanager responsible for "C" coding rules also not allowing us to use 'break', 'continue', or 'return' (in the middle of a function). Although I find them 'cleaner' than goto, would not use goto, and certainly do use 'return

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread Torsten Bronger
HallÃchen! Bernhard Herzog <[EMAIL PROTECTED]> writes: > Torsten Bronger <[EMAIL PROTECTED]> writes: > >>> http://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF >> >> I see only one argument there: "Inclusion of the upper bound >> would then force the latter to be unnatural by the time the >> seq

using locales

2005-04-20 Thread garykpdx
Is there some sort of tutorial on locales or the locale module? I can't seem to find a list showing all possible locales. I made 'en' work alright, but when I tried 'de' or 'de_DE' or 'es_ES', etc. it said that those were not valid locaes. Worst of all, when I tried 'es' it said that this was est

Re: logging to two files

2005-04-20 Thread Duncan Booth
Tor Erik Sønvisen wrote: > Hi > > Have the following code: > import logging > > logging.basicConfig(level = logging.DEBUG, > format = '[%(levelname)-8s %(asctime)s] > %(message)s', > filename = 'rfs.log', >

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread Bernhard Herzog
Torsten Bronger <[EMAIL PROTECTED]> writes: >> http://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF > > I see only one argument there: "Inclusion of the upper bound would > then force the latter to be unnatural by the time the sequence has > shrunk to the empty one." While this surely is unaesth

  1   2   3   >