Re: A class question

2007-10-29 Thread Gabriel Genellina
En Tue, 30 Oct 2007 02:51:39 -0300, Donn Ingle <[EMAIL PROTECTED]> escribió: >> While Java's variable declarations bear a superficial (syntactical) >> similarity to C, their semantics is in fact equivalent to the >> object-reference semantics we know in Python. > > I come from Z80A/GWBASIC/VB an

Re: "and" and "or" on every item in a list

2007-10-29 Thread GHZ
Thanks for the answers, I suspected something like any(), all() existed. Also got me thinking about generator expressions, my code is full of list comprehensions for lists I don't keep. -- http://mail.python.org/mailman/listinfo/python-list

Re: parse text file

2007-10-29 Thread Pradeep Jindal
On Tuesday 30 Oct 2007 12:06:57 pm william paul wrote: > Hi: > > I am new to this list and new to Python. I have a text file that looks > like: 4 50 > 3 900 > ... > > I want to be able to remove from each line everything up to ">" or "]" > sign. For example: 4 50 > 3 900 > 7 400 > > ... > 9 70

dictionary and list

2007-10-29 Thread Beema shafreen
hi everbody, I have a file, a b c d e 2722316 2722360A_16_P03641972150-44 2722510 2722554A_16_P2136023916-44 2722570 2722614A_16_P0364197344-44 2722658

Re: Using msvcrt (in Windows), how to catch Enter key?

2007-10-29 Thread Gabriel Genellina
En Tue, 30 Oct 2007 01:46:19 -0300, Dick Moores <[EMAIL PROTECTED]> escribió: > At 06:34 PM 10/29/2007, Gabriel Genellina wrote: >> The underlying function in Windows is Sleep (or SleepEx) which takes an >> argument in milliseconds. 0.0001s = 0.1ms and it's rounded to 0. > > Ah, useful informatio

parse text file

2007-10-29 Thread william paul
Hi: I am new to this list and new to Python. I have a text file that looks like: 4 50 3 900 " or "]" sign. For example: 4 50 3 900 7 400 ... 9 70 How can I do this? Thank you William __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the be

Re: A class question

2007-10-29 Thread Donn Ingle
> While Java's variable declarations bear a superficial (syntactical) > similarity to C, their semantics is in fact equivalent to the > object-reference semantics we know in Python. I come from Z80A/GWBASIC/VB and a little C, I would describe a Python variable as a pointer - in that it contains t

Re: Solaris 10 + Sun Studio 12 Pyrhon 2.4.4 64-bit build problem

2007-10-29 Thread MrJean1
Correction: the number of tests which pass must be 276. /Jean Brouwers On Oct 29, 10:29 pm, MrJean1 <[EMAIL PROTECTED]> wrote: > Here is a better way to build Python on Solaris, both 32- and 64- > bit. > > > > since it builds

Re: Built-in functions and keyword arguments

2007-10-29 Thread Hendrik van Rooyen
"Jean-Paul Calderone" <[EMAIL PROTECTED]> wrote: > On Mon, 29 Oct 2007 19:03:34 +0200, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: > >Looks like a gotcha to me - its the difference between a keyword > >(master = 42) and an assignment (s='I am a string') > > > > But it's not a keyword: > > >

Re: A Python 3000 Question

2007-10-29 Thread George Sakkis
On Oct 29, 9:35 pm, Michael L Torrie <[EMAIL PROTECTED]> wrote: > brad wrote: > > Not complaining. len is simple and understandable and IMO fits nicely > > with split(), strip(), etc... that's why I used it as an example, but > > list(), etc. could be used as examples as well: > > > a_string.list()

Re: Solaris 10 + Sun Studio 12 Pyrhon 2.4.4 64-bit build problem

2007-10-29 Thread MrJean1
Here is a better way to build Python on Solaris, both 32- and 64- bit. since it builds both the binary and make test on my Ultra 20 machine. In my case 26 tests pass, 1 failed, 44 are skipped and there are 6 u expected skips.

appending into a list

2007-10-29 Thread Beema shafreen
hi everybody, I have a file : A B C D E 2717353 2717412A_16_P03641964214-59 2717626 2717685A_16_P4156365525-59 2717710 2717754A_16_P036419651250-44 2719004

Re: How to find if a string contains another string

2007-10-29 Thread sandipm
you can use "find" function...which gives index of occurrence of smaller one in bigger one and return -1 if does not exists.. if bigstring.find(smallone) > -1: return true else: return false sandip On Oct 30, 9:15 am, "Borse, Ganesh" <[EMAIL PROTECTED]> wrote: > Sorry, am getting t

