Re: Array of Chars to String

2005-04-20 Thread Peter Otten
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 of a set lo

Re: Writing to stdout and a log file

2005-04-20 Thread Wolfram Kraus
Mike wrote: I would like my 'print' statements to send its output to the user's screen and a log file. This is my initial attempt: class StdoutLog(file): def __init__(self, stdout, name='/tmp/stdout.log', mode='w',bufsize=-1): super(StdoutLog, self).__init__(name,mode,bufsize) s

Re: pre-PEP: Simple Thunks

2005-04-20 Thread Mike Meyer
Ron_Adam <[EMAIL PROTECTED]> writes: > Here's yet another way to do it, but it has some limitations as well. > > import pickle > def pickle_it(filename, obj, commands): > try: > f = open(filename, 'r') > obj = pickle.load(f) > f.close() > except IOError: >

Re: Enumerating formatting strings

2005-04-20 Thread Peter Otten
Greg Ewing wrote: > Steve Holden wrote: > >> I've been wondering whether it's possible to perform a similar analysis >> on non-mapping-type format strings, so as to know how long a tuple to >> provide, > > I just tried an experiment, and it doesn't seem to be possible. > > The problem seems to

To decode the Subject =?iso-8859-2?Q?=... in email in python

2005-04-20 Thread Dan Polansky
When parsing messages using python's libraries email and mailbox, the subject is often encoded using some kind of = notation. Apparently, the encoding used in this notation is specified like =?iso-8859-2?Q?=... or =?iso-8859-2?B?=. Is there a python library function to decode such a subject, return

Python instances

2005-04-20 Thread henrikpierrou
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: [] class MyClass:

Re: Python instances

2005-04-20 Thread Roland Heiber
Hi, class MyClass: list = [] you have "list" defined as a classmember, not an instancemember. So "list" ist defined ONCE for all instances. Try this instead: class MyClass: def __init__(self): self.list = [] [...] and use self.list ... HtH, Roland -- http://mail.python.org/mailman

long time we haven't spoken ;)

2005-04-20 Thread Elbert Delaney
Daayuum bro You'll never guess what happened to me last week. Basically found a 18 + date site that doesn't charge anything. So many couples, guys and girls are there messaging and meeting eachother. And I'm certain there is someone (or more than one) for you. Although most of them want one-ni

Re: To decode the Subject =?iso-8859-2?Q?=... in email in python

2005-04-20 Thread Max M
Dan Polansky wrote: When parsing messages using python's libraries email and mailbox, the subject is often encoded using some kind of = notation. Apparently, the encoding used in this notation is specified like =?iso-8859-2?Q?=... or =?iso-8859-2?B?=. Is there a python library function to decode su

Re: Python instances

2005-04-20 Thread henrikpierrou
Guess i shouldn't think of the __init__(self) function as a constructor then. Thanks. /H -- http://mail.python.org/mailman/listinfo/python-list

Fwd: Memory leak in python

2005-04-20 Thread Abhishek S
Hi Nick, Thanks for reply... Please include me in reply. Currently i am not in the list (i will subscribe soon) I upgarded to 2.4.1 - still the same issue. Nick> Thats not a lot of leak - have you done that over a longer time period? Abhi> I have tried for 4 days. It has reached 150MB. Nick> A

Re: Python instances

2005-04-20 Thread Laszlo Zsolt Nagy
Guess i shouldn't think of the __init__(self) function as a constructor then. __init__ is THE constructor in Python -- _ Laszlo Nagy web: http://designasign.biz IT Consultantmail: [EMAIL PROTECTED

Re: To decode the Subject =?iso-8859-2?Q?=... in email in python

2005-04-20 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2005-04-20 00:30:35 -0700: > When parsing messages using python's libraries email and mailbox, the > subject is often encoded using some kind of = notation. Apparently, the > encoding used in this notation is specified like =?iso-8859-2?Q?=... or > =?iso-8859-2?B?=. That'

Re: Enumerating formatting strings

2005-04-20 Thread Bengt Richter
On Wed, 20 Apr 2005 09:14:40 +0200, Peter Otten <[EMAIL PROTECTED]> wrote: >Greg Ewing wrote: > >> Steve Holden wrote: >> >>> I've been wondering whether it's possible to perform a similar analysis >>> on non-mapping-type format strings, so as to know how long a tuple to >>> provide, >> >> I jus

