Re: An ordered dictionary for the Python library?

2007-09-15 Thread Diez B. Roggisch
Mark Summerfield schrieb: > On 14 Sep, 21:23, James Stroud <[EMAIL PROTECTED]> wrote: >> Mark Summerfield wrote: >>> I guess I'll have to rename my module (although unfortunately, my book >>> has just gone into production and I have a (simpler) example of what I >>> considered to be an ordered dict

Re: Just bought Python in a Nutshell

2007-09-15 Thread Tor Erik Sønvisen
Python in a nutshell also comes in a second edition: http://www.oreilly.com/catalog/pythonian2/index.html. Here, many of the new features in Python 2.5 are included. I haven't read through the first the edition, but I can honestly say that reading through the second edition has made me a better pro

Make money to share your videos

2007-09-15 Thread earnclick
Goodtolove.com is sharing their 50% adsense revenue with you to post videos of anything. Just keep up logging in and start posting now to make money... -- http://mail.python.org/mailman/listinfo/python-list

c interfacing in 2.5

2007-09-15 Thread Rustom Mody
I used python extensive 3-5 years back. Coming back I find some changes. Trying to understand whats new and would appreciate any help/comments/pointers. Earlier there were basically two options: SWIG: convenient but inefficient Native (Extending/Embedding): an efficient way of getting a headache

trim start and trailing space chars from string

2007-09-15 Thread Konstantinos Pachopoulos
Hi, is there something corresponding to the java String.trim() method, ie trim start and trailing space/tab chars from string? say convert " asdf " to "asdf"? Thnx -- http://mail.python.org/mailman/listinfo/python-list

Re: trim start and trailing space chars from string

2007-09-15 Thread Tim Williams
On 15/09/2007, Konstantinos Pachopoulos <[EMAIL PROTECTED]> wrote: > Hi, > is there something corresponding to the java String.trim() method, ie > trim start and trailing space/tab chars from string? > say convert " asdf " to "asdf"? >>> ' asdf '.strip() 'asdf' >>> ' asdf '.rstrip() ' asdf' >>>

Re: How to avoid overflow errors

2007-09-15 Thread James Stroud
Steven D'Aprano wrote: > On Fri, 14 Sep 2007 18:19:45 -0700, James Stroud wrote: > >>> How do I subclass int and/or long so that my class also auto-converts >>> only when needed? >>> >> Use __new__. > > The disadvantage of that is that your example code requires me to > duplicate my methods in t

Re: c interfacing in 2.5

2007-09-15 Thread Diez B. Roggisch
Rustom Mody schrieb: > I used python extensive 3-5 years back. Coming back I find some > changes. Trying to understand whats new and would appreciate any > help/comments/pointers. > > Earlier there were basically two options: > SWIG: convenient but inefficient > Native (Extending/Embedding): an

Re: trim start and trailing space chars from string

2007-09-15 Thread John Machin
On Sep 15, 7:24 pm, Konstantinos Pachopoulos <[EMAIL PROTECTED]> wrote: > Hi, > is there something corresponding to the java String.trim() method, ie > trim start and trailing space/tab chars from string? > say convert " asdf " to "asdf"? http://docs.python.org/lib/string-methods.html -- htt

Re: trim start and trailing space chars from string

2007-09-15 Thread Rustom Mody
>>> s=" abcdef " >>> s.strip() 'abcdef' >>> s.rstrip() ' abcdef' >>> s.lstrip() 'abcdef ' >>> On 9/15/07, Konstantinos Pachopoulos <[EMAIL PROTECTED]> wrote: > Hi, > is there something corresponding to the java String.trim() method, ie > trim start and trailing space/tab chars fro

Re: reading xls file from python

2007-09-15 Thread John Machin
On 15/09/2007 1:50 PM, Gabriel Genellina wrote: > En Fri, 14 Sep 2007 18:56:34 -0300, <[EMAIL PROTECTED]> escribi�: > >> I have installed python 2.5 for windows in my pc, I have a file xls >> say "file.xls" in c:/python25. How I can read this files from Python. >> Many thanks in advance. > > Tr

Re: Just bought Python in a Nutshell

2007-09-15 Thread 7stud
Used copies of computer books for out of date editions are always cheap. "Python in a Nutshell (2nd ed)" is a reference book with a frustratingly poor index--go figure. It also contains errors not posted in the errata. -- http://mail.python.org/mailman/listinfo/python-list

Re: regexp search on infinite string?