Re: Using msvcrt (in Windows), how to catch Enter key?

2007-10-29 Thread Dick Moores
At 06:34 PM 10/29/2007, Gabriel Genellina wrote: >En Mon, 29 Oct 2007 21:22:36 -0300, Dick Moores <[EMAIL PROTECTED]> escribió: > > > At 03:23 PM 10/29/2007, Gabriel Genellina wrote: > >> En Mon, 29 Oct 2007 14:39:49 -0300, Dick Moores <[EMAIL PROTECTED]> > >> escribió: > >> > >> > >> At least add

mimicking the ipod UI in python

2007-10-29 Thread dominiquevalentine
anyone have any advice as to where to start if i say..wanted to program the ipods UI? I have one python project under my belt so far, and i'm going for my second. I want to try to mimic the ipod using python -- that is, basically, i want a virtual ipod in a window, using either pygtk or wxglade if

Re: Solaris 10 + Sun Studio 12 Pyrhon 2.4.4 64-bit build problem

2007-10-29 Thread MrJean1
Here is one way to build a 64-bit Python binary on Solaris 10 using SUN's compilers**. This is probably not the recommended procedure but it does create a partial, expected result. Here are the 4 steps I used: 1 - Run ./configure --without-gcc --with-cxx-main=CC --enable-64- bit 2 - Ed

RE: How to find if a string contains another string

2007-10-29 Thread Borse, Ganesh
Sorry, am getting this error. >>> bigstring="python anaconda boa cobra" >>> smallone="boa" >>> smallone in bigstring Traceback (most recent call last): File "", line 1, in ? TypeError: 'in ' requires character as left operand >>> >>> if smallone in bigstring: ...print 'ok' ... else: ...

Re: How to find if a string contains another string

2007-10-29 Thread Gary Herron
Borse, Ganesh wrote: > Hi, > > Am new to python. > May someone please help me know this? > > How can we check whether one big string contains another small string? > > E.g. > bigstring="python anaconda boa cobra" > smallone="boa" > Use the operator named in: >>> bigstring="python anaconda boa

How to find if a string contains another string

2007-10-29 Thread Borse, Ganesh
Hi, Am new to python. May someone please help me know this? How can we check whether one big string contains another small string? E.g. bigstring="python anaconda boa cobra" smallone="boa" If 0 == contains(bigstring,smallone): print "Yes, boa is snake.." Is there any function like "co

python in academics?

2007-10-29 Thread sandipm
seeing posts from students on group. I am curious to know, Do they teach python in academic courses in universities? in undergrad comp science courses, We had scheme language as scheme is neat and beautiful language to learn programming. We learnt other languages ourselve with basics set right by

Re: A Python 3000 Question

2007-10-29 Thread George Sakkis
On Oct 29, 5:49 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > I was just reading > |http://docs.python.org/dev/3.0/whatsnew/3.0.html > > which says nothing about such a change, except for one in the opposite > direction: o.next() changes to next(o) which in turn calls o.__next__(), > just as len

trouble with PAMIE

2007-10-29 Thread daniel
I'm trying to use PAMIE to automate some web browsing. My problem is with the buttonClick() method; it doesn't seem to work when the button is supposed to open a new window. For example, I can use it to submit a username and password and advance to the next page but it fails on a button that opens

trouble with PAMIE

2007-10-29 Thread daniel
I'm trying to use PAMIE to automate some web browsing. My problem is with the buttonClick() method; it seems to work unless the button is supposed to open a new window. Specifically, the button is supposed to open a PDF Preview in a new window. Any ideas? Daniel -- http://mail.python.org/mailman

Re: "and" and "or" on every item in a list

2007-10-29 Thread Dustan
On Oct 29, 5:57 pm, GHZ <[EMAIL PROTECTED]> wrote: > Is this the best way to test every item in a list? No. The biggest problem is, obviously, you don't take advantage of builtins any() and all(), or write corresponding short-circuiting versions for python versions before 2.5. The second problem

trouble with PAMIE

2007-10-29 Thread daniel
I'm using PAMIE to automate some web browsing. My problem is with the buttonClick() method. It seems to work unless the button is supposed to open a new window, in which case nothing happens. There is no error message. Any ideas? Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: two files into an alternate list

2007-10-29 Thread Tim Chase
> i have a file : > file 1: > 1 > 2 > 3 > 4 > 5 > 6 > > file2: > a > b > c > d > e > f > how do i make the two files into list like this = > [1,a,2,b,3,c,4,d,5,e,6,f] from itertools import cycle def serialize(*sources): while True: for source in sources: yield

Re: A Python 3000 Question