Re: Python Google Server

2005-04-20 Thread Fuzzyman
Thanks Benji, It returns the results using an ip address - not the google domain. This means IPCop bans it :-( Thanks for the suggestion though. In actual fact the googleCacheServer works quite well. Best Regards, Fuzzy http://www.voidspace.org.uk/python/weblog -- http://mail.python.org/mailm

Re: Proposal: an unchanging URL for Python documentation

2005-04-20 Thread Simon Brunning
On 4/19/05, Skip Montanaro <[EMAIL PROTECTED]> wrote: > ... the documentation for the os > steve> module would also be available at > steve> http://python.org/doc/current/lib/module-os.html. > > Time machine at work? The above URL works for me now. Yup, but it's not all unchanging. Take,

Re: Python instances

2005-04-20 Thread Bengt Richter
On 20 Apr 2005 00:44:53 -0700, [EMAIL PROTECTED] wrote: >Guess i shouldn't think of the __init__(self) function as a constructor >then. >Thanks. Depends on what you think when you think "constructor" ;-) Read about both __new__ and __init__. The former is always necessary to create an object, and

PyObject_New not running tp_new for iterators?

2005-04-20 Thread Gregory Bond
I'm trying to extend Python with an iterator class that should be returned from a factory function. For some reason the iterator object is not being properly initialised if the iterator is created in a C function. It works just fine if the object is created using the class contructor Trying t

Re: Behaviour of str.split

2005-04-20 Thread David Fraser
Greg Ewing wrote: Will McGugan wrote: Hi, I'm curious about the behaviour of the str.split() when applied to empty strings. "".split() returns an empty list, however.. "".split("*") returns a list containing one empty string. Both of these make sense as limiting cases. Consider >>> "a b c".spli

Re: Enumerating formatting strings

2005-04-20 Thread Peter Otten
Bengt Richter wrote: > Parse might be a big word for > > >> def tupreq(fmt): return sum(map(lambda s:list(s).count('%'), > >> fmt.split('%%'))) > .. > >> tupreq('%s this %(x)s not %% but %s') > > (if it works in general ;-) Which it doesn't: >>> def tupreq(fmt): return sum(map(lambda s:lis

Re: xmlrpclib and binary data as normal parameter strings

2005-04-20 Thread Rune Froysa
"Richard Brodie" <[EMAIL PROTECTED]> writes: > "Rune Froysa" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >> From http://www.xmlrpc.com/spec :: >> Any characters are allowed in a string except < and &, which are >> encoded as < and &. A string can be used to encode binary >>

goto statement

2005-04-20 Thread praba kar
Dear All, In Python what is equivalent to goto statement regards, praba __ 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: goto statement

2005-04-20 Thread Mage
praba kar wrote: >Dear All, > > In Python what is equivalent to goto statement > > > You shouldn't use goto in high-level languages. Mage -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing to stdout and a log file

2005-04-20 Thread Mike
flushing stdout has no effect. I've got an implementation that does not subclass file. It's not as nice but it works. -- http://mail.python.org/mailman/listinfo/python-list

Re: Refactoring in Python.

2005-04-20 Thread Peter Dembinski
[EMAIL PROTECTED] writes: > Investigate the CVS histories of the few 1000s python projects > available at www.sourceforge.net I don't work with these guys :> -- http://www.pdemb.prv.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: XML parsing per record

2005-04-20 Thread Willem Ligtenberg
On Sun, 17 Apr 2005 02:16:04 +, William Park wrote: > Willem Ligtenberg <[EMAIL PROTECTED]> wrote: >> I want to parse a very large (2.4 gig) XML file (bioinformatics >> ofcourse :)) But I have no clue how to do that. Most things I see read >> the entire xml file at once. That isn't going to wo

Re: Behaviour of str.split

2005-04-20 Thread Bengt Richter
On Wed, 20 Apr 2005 10:55:18 +0200, David Fraser <[EMAIL PROTECTED]> wrote: >Greg Ewing wrote: >> Will McGugan wrote: >> >>> Hi, >>> >>> I'm curious about the behaviour of the str.split() when applied to >>> empty strings. >>> >>> "".split() returns an empty list, however.. >>> >>> "".split("*")