2007-09-15 Thread John Machin
On Sep 15, 4:36 pm, Paddy <[EMAIL PROTECTED]> wrote: > On Sep 15, 2:57 am, James Stroud <[EMAIL PROTECTED]> wrote: > > > > > Paddy wrote: > > > Lets say i have a generator running that generates successive > > > characters of a 'string' > > >>From what I know, if I want to do a regexp search for a

int('\x23') != 0x23 (a.k.a convert char to integer of its byte representation)

2007-09-15 Thread Boris Dušek
Hi, I am looking for the best way to convert a string of length 1 (= 1 character as string) to integer that has the same value as numeric representation of that character. Background: I am writing functions abstracting endianness, e.g. converting a string of length 4 to the appropriate integer val

Re: Modul (%) in python not like in C?

2007-09-15 Thread Bryan Olson
J. Cliff Dyer wrote: > Bryan Olson wrote: >> Scott David Daniels wrote: >> >>> C, which was designed as a "high level assembly language," does not >>> tightly define the results of / and % for negative numbers. Instead >>> it defines the result for positive over positive, and constrains the >>>

Re: int('\x23') != 0x23 (a.k.a convert char to integer of its byte representation)

2007-09-15 Thread Marc 'BlackJack' Rintsch
On Sat, 15 Sep 2007 11:55:28 +, Boris Dušek wrote: > I am looking for the best way to convert a string of length 1 (= 1 > character as string) to integer that has the same value as numeric > representation of that character. Background: I am writing functions > abstracting endianness, e.g. con

Re: Https conversation - debug?

2007-09-15 Thread Thorsten Kampe
* Johny (Fri, 14 Sep 2007 12:51:22 -0700) > Is there any good sniffer for https protocol? What's the connection to Python? > How can be watched https conversation? ssldump. Note that in order to decrypt the traffic you need to have the server's private key. -- http://mail.python.org/mailman/li

Re: int('\x23') != 0x23 (a.k.a convert char to integer of its byte representation)

2007-09-15 Thread Boris Dušek
On Sep 15, 1:59 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > So you are looking for the `struct` module in the standard library instead > of doing this yourself. :-) > > If you insist on doing it yourself take a look at the built-in `ord()` > function. > Thanks Marc, both things are

how to join array of integers?

2007-09-15 Thread Summercool
i think in Ruby, if you have an array (or list) of integers foo = [1, 2, 3] you can use foo.join(",") to join them into a string "1,2,3" in Python... is the method to use ",".join() ? but then it must take a list of strings... not integers... any fast method? -- http://mail.python.org/mailm

Re: int('\x23') != 0x23 (a.k.a convert char to integer of its byte representation)

2007-09-15 Thread John Machin
On Sep 15, 9:55 pm, Boris Dušek <[EMAIL PROTECTED]> wrote: > Hi, > > I am looking for the best way to convert a string of length 1 (= 1 > character as string) to integer that has the same value as numeric > representation of that character. Background: I am writing functions > abstracting endiannes

Re: how to join array of integers?

2007-09-15 Thread Marc 'BlackJack' Rintsch
On Sat, 15 Sep 2007 12:36:02 +, Summercool wrote: > i think in Ruby, if you have an array (or list) of integers > > foo = [1, 2, 3] > > you can use foo.join(",") to join them into a string "1,2,3" > > in Python... is the method to use ",".join() ? but then it must take > a list of strings

python 2.5 cElementTree entity troubles

2007-09-15 Thread Diez B. Roggisch
Hi, this snippet, adapted from http://svn.effbot.org/public/tags/celementtree-1.0-20050126/selftest.py fails miserably with an unknown entity exception: from xml.etree.cElementTree import * ENTITY_XML = """ &entity; """ parser = XMLTreeBuilder() parser.entity["entity"] = "text" print parser.e

Re: how to join array of integers?

2007-09-15 Thread js
print ''.join([str(i) for i in [1,2,3]]) On 9/15/07, Summercool <[EMAIL PROTECTED]> wrote: > i think in Ruby, if you have an array (or list) of integers > > foo = [1, 2, 3] > > you can use foo.join(",") to join them into a string "1,2,3" > > in Python... is the method to use ",".join() ? but the

Re: how to join array of integers?

2007-09-15 Thread John Machin
On Sep 15, 10:36 pm, Summercool <[EMAIL PROTECTED]> wrote: > i think in Ruby, if you have an array (or list) of integers > > foo = [1, 2, 3] > > you can use foo.join(",") to join them into a string "1,2,3" > > in Python... is the method to use ",".join() ? but then it must take > a list of string

Re: regexp search on infinite string?