2007-10-29 Thread Michael L Torrie
brad wrote: > Not complaining. len is simple and understandable and IMO fits nicely > with split(), strip(), etc... that's why I used it as an example, but > list(), etc. could be used as examples as well: > > a_string.list() instead of list(a_string) This is a great example of why list() needs

Re: [Possible SPAM] Re: Using msvcrt (in Windows), how to catch Enter key?

2007-10-29 Thread Gabriel Genellina
En Mon, 29 Oct 2007 21:22:36 -0300, Dick Moores <[EMAIL PROTECTED]> escribió: > At 03:23 PM 10/29/2007, Gabriel Genellina wrote: >> En Mon, 29 Oct 2007 14:39:49 -0300, Dick Moores <[EMAIL PROTECTED]> >> escribió: >> >> >> At least add a small sleep() call inside the loop, to be nice to other >>

Re: getting serialized data into and out of a database

2007-10-29 Thread Gabriel Genellina
En Mon, 29 Oct 2007 19:07:18 -0300, Michael Pelz Sherman <[EMAIL PROTECTED]> escribió: > I'm having a devil of a time getting serialized data into and out of a > database (MySQL in this case) using python and MySQLdb. > > I have some C code that has its own serialization/deserialization > fu

Re: How python writes text into another windows application

2007-10-29 Thread Gabriel Genellina
En Mon, 29 Oct 2007 18:53:47 -0300, Meitham <[EMAIL PROTECTED]> escribió: > I am trying to write a simple program that reads data from a source file > (Excel sheet, XML file or text file) and then write the data into > another application by pasting the data into the applications fields, > and jum

Re: A Python 3000 Question

2007-10-29 Thread Wildemar Wildenburger
Bjoern Schliessmann wrote: > The inconsistencies arise, IMHO, if an OO language introduces > non-object types for performance reasons, after that gets wrapper > classes to wrap those primitives, and even later gets the ability > to automatically cast a primitive into a wrapper class instance. > Tha

Re: Using msvcrt (in Windows), how to catch Enter key?

2007-10-29 Thread Dick Moores
Reposting, deleting the [Possible SPAM] from the Subject: header. At 03:23 PM 10/29/2007, Gabriel Genellina wrote: >En Mon, 29 Oct 2007 14:39:49 -0300, Dick Moores <[EMAIL PROTECTED]> escribió: > > > But here's a case where it seems I do need the > > > > if msvcrt.kbhit() line > >At least a

Re: [Possible SPAM] Re: Using msvcrt (in Windows), how to catch Enter key?

2007-10-29 Thread Dick Moores
At 03:23 PM 10/29/2007, Gabriel Genellina wrote: >En Mon, 29 Oct 2007 14:39:49 -0300, Dick Moores <[EMAIL PROTECTED]> escribió: > > > But here's a case where it seems I do need the > > > > if msvcrt.kbhit() line > >At least add a small sleep() call inside the loop, to be nice to other >running proc

Re: A Python 3000 Question

2007-10-29 Thread Marc 'BlackJack' Rintsch
On Mon, 29 Oct 2007 17:26:06 -0400, brad wrote: > Rob Wolfe wrote: > >> I wonder why people always complain about `len` function but never >> about `iter` or `pprint.pprint`? :) > > Not complaining. len is simple and understandable and IMO fits nicely > with split(), strip(), etc... that's why

Re: interesting threading result..

2007-10-29 Thread Gabriel Genellina
En Mon, 29 Oct 2007 20:26:40 -0300, Abandoned <[EMAIL PROTECTED]> escribió: > Now this is my real code and the problem continue. > What is the mistake? I don't see where you define "query" so this can't be your complete code. > > import threading > > > class GetData(threading.Thread): >def

Re: statvfs

2007-10-29 Thread Marc 'BlackJack' Rintsch
On Mon, 29 Oct 2007 16:52:12 -0500, Korthrun wrote: > I'm writing some scripts to populate RRD's, mainly for practicing python. > > As such I've decided to play with statvfs in order to build disk > graphs. Here is what I have and what I get. What I'm curious about > here is the meaning of the "L

Re: "and" and "or" on every item in a list

2007-10-29 Thread Tim Chase
> Is this the best way to test every item in a list? > > def alltrue(f,l): > return reduce(bool.__and__,map(f,l)) > > def onetrue(f,l): > return reduce(bool.__or__,map(f,l)) > alltrue(lambda x:x>1,[1,2,3]) > False alltrue(lambda x:x>=1,[1,2,3]) > True As of Python2.5, there's

Re: Automatic Generation of Python Class Files