Re: goto statement

2005-04-20 Thread Simon Brunning
On 4/20/05, praba kar <[EMAIL PROTECTED]> wrote: >In Python what is equivalent to goto statement http://docs.python.org/tut/node6.html See, it's those dratted node numbers again. ;-) -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/m

Lex

2005-04-20 Thread jozo
I have to work on python lexical definition in Lex. I spent lots of my time to find regular expresions written for Lex of Python language but nothing. Can somebody help me? -- http://mail.python.org/mailman/listinfo/python-list

Re: goto statement

2005-04-20 Thread Maurice Caret
Simon Brunning a écrit : On 4/20/05, praba kar <[EMAIL PROTECTED]> wrote: In Python what is equivalent to goto statement http://docs.python.org/tut/node6.html See, it's those dratted node numbers again. ;-) other equivalents are in http://docs.python.org/tut/node10.html -- http://mail.python.org

Re: Enumerating formatting strings

2005-04-20 Thread Bengt Richter
On Wed, 20 Apr 2005 11:01:28 +0200, Peter Otten <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: > >> Parse might be a big word for >> >> >> def tupreq(fmt): return sum(map(lambda s:list(s).count('%'), >> >> fmt.split('%%'))) >> .. >> >> tupreq('%s this %(x)s not %% but %s') >> >> (if it wor

Re: goto statement

2005-04-20 Thread Simon Brunning
On 4/20/05, Maurice Caret <[EMAIL PROTECTED]> wrote: > > other equivalents are in > > http://docs.python.org/tut/node10.html I also missed , for the while statement. Those URLs just keeg getting better... -- Cheers, Simon B,

trying to understand unicode

2005-04-20 Thread F. Petitjean
Python has a very good support of unicode, utf8, encodings ... But I have some difficulties with the concepts and the vocabulary. The documentation is not bad, but for example in reading http://docs.python.org/lib/module-unicodedata.html I had a long time to figure out what unicodedata.digit(unichr

Re: goto statement

2005-04-20 Thread Maxim Kasimov
Mage wrote: praba kar wrote: Dear All, In Python what is equivalent to goto statement You shouldn't use goto in high-level languages. it would be quite useful for debuging porposes -- Best regards, Maxim Kasimov mailto: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

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 Bill Davy
Thank you Khalid, OK. (4) (compile using MSVC6) worked. Now working through various issues to do with paths and naming (_d suffix to root for DEBUG, _ prefix to root for SWIG, and I had not spotted that SWIG makes Module.py that imports _Module.pyd but not _Module_d.pyd for DEBUG builds).

Re: goto statement

2005-04-20 Thread Simon Brunning
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 you put them in in the first place... -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ --

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 Bill Davy
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. Had not thouight of "adapting" SWIG, and will think about it when I have a clearer vie

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

2005-04-20 Thread John Bokma
Raymond Hettinger wrote: > to seeing code like: for(i=0 ; i BASIC programmer may be used to FOR I = 1 to N: a[I]=f(I); NEXT. Afaik, at least BBC BASIC uses zero based arrays :-) Maybe ZX Spectrum Basic too (too long ago to remember). -- John MexIT: http://jo

Re: goto statement

2005-04-20 Thread John Bokma
Mage wrote: > praba kar wrote: > >>Dear All, >> >> In Python what is equivalent to goto statement >> >> >> > You shouldn't use goto in high-level languages. Nonsense -- John MexIT: http://johnbokma.com/mexit/ personal page: htt

Re: goto statement

2005-04-20 Thread Reinhold Birkenfeld
John Bokma wrote: > Mage wrote: > >> praba kar wrote: >> >>>Dear All, >>> >>> In Python what is equivalent to goto statement >>> >>> >>> >> You shouldn't use goto in high-level languages. > > Nonsense Thank you! Above all your claim is well justified. These brilliant arguments you have put

Re: goto statement

2005-04-20 Thread Maxim Kasimov
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 you put them in in the first place... if you need to comment a couple of code (and then uncomment ), wha

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

2005-04-20 Thread Nick Efford
[EMAIL PROTECTED] <[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??? > I'm referring to why mystring[:4] gives me > elements 0, 1, 2 and 3 but *NOT* mystring[4] (5th element). mystring[:4]

Re: goto statement

2005-04-20 Thread Robert Kern
Maxim Kasimov 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 you put them in in the first place... if you need to comment a couple of code (and

Re: goto statement

2005-04-20 Thread Maxim Kasimov
Robert Kern wrote: Maxim Kasimov 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 you put them in in the first place... if you need to comment a

Re: trying to understand unicode

2005-04-20 Thread John Machin
On 20 Apr 2005 10:58:35 GMT, "F. Petitjean" <[EMAIL PROTECTED]> wrote: >Python has a very good support of unicode, utf8, encodings ... But I >have some difficulties with the concepts and the vocabulary. You're not alone there. But I don't expect the docs for the Python implementation of Unicode t

Re: XML parsing per record

2005-04-20 Thread Kent Johnson
Willem Ligtenberg wrote: Willem Ligtenberg <[EMAIL PROTECTED]> wrote: I want to parse a very large (2.4 gig) XML file (bioinformatics ofcourse :)) But I have no clue how to do that. Most things I see read the entire xml file at once. That isn't going to work here ofcourse. So I would like to parse

Re: goto statement

2005-04-20 Thread Reinhold Birkenfeld
Maxim Kasimov wrote: > Robert Kern wrote: >> Maxim Kasimov 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 cer

Re: goto statement

2005-04-20 Thread Mage
Maxim Kasimov wrote: > WOW, just greate! ... but i'd like to relax at some more interesting > way than to comment each of rows > There are editors that can comment and uncomment blocks. In worst case you can use """ to comment blocks (not elegant but works). Mage -- http://mail.python.or

RE: goto statement

2005-04-20 Thread Sander Steffann
On 4/20/05, praba kar <[EMAIL PROTECTED]> wrote: >In Python what is equivalent to goto statement An old user-friendly cartoon that might be relevant: http://ars.userfriendly.org/cartoons/?id=2506 Have fun :-) Sander -- http://mail.python.org/mailman/listinfo/python-list

Re: goto statement

2005-04-20 Thread Simon Brunning
On 4/20/05, Maxim Kasimov <[EMAIL PROTECTED]> wrote: > WOW, just greate! ... but i'd like to relax at some more interesting way than > to comment each of rows Get a decent text editor. -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mai

Re: goto statement

2005-04-20 Thread Do Re Mi chel La Si Do
+1 Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: goto statement

2005-04-20 Thread Torsten Bronger
HallÃchen! Maxim Kasimov <[EMAIL PROTECTED]> writes: > [...] > > WOW, just greate! ... but i'd like to relax at some more > interesting way than to comment each of rows Then just use a good editor. TschÃ, Torsten. -- Torsten Bronger, aquisgrana, europa vetus -- http://mail.python.org/mailman

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

2005-04-20 Thread Torsten Bronger
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. > >> Can anyone /please/ give me a good defense/justification??? > >> I'm referring to why mystring[:4] gives me elements 0, 1,

building a small calculator

2005-04-20 Thread aleksander . helgaker
I'm learning to program python on my Mac and I'd like some help. I followed a tutorial which showed how to make a calculator for working out the area of a shape. E.g. the area of a circal is pi*r*r. To practice a bit I thought I'd make the program more advanced but I'm already having difficoulties

Re: building a small calculator

2005-04-20 Thread Simon Brunning
On 20 Apr 2005 05:18:17 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Now once the user has select a shape and typed in the lengths required, > the result is printed and the program quits. What I want to do is make > the program display the result and then make it wait for the user to > pre

Re: Python Debugger with source code tracking ability

2005-04-20 Thread Jaime Wyant
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 Python and desperated to look for a good Python debugger. > I mean

exception handling

2005-04-20 Thread Mage
Hello, def error_msg(msg): sys.exit(msg) try: do_something() if value != my_wish: error_msg('Invalid input') except: print "Fatal IO or Network error" This doesn't work because sys.exit raises an exception. I know that I can define exception types after except, bu

Re: building a small calculator

2005-04-20 Thread aleksander . helgaker
I get the following error message when using the command sys.exit(). name 'sys' is not defined. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python instances

2005-04-20 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Guess i shouldn't think of the __init__(self) function as a constructor then. No, that's not it. You shouldn't think of variables defined outside of a method as instance variables. In Java for example you can write something like public class MyClass { private List lis

Re: building a small calculator

2005-04-20 Thread Simon Brunning
On 20 Apr 2005 05:31:15 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I get the following error message when using the command sys.exit(). > > name 'sys' is not defined. You really are new at this, aren't you? ;-) You need to import the sys module before you use it. Put this at the top of

Re: building a small calculator

2005-04-20 Thread aleksander . helgaker
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. -- http://mail.python.org/mailman/listinfo/python-list

Redhat 9, Python 2.4.1, CGIHTTPServer problem

2005-04-20 Thread Bill Oldroyd
I cannot get a simple CGI-script to work with this combination : Redhat 9 Linux Both Python 2.41. and ActiveState Python 2.4.1 either as an Apache 2 cgi-script or using CGIHTTPServer. The same script works fine on Redhat 7.3. The script fails at 230 in CGIHTTPServer : osexecve(scriptfile,

Re: building a small calculator

2005-04-20 Thread Simon Brunning
On 20 Apr 2005 05:41:37 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Sorry. This is my first day using Python. Nothing to apologise for. We were all new to Python once. > Is there an equivelent to the goto command? I want to find some way to > take the user back to the main menu. Funny

Re: Writing to stdout and a log file

2005-04-20 Thread Michael Hoffman
Mike wrote: I should've mentioned I want StdoutLog to subclass the 'file' type because I need all the file attributes available. You might use a surrogate pattern. Here's one I use for this kind of situation, where I want to subclass but that can't be done for some reason. class SurrogateNotInite

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

2005-04-20 Thread Terry Hancock
On Wednesday 20 April 2005 01:36 am, Raymond Hettinger wrote: > <[EMAIL PROTECTED]> > > Many people I know ask why Python does slicing the way it does. [...] > Python's way has some useful properties: [...] > OTOH, it has some aspects that bite: [...] > I suspect that whether it feels natur

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

2005-04-20 Thread Antoon Pardon
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. >> >>> Can anyone /please/ give me a good defense/justificat

Re: goto statement

2005-04-20 Thread Michael Hoffman
praba kar wrote: In Python what is equivalent to goto statement http://groups-beta.google.com/group/comp.lang.python/msg/98264a0daa007c46 -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Behaviour of str.split

2005-04-20 Thread David Fraser
Bengt Richter wrote: On Wed, 20 Apr 2005 10:55:18 +0200, David Fraser <[EMAIL PROTECTED]> wrote: Greg Ewing wrote: Will McGugan wrote: Hi, I'm curious about the behaviour of the str.split() when applied to empty strings. "".split() returns an empty list, however.. "".split("*") returns a list c

Re: exception handling

2005-04-20 Thread Peter Otten
Mage wrote: > def error_msg(msg): > sys.exit(msg) > > try: > do_something() > if value != my_wish: >error_msg('Invalid input') > except: > print "Fatal IO or Network error" > > This doesn't work because sys.exit raises an exception. > > I know that I can define exception

Re: goto statement

2005-04-20 Thread Maxim Kasimov
Use multi-line string literals. ''' it will not help if there is another ''' or/and """ inside of code block This whole 'code' is "commented out", and you can use every type of """quote""" except three singles. ''' Or, if you really like the spirit of goto, use "if 0:". ... and add tabs to each str

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

2005-04-20 Thread Sion Arrowsmith
Raymond Hettinger <[EMAIL PROTECTED]> wrote: ><[EMAIL PROTECTED]> >> Many people I know ask why Python does slicing the way it does. >Python's way has some useful properties: > >* s == s[:i] + s[i:] > >* len(s[i:j]) == j-i # if s is long enough The latter being particularly helpful when i

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

2005-04-20 Thread Bill Mill
On 20 Apr 2005 12:52:19 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: > 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 slici

Re: goto statement

2005-04-20 Thread Maxim Kasimov
Torsten Bronger wrote: HallÃchen! Maxim Kasimov <[EMAIL PROTECTED]> writes: [...] WOW, just greate! ... but i'd like to relax at some more interesting way than to comment each of rows but what if i just can't to do this becouse i'm working thrue ssh, and have to use only installed editors (such

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

2005-04-20 Thread Torsten Bronger
HallÃchen! Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2005-04-20, Torsten Bronger schreef <[EMAIL PROTECTED]>: > >> [...] >> >> It's interesting to muse about a language that starts at "1" for >> all arrays and strings, as some more or less obsolete languages >> do. I think this is more intu

Re: goto statement

2005-04-20 Thread Simon Brunning
On 4/20/05, Maxim Kasimov <[EMAIL PROTECTED]> wrote: > > Or, if you really like the spirit of goto, > > use "if 0:". > > ... and add tabs to each string Get a decent text editor. What are you using? Notepad? -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- ht

Re: To decode the Subject =?iso-8859-2?Q?=... in email in python

2005-04-20 Thread Neil Hodgson
Dan Polansky: > When parsing messages using python's libraries email and mailbox, the > subject is often encoded using some kind of = notation. Apparently, the > encoding used in this notation is specified like =?iso-8859-2?Q?=... or > =?iso-8859-2?B?=. Is there a python library function to decode

Re: Python Debugger with source code tracking ability

2005-04-20 Thread Richard Eibrand
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 n

Re: exception handling

2005-04-20 Thread Roy Smith
Mage <[EMAIL PROTECTED]> wrote: >Hello, > > > def error_msg(msg): > sys.exit(msg) > > try: > do_something() > if value != my_wish: >error_msg('Invalid input') > except: > print "Fatal IO or Network error" > > This doesn't work because sys.exit raises an exceptio

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

2005-04-20 Thread beliavsky
Terry Hancock wrote: > So I like Python's slicing because it "bites *less*" than intervals in C or Fortran. I disagree. Programming languages should not needlessly surprise people, and a newbie to Python probably expects that x[1:3] = [x[1],x[2],x[3]] . Array-oriented languages, such as Fortran

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

2005-04-20 Thread Roy Smith
Antoon Pardon <[EMAIL PROTECTED]> wrote: > Personnaly I would like to have the choice. Sometimes I prefer to > start at 0, sometimes at 1 and other times at -13 or +7. Argggh. Having two (or more!) ways to do it, would mean that every time I read somebody else's code, I would have to figure out

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 12:52:19 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: >> Op 2005-04-20, Torsten Bronger schreef <[EMAIL PROTECTED]>: >> > Hallöchen! >> > >> > [EMAIL PROTECTED] (Nick Efford) writes: >> > >> >> [EMAIL PROTECTED] <[EMAIL PROTECT

Re: goto statement

2005-04-20 Thread Peter Hansen
Maxim Kasimov wrote: Torsten Bronger wrote: HallÃchen! Maxim Kasimov <[EMAIL PROTECTED]> writes: WOW, just greate! ... but i'd like to relax at some more interesting way than to comment each of rows but what if i just can't to do this becouse i'm working thrue ssh, and have to use only installed e

Re: XML-RPC -- send file

2005-04-20 Thread Skip Montanaro
codecraig> stefan: i added, "return 1" to my sendFile method on the server...took codecraig> care of the error, thanks. Yes, by default XML-RPC doesn't support objects like Python's None. As the error message indicated you have to enable allow_none to permit transmission of None. Skip

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: > >> Personnaly I would like to have the choice. Sometimes I prefer to >> start at 0, sometimes at 1 and other times at -13 or +7. > > Argggh. Having two (or more!) ways to do it, would mean that every

Re: goto statement

2005-04-20 Thread Maxim Kasimov
Peter Hansen wrote: Maxim Kasimov wrote: Torsten Bronger wrote: HallÃchen! Maxim Kasimov <[EMAIL PROTECTED]> writes: WOW, just greate! ... but i'd like to relax at some more interesting way than to comment each of rows but what if i just can't to do this becouse i'm working thrue ssh, and have to

Re: How to run Python in Windows w/o popping a DOS box?

2005-04-20 Thread pyguy2
Python.exe starts up a windows console which gives you things stdin, stderr, and stdout from the C runtime. Be warned that you do not have those things with the consoleless(?) pythonw.exe, stuff which MS intends for gui applications. It reminds me of select() on windows only working halfway (jus

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

2005-04-20 Thread Bill Mill
On 20 Apr 2005 13:39:42 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: > Op 2005-04-20, Bill Mill schreef <[EMAIL PROTECTED]>: > > On 20 Apr 2005 12:52:19 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: > >> Op 2005-04-20, Torsten Bronger schreef <[EMAIL PROTECTED]>: > >> > Hallöchen! > >> > > >> > [E

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

2005-04-20 Thread Diez B. Roggisch
> Personnaly I would like to have the choice. Sometimes I prefer to > start at 0, sometimes at 1 and other times at -13 or +7. Subclass from builtin list - and make the necessary adjustmenst yourself in an overloaded __getitem__. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/

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

2005-04-20 Thread Roy Smith
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, sometimes at 1 and other times at -13 or +7. >> >> Argggh. Having tw

Re: goto statement

2005-04-20 Thread Reinhold Birkenfeld
Maxim Kasimov wrote: >> >> Use multi-line string literals. >> >> ''' > > it will not help if there is another ''' or/and """ inside of code block Yes, but how often do you use them? And aren't you consistent in the choice of your quotes? >> This whole 'code' is "commented out", and you can >>

Re: goto statement

2005-04-20 Thread Reinhold Birkenfeld
Maxim Kasimov wrote: > f..., i don't requesting that "goto" was available in next versions of > python, > but i'm saying if it will be so, it will be easy and quickly _debug_ some > skripts, > _not only_ for commenting If you want, you can always use the goto module. Reinhold, no, I

Re: Python SSL Socket issue

2005-04-20 Thread adam
Try con.connect() before the first putrequest -adam -- http://mail.python.org/mailman/listinfo/python-list

Re: Redhat 9, Python 2.4.1, CGIHTTPServer problem

2005-04-20 Thread adam
It might not be the script, but might be the environment. I've been burned by something similar in the past when I had my CGI script in my home dir (default +r) and didnt have the permissions correct on the dir. Not only does the script have to be +r +x, but the dir it is in has to be as well for t

Re: goto statement

2005-04-20 Thread TZOTZIOY
On Wed, 20 Apr 2005 14:58:35 +0300, rumours say that Maxim Kasimov <[EMAIL PROTECTED]> might have written: >>> if you need to comment a couple of code (and then uncomment ), what >>> are you doing then? >> Use comments? >WOW, just greate! ... but i'd like to relax at some more interesting way

Re: newbie question

2005-04-20 Thread Cameron Laird
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...

random number between 0 and 20

2005-04-20 Thread aleksander . helgaker
How can I generate a random number between 0 - 20 and store the number in nrrandom? -- http://mail.python.org/mailman/listinfo/python-list

Re: goto statement

2005-04-20 Thread TZOTZIOY
On Wed, 20 Apr 2005 16:13:32 +0300, rumours say that Maxim Kasimov <[EMAIL PROTECTED]> might have written: >but what if i just can't to do this becouse i'm working thrue ssh, and have to >use only installed editors (such as vi) If you use plain vi (not vim) and you want to comment e.g. 5 lines o

Re: goto statement

2005-04-20 Thread Simon Brunning
On 4/20/05, Christos TZOTZIOY Georgiou <[EMAIL PROTECTED]> wrote: > If you need more help, I would gladly send you the output of `man vi' > from a non-GNU Unix. I can also send you the output of `man vim' from a > GNU system. It'll probably be easier to convince Guido to introduce a 'goto' statem

Re: random number between 0 and 20

2005-04-20 Thread TZOTZIOY
On 20 Apr 2005 08:15:02 -0700, rumours say that [EMAIL PROTECTED] might have written: >How can I generate a random number between 0 - 20 and store the number >in nrrandom? Just choose a random number yourself, eg. nrrandom=17 (just kidding :) import random nrrandom = random.randint(0,20) See

logging to two files

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

  1   2   3   >