2007-09-15 Thread Paddy
On Sep 14, 9:49 pm, Paddy <[EMAIL PROTECTED]> wrote: > Lets say i have a generator running that generates successive > characters of a 'string'>From what I know, if I want to do a regexp search > for a pattern of > > characters then I would have to 'freeze' the generator and pass the > characters

Re: regexp search on infinite string?

2007-09-15 Thread John Machin
On Sep 15, 10:56 pm, Paddy <[EMAIL PROTECTED]> wrote: > On Sep 14, 9:49 pm, Paddy <[EMAIL PROTECTED]> wrote: > > > Lets say i have a generator running that generates successive > > characters of a 'string'>From what I know, if I want to do a regexp search > > for a pattern of > > > characters then

Re: Python+Expect+Win32 = Not Possible?

2007-09-15 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, gamename <[EMAIL PROTECTED]> wrote: >On Sep 13, 1:42 am, [EMAIL PROTECTED] wrote: >> On Sep 12, 9:27 pm, gamename <[EMAIL PROTECTED]> wrote: >> >> > Hi, >> >> > Is it still the case there is no practical Expect-like module for >> > win32? I know that cygwin can supp

Re: Rename multiple files using names in a text file

2007-09-15 Thread rémi
Le Fri, 14 Sep 2007 12:52:52 -0700, James Stroud a écrit: [...] > Other than that your strip() is stripping off some whitespace that is > part of the name, I really can't see the problem either, but did you try > to add in the explicit path? E.g.: actually, the problem was in "while i <= len(li

Re: Coming from Perl - SOLVED

2007-09-15 Thread Amer Neely
I V wrote: > On Thu, 13 Sep 2007 23:49:32 -0400, Amer Neely wrote: >> In trying to track down why this script would not run on my host, it has >> to come to light that Python is installed, however the Apache module is >> not. So, short story is - I was flogging a dead horse. > > Which Apache modul

Re: Coming from Perl

2007-09-15 Thread Amer Neely
Bryan Olson wrote: > Amer Neely wrote: >> This seems to indicate that maybe my host needs to configure Apache to >> run python scripts? But I didn't need to do anything with mine. > > Another possibility: If it works on Windows but not Unix, check > the end-of-line characters. Windows ends each l

How to get headers in urllib2 response

2007-09-15 Thread Johny
Can anyone provide an example how to find out the return code and header from an urllib2 request? For example response = urllib2.urlopen('http://www.google.com').read().strip() provides data but I do not know if the return code was 200 or different. Thanks -- http://mail.python.org/mailman/lis

Re: how to join array of integers?

2007-09-15 Thread Arnau Sanchez
js escribió: >> On 9/15/07, Summercool <[EMAIL PROTECTED]> wrote: >> in Python... is the method to use ",".join() ? but then it must take >> a list of strings... not integers... >> >> any fast method? > print ''.join([str(i) for i in [1,2,3]]) It's better to use generator comprehension inste

DDE error Poke Failed

2007-09-15 Thread xcarma
Hi First of all I am a beginner with python and I am a bit fooling around to check wich possibilities I have. I'm trying to get some data to an internal developped application. Server: DDE Topic: SCSDDeServer Item: SendCustomerData Item data: value, value, value I got the following code import

Re: Can You Program?

2007-09-15 Thread [EMAIL PROTECTED]
On Sep 13, 3:37 am, [EMAIL PROTECTED] wrote: > We are offering $2000 USD for the best website developed withwww.hatspin.com > > Are you up to it?? Hey, thanks for spamming our group. Perhaps you should try again after you learn proper HTML coding. Results from http://validator.w3.org/ : Failed val

Re: Coming from Perl

2007-09-15 Thread Amer Neely
Bryan Olson wrote: > Amer Neely wrote: >> This seems to indicate that maybe my host needs to configure Apache to >> run python scripts? But I didn't need to do anything with mine. > > Another possibility: If it works on Windows but not Unix, check > the end-of-line characters. Windows ends each l

Re: python 2.5 cElementTree entity troubles

2007-09-15 Thread Stefan Behnel
Diez B. Roggisch wrote: > Any suggestions on how to teach the built-in ET-parser entities? As you already do it in your code. http://effbot.org/elementtree/elementtree-xmlparser.htm#tag-ET.XMLParser.entity But I guess your version of cET is just too old. Stefan -- http://mail.python.org/mailma

Re: Can You Program?

2007-09-15 Thread Diez B. Roggisch
> Hey, thanks for spamming our group. Perhaps you should try again after > you learn proper HTML coding. > Results from http://validator.w3.org/ : Failed validation, 26 Errors > > Really, really doubt that you are doing anything but trying to gather > e-mails. My 12 year old has made better sites.