2007-10-29 Thread Steven Bethard
Fuzzyman wrote: > On Oct 22, 6:43 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: >> # Inherit from object. There's no reason to create old-style classes. > > We recently had to change an object pipeline from new style classes to > old style. A lot of these objects were being created and the *extra

Re: setting variables in outer functions

2007-10-29 Thread Steven Bethard
Hrvoje Niksic wrote: > Tommy Nordgren <[EMAIL PROTECTED]> writes: > >> Given the following: >> def outer(arg) >> avar = '' >> def inner1(arg2) >> # How can I set 'avar' here ? > > I don't think you can, until Python 3: > http://www.python.org/dev/peps/pep-3104/ But it definit

Re: interesting threading result..

2007-10-29 Thread Abandoned
On Oct 29, 11:29 pm, Alan Franzoni <[EMAIL PROTECTED]> wrote: > Il Mon, 29 Oct 2007 09:08:01 -0700, Abandoned ha scritto: > > > I'm sorry my bad english. > > King regards.. > > You must have messed up with something. You didn't post a working snippet > in first place, so you should do it now. I sup

Re: "and" and "or" on every item in a list

2007-10-29 Thread Paul Hankin
On Oct 29, 10:57 pm, GHZ <[EMAIL PROTECTED]> wrote: > Is this the best way to test every item in a list? > > def alltrue(f,l): > return reduce(bool.__and__,map(f,l)) > > def onetrue(f,l): > return reduce(bool.__or__,map(f,l)) No. In Python 2.5 there are builtins 'all' and 'any' that do exa

Re: A Python 3000 Question

2007-10-29 Thread Carl Banks
On Oct 29, 4:25 pm, brad <[EMAIL PROTECTED]> wrote: > One of the criticisms of Python compared to other OO languages is that > it isn't OO enough or as OO as others or that it is inconsistent. Python is less thoroughly OO than some other languages, yes. The underlying assumption, that being thoro

Re: clear shell screen

2007-10-29 Thread Gabriel Genellina
En Mon, 29 Oct 2007 17:31:52 -0300, Shawn Minisall <[EMAIL PROTECTED]> escribió: > Hmm...it works fine within the command line but then when I import os in > python and then try os.system("cls"), i get that very fast > opening/closing window and 0 inside the shell. Try the other method menction

Re: "and" and "or" on every item in a list

2007-10-29 Thread Carl Banks
On Oct 29, 6:57 pm, GHZ <[EMAIL PROTECTED]> wrote: > Is this the best way to test every item in a list? > > def alltrue(f,l): > return reduce(bool.__and__,map(f,l)) > > def onetrue(f,l): > return reduce(bool.__or__,map(f,l)) Probably not, because it doesn't take advantage of short circuiti

Re: "and" and "or" on every item in a list