Re: extract text from log file using re

2007-09-15 Thread Fabian Braennstroem
Hi to all, thanks for your help. The approach print '\r\n'.join([x.strip() for x in open('c:/flutest.txt') if 'e-0' in x]) works quite well :-) Greetings! Fabian Fabian Braennstroem schrieb am 09/13/2007 09:09 PM: > Hi, > > I would like to delete a region on a log file which has this >

Re: python 2.5 cElementTree entity troubles

2007-09-15 Thread Diez B. Roggisch
Stefan Behnel schrieb: > Diez B. Roggisch wrote: >> Any suggestions on how to teach the built-in ET-parser entities? > > As you already do it in your code. > > http://effbot.org/elementtree/elementtree-xmlparser.htm#tag-ET.XMLParser.entity > > But I guess your version of cET is just too old. Un

Re: How to get headers in urllib2 response

2007-09-15 Thread js
How about using httplib? http://docs.python.org/lib/httplib-examples.html HTTPResponse has getheaders() method, too. On 9/15/07, Johny <[EMAIL PROTECTED]> wrote: > Can anyone provide an example how to find out the return code and > header from an urllib2 request? > For example > response = url

Re: python 2.5 cElementTree entity troubles

2007-09-15 Thread Stefan Behnel
Stefan Behnel wrote: > Diez B. Roggisch wrote: >> Any suggestions on how to teach the built-in ET-parser entities? > > As you already do it in your code. > > http://effbot.org/elementtree/elementtree-xmlparser.htm#tag-ET.XMLParser.entity Hmmm, I never needed this, but the test doesn't work for m

Re: How to avoid overflow errors

2007-09-15 Thread Eduardo O. Padoan
On 9/15/07, Carl Banks <[EMAIL PROTECTED]> wrote: > On Fri, 14 Sep 2007 22:59:13 -0300, Eduardo O. Padoan wrote: > > > On 14 Sep 2007 18:08:00 -0700, Paul Rubin > > <"http://phr.cx"@nospam.invalid> wrote: > >> "Eduardo O. Padoan" <[EMAIL PROTECTED]> writes: > >> > Not totally unrelated, but in Py3k

Re: Extended slicing and Ellipsis - where are they used?

2007-09-15 Thread Rodney Maxwell
On Sep 13, 5:50 pm, James Stroud <[EMAIL PROTECTED]> wrote: > Rodney Maxwell wrote: > > The following are apparently legal Python syntactically: > >L[1:3, 8:10] > >L[1, ..., 5:-2] > > > But they don't seem to work on lists: > l = [0,1,2,3] > l[0:2,3] > > Traceback (most recent cal

Re: Extended slicing and Ellipsis - where are they used?

2007-09-15 Thread Rodney Maxwell
On Sep 13, 5:50 pm, James Stroud <[EMAIL PROTECTED]> wrote: > Rodney Maxwell wrote: > > The following are apparently legal Python syntactically: > >L[1:3, 8:10] > >L[1, ..., 5:-2] > > > But they don't seem to work on lists: > l = [0,1,2,3] > l[0:2,3] > > Traceback (most recent cal

Re: regexp search on infinite string?

2007-09-15 Thread Paddy
On Sep 15, 2:07 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Sep 15, 10:56 pm, Paddy <[EMAIL PROTECTED]> wrote: > > > > > On Sep 14, 9:49 pm, Paddy <[EMAIL PROTECTED]> wrote: > > > > Lets say i have a generator running that generates successive > > > characters of a 'string'>From what I know, if

Re: Python 3K or Python 2.9?

2007-09-15 Thread Erik Jones
On Sep 14, 2007, at 11:54 PM, David Trudgett wrote: > TheFlyingDutchman <[EMAIL PROTECTED]> writes: > >> The confusing way about the current Python method when you first >> encounter it is >> why is "self" being passed in when you write the function but not >> when you call it. If the compiler is

Re: how to join array of integers?

2007-09-15 Thread Grant Edwards
On 2007-09-15, Arnau Sanchez <[EMAIL PROTECTED]> wrote: >>> in Python... is the method to use ",".join() ? but then it >>> must take a list of strings... not integers... >>> >>> any fast method? > > > print ''.join([str(i) for i in [1,2,3]]) > > It's better to use generator comprehension instead

RFC-3986 or 2396 implementation in Python?

2007-09-15 Thread js
Hi list. Is there any module that is compatible with RFC-3986 or 2396, which is like Perl's URI module(http://search.cpan.org/~gaas/URI-1.35/URI.pm)? I like to normalize lots of URIs I've got in my database to make them all unique ones. Thank you in advance. -- http://mail.python.org/mailman/l

Re: how to join array of integers?

2007-09-15 Thread Erik Jones
On Sep 15, 2007, at 8:56 AM, Arnau Sanchez wrote: > js escribió: > >>> On 9/15/07, Summercool <[EMAIL PROTECTED]> wrote: > >>> in Python... is the method to use ",".join() ? but then it must >>> take >>> a list of strings... not integers... >>> >>> any fast method? > >> print ''.join([str(i)

Re: how to join array of integers?

2007-09-15 Thread Erik Jones
On Sep 15, 2007, at 11:07 AM, Grant Edwards wrote: > On 2007-09-15, Arnau Sanchez <[EMAIL PROTECTED]> wrote: > in Python... is the method to use ",".join() ? but then it must take a list of strings... not integers... any fast method? >> >>> print ''.join([str(i) for i in [1,2,

Re: how to join array of integers?

2007-09-15 Thread Grant Edwards
On 2007-09-15, Erik Jones <[EMAIL PROTECTED]> wrote: >>> print ''.join([str(i) for i in [1,2,3]]) >> >> It's better to use generator comprehension instead of LC: >> >> ",".join(str(i) for i in [1, 2, 3]) > > Why is that? That entire expression must be evaluated to obtain the > result, so what i

Need a guitar?

2007-09-15 Thread nutsbreaker1
Free guitars here!! http://freeguitars.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

find and remove "\" character from string

2007-09-15 Thread Konstantinos Pachopoulos
Hi, i have the following string s and the following code, which doesn't successfully remove the "\", but sucessfully removes the "\\". >>> s="Sad\\asd\asd" >>> newS="" >>> for i in s: ... if i!="\\": ... newS=newS+i ... >>> newS 'Sadasd\x07sd' I have also read the following,

Re: find and remove "\" character from string

2007-09-15 Thread Stefan Behnel
Konstantinos Pachopoulos wrote: > i have the following string s and the following code, which doesn't > successfully remove the "\", but sucessfully removes the "\\". > s="Sad\\asd\asd" newS="" for i in s: > ... if i!="\\": > ... newS=newS+i I'm not quite sure what

Re: how to join array of integers?

2007-09-15 Thread Eduardo O. Padoan
> > It's nice people have invented so many ways to spell the > > builting "map" ;) > > > ",".join(map(str,[1,2,3])) > > '1,2,3' > > IIRC, map's status as a builtin is going away. Actually, py3k built-in map == itertools.imap >>> map(str, []) -- http://www.advogato.org/person/eopadoan/ Boo

Re: c interfacing in 2.5

2007-09-15 Thread Szabolcs Nagy
Diez B. Roggisch wrote: > ctypes is for C. Where it is great to use. if you need simple wrappers then swig and ctypes are both good since they can generate it for you pyrex is also good for wrapping and for writing c extension code > If you need C++-wrapping, I recommend SIP. i recommend py++

Re: how to join array of integers?

2007-09-15 Thread tokland
Grant Edwards ha escrito: > > Or, if you happen to like the itertools modules: > > > > from itertools import imap > > ",".join(imap(str, [1, 2, 3])) > > It's nice people have invented so many ways to spell the > builting "map" ;) Did you wonder why the Python developers bother to implement "imap"

World's most popular traveling destinations

2007-09-15 Thread nutsbreaker4
http://world-traveling-destinations.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: how to join array of integers?

2007-09-15 Thread Robert Kern
Grant Edwards wrote: > On 2007-09-15, Erik Jones <[EMAIL PROTECTED]> wrote: > print ''.join([str(i) for i in [1,2,3]]) >>> It's better to use generator comprehension instead of LC: >>> >>> ",".join(str(i) for i in [1, 2, 3]) >> Why is that? That entire expression must be evaluated to obtain

Latest software here!!!!!

2007-09-15 Thread freesoftwareweb1
http://freesoftwareupgrades.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Python statements not forcing whitespace is messy?

2007-09-15 Thread buffi
Am I the only one that thinks that python statements should force whitespace before and after them? Right now this is not enforced and for an example these statements are valid print"hello" "foo"if"bar"else"foobar" for(x,y)in[(1,2),(3,4)]:print(x,y) [(y)for(x,y)in[("foo",2),("bar",4)]if"foo"in(x)

Re: find and remove "\" character from string

2007-09-15 Thread Steve Holden
Konstantinos Pachopoulos wrote: > Hi, > i have the following string s and the following code, which doesn't > successfully remove the "\", but sucessfully removes the "\\". > > >>> s="Sad\\asd\asd" > >>> newS="" > >>> for i in s: > ... if i!="\\": > ... newS=newS+i > ... > >>>

Re: (wxPython) wx.ProgressDialog - how to cancel out of?

2007-09-15 Thread kyosohma
On Sep 15, 12:57 am, Terry Carroll <[EMAIL PROTECTED]> wrote: > I'm trying to use wx.ProgressBar, and the cancel button is not > responding. > > Here is a simple program that exhibits the problem: > > # > import wx > import time > > max = 10

Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread James Stroud
buffi wrote: > Am I the only one that thinks that python statements should force > whitespace before and after them? > > Right now this is not enforced and for an example these statements are > valid > > print"hello" > "foo"if"bar"else"foobar" > for(x,y)in[(1,2),(3,4)]:print(x,y) > [(y)for(x,y)in

calling locale.setlocale repeatedly

2007-09-15 Thread Michael Goerz
Hi, From http://www.pyzine.com/Issue008/Section_Articles/article_Encodings.html#guessing-the-encoding: > The way to access the information about the "normal" encoding used on the > current computer is through the locale module. Before using locale to > retrieve the information you want, you need

Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread J. Cliff Dyer
buffi wrote: > Am I the only one that thinks that python statements should force > whitespace before and after them? > > Right now this is not enforced and for an example these statements are > valid > > print"hello" > "foo"if"bar"else"foobar" > for(x,y)in[(1,2),(3,4)]:print(x,y) > [(y)for(x,y)in[(

Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread Eduardo O. Padoan
On 9/15/07, J. Cliff Dyer <[EMAIL PROTECTED]> wrote: > And I'd hate to have to remember all of the rules for what can go > together and what can't, especially when it comes time to debug. No. > I don't think it should be forced, but maybe put it in PEP8 or PEP3008. It is: see "Whitespace in Expre

Re: find and remove "\" character from string

2007-09-15 Thread I V
On Sat, 15 Sep 2007 19:34:45 +0300, Konstantinos Pachopoulos wrote: > Hi, > i have the following string s and the following code, which doesn't > successfully remove the "\", but sucessfully removes the "\\". There is no \\ in the string; there's one \ , which gets succesfully removed. > >>> s=

Re: Just bought Python in a Nutshell

2007-09-15 Thread Lamonte Harris
Wow I just got it, and its nice doesn't even look used god damn. :D. On 9/14/07, Lamonte Harris <[EMAIL PROTECTED]> wrote: > > Lol, you bought it, dude theres not one left imho. When I bought it, it > still said 1 More left Lol...mines should be her no less then a hour -.-... > Taking SO LONG. >

Re: Just bought Python in a Nutshell

2007-09-15 Thread Danyelle Gragsone
awesome! I should see it in about 2 wks.. im poor. So I choose super snail mail. LN -- http://mail.python.org/mailman/listinfo/python-list

how could change backcolor of console?

2007-09-15 Thread wanpor
Hi,everyone: I am a c programmer,and want using Python instead of C I can change backcolor using C,like this:  textbackground(color); How can I do in Python? Best regards 点 击 此 处!免 费 试 玩 07 年 最 受 期 待 的 游 戏 大 作 ! -- http://mail.python.org/mailman/listinfo/python-list

problems using pythom tempfile module

2007-09-15 Thread [EMAIL PROTECTED]
Hello everyone, I'm trying to test the tempfile module with the following script, which basically creates a temporary file, fills the file with some test data and prints it. import tempfile t = tempfile.TemporaryFile() t.write("lalalala") t.flush() print t.read() Unfortunately, the print statem

Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread buffi
On Sep 15, 10:11 pm, "J. Cliff Dyer" <[EMAIL PROTECTED]> wrote: > buffi wrote: > > Am I the only one that thinks that python statements should force > > whitespace before and after them? > > > Right now this is not enforced and for an example these statements are > > valid > > > print"hello" > > "f

Re: how could change backcolor of console?

2007-09-15 Thread buffi
On Sep 15, 3:55 pm, [EMAIL PROTECTED] wrote: > Hi,everyone: I am a c programmer,and want using Python instead of C > I can change backcolor using C,like this: > > textbackground(color); > > How can I do in Python? > > Best regards > > 点 击 此 处!免 费 试 玩 07 年 最 受 期 待 的 游 戏 大 作 ! textbackgrou

Re: problems using pythom tempfile module

2007-09-15 Thread buffi
On Sep 15, 11:11 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello everyone, > > I'm trying to test the tempfile module with the following script, > which basically creates a temporary file, fills the file with some > test data and prints it. > > import tempfile > > t = tempfile.TemporaryF

curses: x, y positioning

2007-09-15 Thread 7stud
I can't see to get any y, x coordinates to work with curses. Here is an example: import curses def my_program(screen): while True: ch = screen.getch() if ch == ord("q"): break if ch <= 255: screen.addstr(30, 10, "*%s*" % chr(ch)) sc

Patent application

2007-09-15 Thread canadaimmigrationlaw
US patent application services: http://www.pinskylaw.ca/Practice/OntarioTorontoLawyers/business_patents.htm -- http://mail.python.org/mailman/listinfo/python-list

Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread Steve Holden
buffi wrote: > On Sep 15, 10:11 pm, "J. Cliff Dyer" <[EMAIL PROTECTED]> wrote: >> buffi wrote: >>> Am I the only one that thinks that python statements should force >>> whitespace before and after them? >>> Right now this is not enforced and for an example these statements are >>> valid >>> print"h

Needless copying in iterations?

2007-09-15 Thread James Stroud
Hello all, I was staring at a segment of code that looked like this today: for something in stuff[x:y]: whatever(something) and was wondering if the compiler really made a copy of the slice from stuff as the code seems to suggest, or does it find some way to produce an iterator witho

Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread buffi
On Sep 15, 11:49 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > buffi wrote: > > On Sep 15, 10:11 pm, "J. Cliff Dyer" <[EMAIL PROTECTED]> wrote: > >> buffi wrote: > >>> Am I the only one that thinks that python statements should force > >>> whitespace before and after them? > >>> Right now this is n

Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread James Stroud
Steve Holden wrote: > I don't know why you have a bug up your ass about it, as the > Americans say. I think most Americans say "wild hare up your ass". We do not, in fact, say "wild hair up your ass". Many of us can testify that a hair up one's ass would be nothing terribly unusual and would go

Re: Needless copying in iterations?

2007-09-15 Thread buffi
On Sep 15, 11:58 pm, James Stroud <[EMAIL PROTECTED]> wrote: > Hello all, > > I was staring at a segment of code that looked like this today: > > for something in stuff[x:y]: > whatever(something) > > and was wondering if the compiler really made a copy of the slice from > stuff as the co

Re: problems using pythom tempfile module

2007-09-15 Thread [EMAIL PROTECTED]
On Sep 15, 5:24 pm, buffi <[EMAIL PROTECTED]> wrote: > On Sep 15, 11:11 pm, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > Hello everyone, > > > I'm trying to test the tempfile module with the following script, > > which basically creates a temporary file, fills the file with some > > t

Re: Needless copying in iterations?

2007-09-15 Thread James Stroud
buffi wrote: > On Sep 15, 11:58 pm, James Stroud <[EMAIL PROTECTED]> wrote: >> Hello all, >> >> I was staring at a segment of code that looked like this today: >> >> for something in stuff[x:y]: >> whatever(something) >> >> and was wondering if the compiler really made a copy of the slice

Re: Needless copying in iterations?

2007-09-15 Thread buffi
On Sep 16, 12:20 am, James Stroud <[EMAIL PROTECTED]> wrote: > buffi wrote: > > On Sep 15, 11:58 pm, James Stroud <[EMAIL PROTECTED]> wrote: > >> Hello all, > > >> I was staring at a segment of code that looked like this today: > > >> for something in stuff[x:y]: > >> whatever(something)

Re: Needless copying in iterations?

2007-09-15 Thread Calvin Spealman
This is a case where its up to the type involved. For example, xrange() slices the way you want but range() does not. Maybe a type would return for slices a proxy object that got the value by index or maybe it knows that it makes more sense to give you a copy because changes during the iteration sh

Re: (wxPython) wx.ProgressDialog - how to cancel out of?

2007-09-15 Thread 7stud
On Sep 14, 11:57 pm, Terry Carroll <[EMAIL PROTECTED]> wrote: > I'm trying to use wx.ProgressBar, and the cancel button is not > responding. > > Here is a simple program that exhibits the problem: > > # > import wx > import time > > max = 10

Re: Needless copying in iterations?

2007-09-15 Thread buffi
On Sep 16, 12:25 am, "Calvin Spealman" <[EMAIL PROTECTED]> wrote: > This is a case where its up to the type involved. For example, > xrange() slices the way you want but range() does not. Coul you explain this? As far as I know you can't slice a xrange - Björn Kempén -- http://mail.python.org/m

Re: how to join array of integers?

2007-09-15 Thread Grant Edwards
On 2007-09-15, Robert Kern <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> On 2007-09-15, Erik Jones <[EMAIL PROTECTED]> wrote: >> > print ''.join([str(i) for i in [1,2,3]]) It's better to use generator comprehension instead of LC: ",".join(str(i) for i in [1, 2, 3]) >>> Wh

Re: problems using pythom tempfile module

2007-09-15 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Sep 15, 5:24 pm, buffi <[EMAIL PROTECTED]> wrote: >> On Sep 15, 11:11 pm, "[EMAIL PROTECTED]" >> >> >> >> <[EMAIL PROTECTED]> wrote: >>> Hello everyone, >>> I'm trying to test the tempfile module with the following script, >>> which basically creates a temporary file,

Re: problems using pythom tempfile module

2007-09-15 Thread buffi
Pretend that you have a number that is always pointing somewhere in your temporary file. It starts a 0. If you then write "lalalala" (8 characters) it will point after these at position 8, so that you can write more stuff after your previous text later by calling write. The read method reads all t

Re: (wxPython) wx.ProgressDialog - how to cancel out of?

2007-09-15 Thread 7stud
Terry Carroll wrote: > I'm trying to use wx.ProgressBar, and the cancel button is not > responding. > > Here is a simple program that exhibits the problem: > > # > import wx > import time > > max = 10 > app = wx.PySimpleApp() > dlg = wx.Prog

Re: (wxPython) wx.ProgressDialog - how to cancel out of?

2007-09-15 Thread 7stud
On Sep 14, 11:57 pm, Terry Carroll <[EMAIL PROTECTED]> wrote: > I'm trying to use wx.ProgressBar, and the cancel button is not > responding. > > Here is a simple program that exhibits the problem: > > # > import wx > import time > > max = 10

Re: Python statements not forcing whitespace is messy?

2007-09-15 Thread John Machin
On 16/09/2007 8:11 AM, James Stroud wrote: > Steve Holden wrote: >> I don't know why you have a bug up your ass about it, as the >> Americans say. > > I think most Americans say "wild hare up your ass". The essence of Steve's point appears to be that the OP has ridden into town to preach a misgu

Re: (wxPython) wx.ProgressDialog - how to cancel out of?

2007-09-15 Thread 7stud
Terry Carroll wrote: > > 2) The variable "skip: set to False on the first iteration, and then > set to True on subsequent iterations? Note that this happens even if > no buttons are selected. This is just a weirdness to me, and not my > main concern, but I thought I'd mention it in case it's rele

string questions

2007-09-15 Thread Shawn Minisall
Hi everyone, I'm a beginning programming student in Python and have a few questions regarding strings. If s1 = "spam" If s2 = "ni!" 1. Would string.ljust(string.upper(s2),4) * 3 start it at the left margin and move it 12 spaces to the right because of the 4 *3? If so, why is it in the parath

Re: how to join array of integers?

2007-09-15 Thread Steven D'Aprano
On Sat, 15 Sep 2007 15:56:40 +0200, Arnau Sanchez wrote: > js escribió: > >>> On 9/15/07, Summercool <[EMAIL PROTECTED]> wrote: > >>> in Python... is the method to use ",".join() ? but then it must take >>> a list of strings... not integers... >>> >>> any fast method? > > > print ''.join([st

Re: string questions

2007-09-15 Thread Marc 'BlackJack' Rintsch
On Sat, 15 Sep 2007 19:52:47 -0400, Shawn Minisall wrote: > Hi everyone, I'm a beginning programming student in Python and have a > few questions regarding strings. > > If s1 = "spam" > > If s2 = "ni!" > > 1. Would string.ljust(string.upper(s2),4) * 3 start it at the left > margin and move it

Re: Needless copying in iterations?

2007-09-15 Thread Marc 'BlackJack' Rintsch
On Sat, 15 Sep 2007 14:58:15 -0700, James Stroud wrote: > I was staring at a segment of code that looked like this today: > > for something in stuff[x:y]: > whatever(something) > > and was wondering if the compiler really made a copy of the slice from > stuff as the code seems to sugg

Re: Can You Program?

2007-09-15 Thread Steven D'Aprano
On Sat, 15 Sep 2007 14:15:20 +, brus stoc at gmail dot com wrote: [snip spam] > Hey, thanks for spamming our group. You know, there are probably millions of people who never received the original spam because their Usenet provider does a good job of filtering out crud, and they wouldn't e

  1   2   >