2007-10-29 Thread Matimus
On Oct 29, 3:57 pm, GHZ <[EMAIL PROTECTED]> wrote: > Is this the best way to test every item in a list? > > def alltrue(f,l): > return reduce(bool.__and__,map(f,l)) > > def onetrue(f,l): > return reduce(bool.__or__,map(f,l)) > > > > >>> alltrue(lambda x:x>1,[1,2,3]) > False > > >>> alltrue(

Re: "and" and "or" on every item in a list

2007-10-29 Thread Raymond Hettinger
On Oct 29, 3:57 pm, GHZ <[EMAIL PROTECTED]> wrote: > Is this the best way to test every item in a list? > > def alltrue(f,l): > return reduce(bool.__and__,map(f,l)) > > def onetrue(f,l): > return reduce(bool.__or__,map(f,l)) > > > > >>> alltrue(lambda x:x>1,[1,2,3]) > False > > >>> alltrue(

"and" and "or" on every item in a list

2007-10-29 Thread GHZ
Is this the best way to test every item in a list? def alltrue(f,l): return reduce(bool.__and__,map(f,l)) def onetrue(f,l): return reduce(bool.__or__,map(f,l)) >>> alltrue(lambda x:x>1,[1,2,3]) False >>> >>> alltrue(lambda x:x>=1,[1,2,3]) True >>> Thanks -- http://mail.python.org/mai

Re: A class question

2007-10-29 Thread Hrvoje Niksic
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: >> It seems to me that in recent times more Python beginners come from >> a Java background than from a C one. > > Java does have "container" variables for primitive types, and even > for "references", Java's variables are more than names - they do >

Re: Using msvcrt (in Windows), how to catch Enter key?

2007-10-29 Thread Ricardo Aráoz
Dick Moores wrote: > Windows XP Pro, Python 2.5.1 > > import msvcrt > while True: > if msvcrt.kbhit(): > key = msvcrt.getch() > if key == 'Enter' >do something > > Is there a way to catch the pressing of the 'Enter' key? > > Thanks, > > Dick Moores > You have ex

Re: sorting data

2007-10-29 Thread Ricardo Aráoz
Beema shafreen wrote: > hi all, >I have problem to sort the data.. the file includes data as > follow. > file: > chrX:123343123123343182A_16_P41787782 > chrX:123343417123343476A_16_P03762840 > chrX:123343460123343519A_16_P41787783 > chrX:12334336

Re: emacs lisp as text processing language...

2007-10-29 Thread Xah Lee
... continued from previous post. PS I'm cross-posting this post to perl and python groups because i find that it being a little know fact that emacs lisp's power in the area of text processing, are far beyond Perl (or Python). ... i worked as a professional perl programer since 1998. I started t

Re: Function to resize global numpy array interactively in ipython

2007-10-29 Thread David Sanders
On Oct 29, 11:07 am, Robert Kern <[EMAIL PROTECTED]> wrote: > David Sanders wrote: > > Hi, > > > I have a script with function definitions which I load into ipython > > for interactive use. > > These functions modify a global numpy array, whose size I need to be > > able to change interactively. I

emacs lisp as text processing language...

2007-10-29 Thread Xah Lee
Text Processing with Emacs Lisp Xah Lee, 2007-10-29 This page gives a outline of how to use emacs lisp to do text processing, using a specific real-world problem as example. If you don't know elisp, first take a gander at Emacs Lisp Basics. HTML version with links and colors is at: http://xahlee

Re: Using msvcrt (in Windows), how to catch Enter key?

2007-10-29 Thread Gabriel Genellina
En Mon, 29 Oct 2007 14:39:49 -0300, Dick Moores <[EMAIL PROTECTED]> escribió: > But here's a case where it seems I do need the > > if msvcrt.kbhit() line At least add a small sleep() call inside the loop, to be nice to other running processes: > = > #!/usr/bin/env pytho

Re: A Python 3000 Question

2007-10-29 Thread Bjoern Schliessmann
brad wrote: > a_string.list() instead of list(a_string) A string can be stripped, "lowercased" or split, but why should it be able to be "listed"? IMHO, list is a conversion function to make a list from something. >> And to answer the question. In OO programming generic functions >> are no less

Re: A Python 3000 Question

2007-10-29 Thread Bjoern Schliessmann
brad wrote: > One of the criticisms of Python compared to other OO languages is > that it isn't OO enough or as OO as others or that it is > inconsistent. If OO meant "everything must be a method" then yes, Python wasn't OO. > And little things such as this seem to support those > arguments. No

getting serialized data into and out of a database

2007-10-29 Thread Michael Pelz Sherman
I'm having a devil of a time getting serialized data into and out of a database (MySQL in this case) using python and MySQLdb. I have some C code that has its own serialization/deserialization functions, which we've wrapped using SWIG. I am able to save the serialized C structs to disk but when

Help ctypes on arm linux not compile

2007-10-29 Thread Samuel M. Smith
I have built python 1.5.1 from source for an embedded ARM9 debian linux Sarge distribution but ctypes doesn't build. Anybody have any idea what the problem is? Do I have to have the libffi package installed. See my errors below. I looked and ffi.h exists in three places /usr/local/src/Python

statvfs

2007-10-29 Thread Korthrun
I'm writing some scripts to populate RRD's, mainly for practicing python. As such I've decided to play with statvfs in order to build disk graphs. Here is what I have and what I get. What I'm curious about here is the meaning of the "L" charcter, as that fubars math. ###start code### from os imp

How python writes text into another windows application

2007-10-29 Thread Meitham
Hi, I am trying to write a simple program that reads data from a source file (Excel sheet, XML file or text file) and then write the data into another application by pasting the data into the applications fields, and jumps from one field to another by writing \t tab. My question is, how do I writ

Re: A Python 3000 Question

2007-10-29 Thread Terry Reedy
"brad" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Will len(a_string) become a_string.len()? No. I was just reading | http://docs.python.org/dev/3.0/whatsnew/3.0.html which says nothing about such a change, except for one in the opposite direction: o.next() changes to next(

Re: setting variables in outer functions

2007-10-29 Thread brad
Tommy Nordgren wrote: >> def outer(avar=False): >> print avar >> if avar == True: >> return >> >> def inner(avar=True): >> print avar >> return avar >> >> outer(inner()) >> >> outer() > This is not a general solution to this problem. Run my exam

Re: interesting threading result..

2007-10-29 Thread Alan Franzoni
Il Mon, 29 Oct 2007 09:08:01 -0700, Abandoned ha scritto: > I'm sorry my bad english. > King regards.. You must have messed up with something. You didn't post a working snippet in first place, so you should do it now. I suppose you're working with some editor or IDE which mantains the very same i

Re: A Python 3000 Question

2007-10-29 Thread brad
Rob Wolfe wrote: > I wonder why people always complain about `len` function but never > about `iter` or `pprint.pprint`? :) Not complaining. len is simple and understandable and IMO fits nicely with split(), strip(), etc... that's why I used it as an example, but list(), etc. could be used as e

Re: setting variables in outer functions

2007-10-29 Thread Hrvoje Niksic
Tommy Nordgren <[EMAIL PROTECTED]> writes: > Given the following: > def outer(arg) > avar = '' > def inner1(arg2) > # How can I set 'avar' here ? I don't think you can, until Python 3: http://www.python.org/dev/peps/pep-3104/ Currently the (ugly) solution is to change variabl

Re: setting variables in outer functions

2007-10-29 Thread Terry Reedy
"Tommy Nordgren" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Given the following: | def outer(arg) | avar = '' | def inner1(arg2) | # How can I set 'avar' here ? You cannot at present. You can only mutate mutable outer vars: def outer(arg): avar = ['']

Re: setting variables in outer functions

2007-10-29 Thread Tommy Nordgren
On 29 okt 2007, at 21.59, brad wrote: > Tommy Nordgren wrote: >> Given the following: >> def outer(arg) >> avar = '' >> def inner1(arg2) >> # How can I set 'avar' here ? > > Try this... works for me... maybe not for you? > > def outer(avar=False): > print avar > if a

Re: A Python 3000 Question

2007-10-29 Thread Rob Wolfe
brad <[EMAIL PROTECTED]> writes: > Will len(a_string) become a_string.len()? I was just reading > > http://docs.python.org/dev/3.0/whatsnew/3.0.html > > One of the criticisms of Python compared to other OO languages is that > it isn't OO enough or as OO as others or that it is inconsistent. And >

Re: sorting data

2007-10-29 Thread Terry Reedy
"Beema shafreen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | hi all, | I have problem to sort the data.. the file includes data as | follow. | file: | chrX:123343123123343182A_16_P41787782 [snip] | how do is sort the file based on the column 1 and 2 with v

Re: Automatic Generation of Python Class Files

2007-10-29 Thread Fuzzyman
On Oct 22, 6:43 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > Sunburned Surveyor wrote: > > Contents of input text file: > > > [Name] > > Fire Breathing Dragon > > > [Properties] > > Strength > > Scariness > > Endurance > > > [Methods] > > eatMaiden argMaiden > > fightKnight argKnight > > > Gener

Re: setting variables in outer functions

2007-10-29 Thread brad
Tommy Nordgren wrote: > Given the following: > def outer(arg) > avar = '' > def inner1(arg2) > # How can I set 'avar' here ? Try this... works for me... maybe not for you? def outer(avar=False): print avar if avar == True: return def inner(avar=True):

Re: Built-in functions and keyword arguments

2007-10-29 Thread J. Clifford Dyer
On Mon, Oct 29, 2007 at 06:45:22PM +, Duncan Booth wrote regarding Re: Built-in functions and keyword arguments: > > "J. Clifford Dyer" <[EMAIL PROTECTED]> wrote: > > >> I think you are being a little bit unfair here: help(len) says: > >> > >> len(...) > >> len(object) -> integer > >>

Re: python logging config file doesn't allow filters?

2007-10-29 Thread Vinay Sajip
On 26 Oct, 17:23, Matthew Wilson <[EMAIL PROTECTED]> wrote: > I'm studying > filters and the config-file approach. Is it possible to define a filter > somehow and then refer to it in my config file? I'm afraid not. There's currently no support for filters in the configuration file format, and no

Re: A class question

2007-10-29 Thread Donn Ingle
> vzcbeg vafcrpg > > qrs _svaq(senzr, bow): > sbe anzr, inyhr va senzr.s_ybpnyf.vgrevgrzf(): > vs inyhr vf bow: > erghea anzr > sbe anzr, inyhr va senzr.s_tybonyf.vgrevgrzf(): > vs inyhr vf bow: > erghea anzr > envfr XrlReebe("Bowrpg abg sbhaq va

Re: A class question

2007-10-29 Thread Donn Ingle
> for humans: Sweet. Thanks, I'll give it a go. It's only for debugging and will make life easier. \d -- http://mail.python.org/mailman/listinfo/python-list

Re: clear shell screen

2007-10-29 Thread Shawn Minisall
Hmm...it works fine within the command line but then when I import os in python and then try os.system("cls"), i get that very fast opening/closing window and 0 inside the shell. Gabriel Genellina wrote: > En Mon, 29 Oct 2007 00:08:14 -0300, Shawn Minisall > <[EMAIL PROTECTED]> escribi�: > >

A Python 3000 Question

2007-10-29 Thread brad
Will len(a_string) become a_string.len()? I was just reading http://docs.python.org/dev/3.0/whatsnew/3.0.html One of the criticisms of Python compared to other OO languages is that it isn't OO enough or as OO as others or that it is inconsistent. And little things such as this seem to support t

setting variables in outer functions

2007-10-29 Thread Tommy Nordgren
Given the following: def outer(arg) avar = '' def inner1(arg2) # How can I set 'avar' here ? - This sig is dedicated to the advancement of Nuclear Power Tommy Nordgren [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python

Re: SQLite3; weird error

2007-10-29 Thread Bruno Desthuilliers
TYR a écrit : > On Oct 29, 11:51 am, Duncan Booth <[EMAIL PROTECTED]> > wrote: > >>TYR <[EMAIL PROTECTED]> wrote: >> >>>To do anything with it, you then need to create a cursor object by >>>calling foo's method cursor (bar = foo.cursor). >> >>Perhaps this would work better if you actually try call

Re: SQLite3; weird error

2007-10-29 Thread Bruno Desthuilliers
TYR a écrit : > Has anyone else experienced a weird SQLite3 problem? > > Going by the documentation at docs.python.org, the syntax is as > follows: > foo = sqlite3.connect(dbname) creates a connection object representing > the state of dbname and assigns it to variable foo. If dbname doesn't > exi

Re: simple question on dictionary usage

2007-10-29 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : (snip) > eval("{" + reduce(lambda x,y: y+', '+x, [mo.group(1) for mo in __import__ > ('re').finditer(r"('E.*?'\s*:\s*'.*?'),?", str(record))], "") + "}") Maman ! Steven, you choose the wrong language. You definitively want Perl ! -- http://mail.python.org/mailman/listin

Re: simple question on dictionary usage

2007-10-29 Thread Bruno Desthuilliers
Martin v. Löwis a écrit : >>>egt = {} >>>for key in record: >>> if key.startswith('E'): >>> egt[key] = record[key] >> >>I actually had come up with something like this, but thought it wasn't >>quite as pythonish as it should be. It is certainly much more readable >>to a neophyte to python.

swig-python -> shared (vs) static libraries

2007-10-29 Thread abarun22
HI I am new to SWIG & Python and right now i am in the process of wrapping some "C" functionalities present in a static library for python. I do have my C file "name.c" which just contains some helper functions. I tried to link my object files (e.g name.o & name_wrap.o) with the static libraries (w

Re: python2.5 and mysqldb

2007-10-29 Thread brad
writeson wrote: ... stuck trying to get mysqldb installed and running on this > machine. I've tried with easy_install and by building from the tar > file and both return a long list of errors from a gcc compile. I'm not > sure what to do next to resolve this issue, so if anyone could give me > som

ANN: Learning Python 3rd Edition

2007-10-29 Thread Mark Lutz
I'm pleased to announce the release of the 3rd Edition of the book Learning Python. This new edition has been updated to cover Python 2.5, and includes numerous pointers for migrating to Python 3.0 in the future. Among other things, this edition has been augmented with material on function decora

Re: Solaris 10 + Sun Studio 12 Pyrhon 2.4.4 64-bit build problem

2007-10-29 Thread MrJean1
Building 64-bit Python is still elusive. I tried various ways to add - xtarget=opteron -xarch-amd64 to the C/C++ flags but that still fails to produce a 64-bit build. Changing the Makefile is not sufficient since that causes compilation errors. It looks like the ./configure command must run wit

Re: Built-in functions and keyword arguments

2007-10-29 Thread Duncan Booth
"J. Clifford Dyer" <[EMAIL PROTECTED]> wrote: >> I think you are being a little bit unfair here: help(len) says: >> >> len(...) >> len(object) -> integer >> >> Return the number of items of a sequence or mapping. >> >> which implies that the argument to len has the name 'object' >>

Re: Built-in functions and keyword arguments

2007-10-29 Thread J. Clifford Dyer
On Mon, Oct 29, 2007 at 02:27:50PM +, Duncan Booth wrote regarding Re: Built-in functions and keyword arguments: > > Bruno Desthuilliers <[EMAIL PROTECTED]> > wrote: > > > In the second case, the name of the argument *is* 'object'. Which is not > > the case for the builtin len (which, fwiw

Re: Using msvcrt (in Windows), how to catch Enter key?

2007-10-29 Thread Dick Moores
At 09:53 AM 10/29/2007, Dick Moores wrote: >At 09:26 AM 10/29/2007, Gabriel Genellina wrote: > >On 29 oct, 09:23, Dick Moores <[EMAIL PROTECTED]> wrote: > > > > > >while True: > > > > if msvcrt.getch() == '\r': > > > > > > I tried it and find that without the msvcrt.kbhit the first key I hit >

Re: coverage.py: "Statement coverage is the weakest measure of code coverage"

2007-10-29 Thread John Roth
On Oct 28, 9:15 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > Kay Schluehr <[EMAIL PROTECTED]> writes: > > I used to write once a coverage tool ( maybe I can factor this out > > of my tool suite some time ) > > That'd be wonderful. I'd like to see comparisons between different > test-coverage tools,

Re: Built-in functions and keyword arguments

2007-10-29 Thread Jean-Paul Calderone
On Mon, 29 Oct 2007 19:03:34 +0200, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: >"Tim Chase" <[EMAIL PROTECTED]> > >> > I think you are being a little bit unfair here: help(len) says: >> > >> > len(...) >> > len(object) -> integer >> > >> > Return the number of items of a sequence or map

Re: Built-in functions and keyword arguments

2007-10-29 Thread Bruno Desthuilliers
Armando Serrano Lombillo a écrit : > On Oct 29, 3:20 pm, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: >> Armando Serrano Lombillo a écrit : >> >>> Why does Python give an error when I try to do this: >> len(object=[1,2]) >>> Traceback (most recent call last): >>> File "", line 1, in >>>

Re: A class question

2007-10-29 Thread Donn Ingle
bump :) -- http://mail.python.org/mailman/listinfo/python-list

Re: two files into an alternate list

2007-10-29 Thread J. Clifford Dyer
That depends: What do you want when you have these two files: file 1: a b c file 2: 1 2 3 4 5 Options: *['a',1,'b',2,'c',3,None,4,None,5] *['a',1,'b',2,'c',3,4,5] *['a',1,'b',2,'c',3] *Throw an exception And what if file 1 has more lines than file 2? Cheers, Cliff 1 On Mon, Oct 29, 2007 at 0

Re: Built-in functions and keyword arguments

2007-10-29 Thread Hendrik van Rooyen
"Tim Chase" <[EMAIL PROTECTED]> > > I think you are being a little bit unfair here: help(len) says: > > > > len(...) > > len(object) -> integer > > > > Return the number of items of a sequence or mapping. > > > > which implies that the argument to len has the name 'object' (although

Re: Function to resize global numpy array interactively in ipython

2007-10-29 Thread Robert Kern
David Sanders wrote: > Hi, > > I have a script with function definitions which I load into ipython > for interactive use. > These functions modify a global numpy array, whose size I need to be > able to change interactively. I thus have a script which looks like > this: > > from numpy import * >

Re: what version python and wxPython comes with Mac OS X Leopard

2007-10-29 Thread Stephen Hansen
Python 2.5.1, and wxPython 2.8.4.0. On 10/29/07, chewie54 <[EMAIL PROTECTED]> wrote: > > Hello, > > Anyone using Leopard know which versions of Python and wxPython and > any other Python related modules are default with the new OS? > > Thanks, > > -- > http://mail.python.org/mailman/listinfo/pytho

Re: Using msvcrt (in Windows), how to catch Enter key?

2007-10-29 Thread Dick Moores
At 09:26 AM 10/29/2007, Gabriel Genellina wrote: >On 29 oct, 09:23, Dick Moores <[EMAIL PROTECTED]> wrote: > > > >while True: > > > if msvcrt.getch() == '\r': > > > > I tried it and find that without the msvcrt.kbhit the first key I hit > > doesn't do anything. I have to hit that key again, or

Re: elementtree w/utf8

2007-10-29 Thread Tim Arnold
"Stefan Behnel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Tim Arnold wrote: >> On a related note, I have another question--where/how can I get the >> cElementTree.py module? Sorry for something so basic, but I tried >> installing >> cElementTree, but while I could compile wit

Re: python2.5 and mysqldb

2007-10-29 Thread Diez B. Roggisch
writeson wrote: > Hi all, > > At work we're using python2.3 and I'd like to start getting us moved > up to python2.5. We run Centos4 which is the free, open source version > of RedHat Enterprise. I've got python2.5 installed on this machine, > but am stuck trying to get mysqldb installed and runn

  1   2   >