Re: Number of distinct substrings of a string [continuation]

2009-11-29 Thread n00m
On Nov 29, 11:43 pm, Bearophile wrote: > Anyway, you may try a pure-Python2.x > implementation:http://suffixtree.googlecode.com/files/suffixtree-0.1.py Ouch, Bearie... 214 lines of code are there. Ok.. I tested it. Firstly I replaced all "print " with "pass##print " (aiming to avoid intensive pr

Re: Object Not Callable, float?

2009-11-29 Thread Ben Finney
"W. eWatson" writes: > I think I understand it, but how does one prevent it from happening, > or know it's the cause? That msg I got? Yes. The line of code was pretty clear: you were attempting to call an object, and the error message said the object's type doesn't support being called. More ge

Re: python logging filters

2009-11-29 Thread Grimsqueaker
On Nov 30, 8:42 am, Grimsqueaker wrote: > On Nov 28, 11:26 am, Vinay Sajip wrote: > > > > > On Nov 27, 1:11 pm, Grimsqueaker wrote: > > > > When I add a Filter to a Handler, everything works as expected (ie. > > > all messages sent from Loggers below the Filter's level are allowed > > > through)

Re: python logging filters

2009-11-29 Thread Grimsqueaker
On Nov 30, 8:42 am, Grimsqueaker wrote: > On Nov 28, 11:26 am, Vinay Sajip wrote: > > > > > On Nov 27, 1:11 pm, Grimsqueaker wrote: > > > > When I add a Filter to a Handler, everything works as expected (ie. > > > all messages sent from Loggers below the Filter's level are allowed > > > through)

Re: python logging filters

2009-11-29 Thread Grimsqueaker
On Nov 28, 11:26 am, Vinay Sajip wrote: > On Nov 27, 1:11 pm, Grimsqueaker wrote: > > > When I add a Filter to a Handler, everything works as expected (ie. > > all messages sent from Loggers below the Filter's level are allowed > > through), but when I add the Filter directly on to the Logger, on

Re: Python py2exe - memory load error

2009-11-29 Thread prakash jp
Try to install "vcredist_x86.exe", then try to build using py2exe. I think that should solve the issue Regards Prakash On Mon, Nov 30, 2009 at 10:40 AM, koranthala wrote: > This is cross post from stackoverflow - I couldnt get the solution > there. Hopefully, nobody would mind. > > I am creatin

Re: Object Not Callable, float?

2009-11-29 Thread Mel
W. eWatson wrote: > I think PL/I, FORTRAN, ALGOL, etc. have reserved words. Algol reserved syntactic tokens that resembled English words, but specified that they should be written in a different way from programmer-defined symbols, so no conflict was possible. Published algorithms might have t

Re: Object Not Callable, float?

2009-11-29 Thread Lie Ryan
On 11/30/2009 4:20 PM, W. eWatson wrote: John Bokma wrote: "W. eWatson" wrote: Yikes. Thanks very much. Python seems to act unlike other language in which words like float are reserved. I'll use asum. The problem is that there is a function sum and you creating a float sum: sum = 0.0 and

Re: Feature request: String-inferred names

2009-11-29 Thread The Music Guy
On Sun, Nov 29, 2009 at 11:01 PM, Brad Harms wrote: > > May the Penguin in the sky bless your every subroutine, > Um...feel free to ignore that. >_> -- Brad Harms -- http://mail.python.org/mailman/listinfo/python-list

Re: Exec Statement Question

2009-11-29 Thread Terry Reedy
Dave Angel wrote: exec is a statement, and statements don't have "return values." It's not a function, In 3.x, it is a function, though the use of print as a statement indicates that the OP was using 2.x. -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: GMPY 1.11rc1 is available

2009-11-29 Thread Terry Reedy
casevh wrote: Everyone, I'm pleased to annouce that a new version of GMPY is available. GMPY is a wrapper for the MPIR or GMP multiple-precision arithmetic library. GMPY 1.11rc1 is available for download from: Is this an update of the gmpy (1.02) registered at http://pypi.python.org/pypi/gmpy/

Re: Object Not Callable, float?

2009-11-29 Thread W. eWatson
John Bokma wrote: "W. eWatson" wrote: Yikes. Thanks very much. Python seems to act unlike other language in which words like float are reserved. I'll use asum. The problem is that there is a function sum and you creating a float sum: sum = 0.0 and mean = sum(hist) even if both could exis

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread inhahe
On Sun, Nov 29, 2009 at 8:04 PM, Esmail wrote: > Chris Rebert wrote: > Wow .. never heard of Concatenative_languages languages before or the > distinction you make. Your distinction explains the behavior, but I > find it somewhat counter-intuitive. (I use the Python interpreter frequently > for sm

Re: Variables with cross-module usage

2009-11-29 Thread Lie Ryan
On 11/30/2009 12:00 PM, Terry Reedy wrote: Dennis Lee Bieber wrote: In these languages, the names always refer to the same location. Python confuses matters by having names that don't really refer to location, but are attached to the objects. In everyday life and natural languages, names refe

Python py2exe - memory load error

2009-11-29 Thread koranthala
This is cross post from stackoverflow - I couldnt get the solution there. Hopefully, nobody would mind. I am creating a medium level application in Python. Everything works well now, and I am trying to make this a windows executable with py2exe. The executable is created fine, but when I try to ru

Re: Feature request: String-inferred names

2009-11-29 Thread Brad Harms
On Sun, Nov 29, 2009 at 9:59 PM, Carl Banks wrote: > Another thing that can be determined through common sense is that if > you have object that you are calling getattr and setattr on so much > that you think you need special syntax, you should have been using a > dict. > (Re-send; original was s

Re: Noobie python shell question

2009-11-29 Thread Dave Angel
Tim Chase wrote: (as an aside, is there a way to get a local/global variable from a string like one can fetch a variable from a class/object with getattr()? Something like getattr(magic_namespace_here, "hello") used in the above context? I know it can be done with eval(), but that's gen

Re: Object Not Callable, float?

2009-11-29 Thread John Bokma
"W. eWatson" wrote: > Yikes. Thanks very much. Python seems to act unlike other language in > which words like float are reserved. I'll use asum. The problem is that there is a function sum and you creating a float sum: sum = 0.0 and mean = sum(hist) even if both could exist side by side it

Re: Object Not Callable, float?

2009-11-29 Thread Carl Banks
On Nov 29, 8:14 pm, "W. eWatson" wrote: > Ben Finney wrote: > > "W. eWatson" writes: > > >> "C:\Sandia_Meteors\Sentinel_Development\Development_Sentuser+Utilities\sentuser\sentuser_20090103+hist.py", > >> line 467, in ShowHistogram > >>     mean = sum(hist) > >> TypeError: 'float' object is not c

Re: Creating a local variable scope.

2009-11-29 Thread Terry Reedy
markolopa wrote: so "domain" should not exist in my namespace since I have no information associated to "domain" only to "self.domains". Python should allow me to write safe code! Leaving iteration names bound after loop exit is a feature. If you do not like it, explicitly unbind it. -- ht

Re: Object Not Callable, float?

2009-11-29 Thread W. eWatson
Ben Finney wrote: "W. eWatson" writes: "C:\Sandia_Meteors\Sentinel_Development\Development_Sentuser+Utilities\sentuser\sentuser_20090103+hist.py", line 467, in ShowHistogram mean = sum(hist) TypeError: 'float' object is not callable It means you're calling an object of type ‘float’. The

Re: Best strategy for overcoming excessive gethostbyname timeout.

2009-11-29 Thread MrJean1
Take a look at function timelimited in this recipe /Jean On Nov 29, 8:08 am, r0g wrote: > r0g wrote: > > r0g wrote: > >> Gabriel Genellina wrote: > >>> En Fri, 27 Nov 2009 22:35:36 -0300, r0g > >>> escribió: > > gethostbyname ignores setdefa

Re: Noobie python shell question

2009-11-29 Thread Chris Rebert
On Sun, Nov 29, 2009 at 7:53 PM, Tim Chase wrote: > (as an aside, is there a way to get a local/global variable from a string > like one can fetch a variable from a class/object with getattr()?  Something > like getattr(magic_namespace_here, "hello") used in the above context?  I > know it can be

Re: Noobie python shell question

2009-11-29 Thread Dave Angel
tuxsun wrote: I've been working in the shell on and off all day, and need to see if a function I defined earlier is defined in the current shell I'm working in. Is there a shell command to get of list of functions I've defined? TIA! P.S. If it makes a difference, I'm using the shell from withi

Re: Feature request: String-inferred names

2009-11-29 Thread Brad Harms
On Sun, Nov 29, 2009 at 7:49 PM, Lie Ryan wrote: > On 11/29/2009 12:22 PM, The Music Guy wrote: > >> When I first started seeing @ show up in Python code, I said "what the >> heck is that? It looks so weird and _ugly_.I would never try to mess >> with that." But I started seeing it more and more,

Re: Feature request: String-inferred names

2009-11-29 Thread Carl Banks
On Nov 28, 3:38 am, The Music Guy wrote: > On Nov 28, 3:07 am, Lie Ryan wrote: > > If you use it a lot, it is likely 1) you have abused class syntax for > > what should have been a dict or 2) what you need is to override > > __getattr__/__getattribute__ and __setattr__ > > Oh boy...here we go. :|

Re: Feature request: String-inferred names

2009-11-29 Thread Carl Banks
On Nov 26, 3:43 pm, The Music Guy wrote: > That aside, I still feel that a new syntax would be a better solution > than a new class. And, anyway, what I'm proposing isn't *quite* the > same as what Ben North proposed. Ben's idea was *strictly* to create > shorthand syntax to the getattr/setattr/de

Re: Noobie python shell question

2009-11-29 Thread Tim Chase
tuxsun wrote: I've been working in the shell on and off all day, and need to see if a function I defined earlier is defined in the current shell I'm working in. Is there a shell command to get of list of functions I've defined? yesish...you can use dir() from the prompt to see the bound names

Re: Creating a local variable scope.

2009-11-29 Thread Dave Angel
markolopa wrote: === arg_columns =] for domain in self.domains: i =elf.get_column_index(column_names, domain.name) col =olumn_elements[i] if len(col) !=en(val_column): ValueError('column %s has not the same size as the value column %s' % (column_names[

Re: Exec Statement Question

2009-11-29 Thread Dave Angel
Victor Subervi wrote: Hi; I have the following line of code: exec('%s()' % table) where 'table' is a variable in a for loop that calls variables from another script. I've made it so that it only calls one variable. I know for a fact that it's calling that variable in the script because it found

ANN: GMPY 1.11rc1 is available

2009-11-29 Thread casevh
Everyone, I'm pleased to annouce that a new version of GMPY is available. GMPY is a wrapper for the MPIR or GMP multiple-precision arithmetic library. GMPY 1.11rc1 is available for download from: http://code.google.com/p/gmpy/ In addition to support for Python 3.x, there are several new features

Noobie python shell question

2009-11-29 Thread tuxsun
I've been working in the shell on and off all day, and need to see if a function I defined earlier is defined in the current shell I'm working in. Is there a shell command to get of list of functions I've defined? TIA! P.S. If it makes a difference, I'm using the shell from within IDLE, but once

Re: Object Not Callable, float?

2009-11-29 Thread Ben Finney
"W. eWatson" writes: > "C:\Sandia_Meteors\Sentinel_Development\Development_Sentuser+Utilities\sentuser\sentuser_20090103+hist.py", > line 467, in ShowHistogram > mean = sum(hist) > TypeError: 'float' object is not callable It means you're calling an object of type ‘float’. The line where it

Object Not Callable, float?

2009-11-29 Thread W. eWatson
Here's an traceback error msg I get. Exception in Tkinter callback Traceback (most recent call last): File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__ return self.func(*args) File "C:\Sandia_Meteors\Sentinel_Development\Development_Sentuser+Utilities\sentuser\sentuser_200

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread Ben Finney
Lie Ryan writes: > I generally do not expect operator precedence to be reliable at all Have another read of the thread. The OP's confusion was not over operator precedence, but over how names resolve to values in expressions. -- \ “Life does not cease to be funny when people die any more

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread Lie Ryan
On 11/30/2009 12:38 PM, Esmail wrote: Thanks all!! I get it now :-) It helped to have a number of different explanations, thanks for taking the time to post. Much appreciated. I generally do not expect operator precedence to be reliable at all except for: + - (binary ops, not the unary) * /

Re: Feature request: String-inferred names

2009-11-29 Thread Lie Ryan
On 11/29/2009 12:22 PM, The Music Guy wrote: When I first started seeing @ show up in Python code, I said "what the heck is that? It looks so weird and _ugly_.I would never try to mess with that." But I started seeing it more and more, so I asked #python what it was. They told me about decorators

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread Esmail
Thanks all!! I get it now :-) It helped to have a number of different explanations, thanks for taking the time to post. Much appreciated. Cheers, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread Mel
Esmail wrote: > Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) > [GCC 4.3.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > > > >>> -3**2 > -9 > > >>> x = -3 > > >>> x**2 > 9 > >>> > > I would have expected the same result in both cases. > > In

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread Alf P. Steinbach
* Esmail: Ok, this is somewhat unexpected: Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> -3**2 -9 >>> x = -3 >>> x**2 9 >>> I would have expected the same result in both cases. Init

Re: python and vc numbers

2009-11-29 Thread Gregory Ewing
Daniel Dalton wrote: what function/module should I use to figure out what tty my program was invoked from? Here's one way: % python Python 2.5 (r25:51908, Apr 8 2007, 22:22:18) [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin Type "help", "copyright", "credits" or "license" for

Re: [Edu-sig] teaching python using turtle module

2009-11-29 Thread kirby urner
On Sun, Nov 29, 2009 at 2:51 PM, Edward Cherlin wrote: << snip >> > Drunkard's Walk. > If our think tank (isepp.org) could have gotten permission, we'd have used that Monopoly guy (looks kinda like Planters peanut guy) randomly walking on like some chess board with a lamp post (reminds of Narni

Re: slightly OT: Python BootCamp

2009-11-29 Thread Terry Reedy
J wrote: Ok... so I've been re-teaching myself python, as it's been several years since I last really used it. And in the midst of this, my contracting company came up to me on Friday and asked if I'd be interested in filling a last minute vacancy in this: http://www.otg-nc.com/python-bootcamp

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread Ben Finney
Esmail writes: > Brian J Mingus wrote: > > > > > > > > I think you answered your own question. 3**2 comes first in the > > order of operations, followed by the negation. > > No, that's not the problem, I'm ok with the operator precedence of - vs ** > > My problem is why I don't get the same resul

Re: Creating a local variable scope.

2009-11-29 Thread Alf P. Steinbach
* markolopa: On 18 Sep, 10:36, "markol...@gmail.com" wrote: On Sep 11, 7:36 pm, Johan Grönqvist wrote: I find several places in my code where I would like tohavea variable scope that is smaller than the enclosing function/class/module definition. This is one of the single major frustrations

Re: Feature request: String-inferred names

2009-11-29 Thread Terry Reedy
The Music Guy wrote: When I first started seeing @ show up in Python code, I said "what the heck is that? For future reference, PySymbols.html at http://code.google.com/p/xploro/downloads/list answers all such symbol questions. -- http://mail.python.org/mailman/listinfo/python-list

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread The Music Guy
It's just like in algebra. You evaluate exponents before the - which, after all, is just another way to write -1, or times-negative-one. However, a variable with a negative value is not the same as a value that is being multiplied by a negative. -3 ** 2 = (-1)(3)^(2) in algebraic terms. Expon

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread Martin v. Löwis
>> I think you answered your own question. 3**2 comes first in the order >> of operations, followed by the negation. > > No, that's not the problem, I'm ok with the operator precedence of - vs ** > > My problem is why I don't get the same result if I use the literal -3 or > a variable that contai

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread Colin W.
On 29-Nov-09 19:50 PM, Chris Rebert wrote: On Sun, Nov 29, 2009 at 4:39 PM, Esmail wrote: Ok, this is somewhat unexpected: Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. -3**2 -9 x = -3

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread Esmail
Chris Rebert wrote: _No_, because using the variable evaluates "-3" as a unit separately by itself, before the exponentiation ever occurs; it's the same as the difference between (-3)**2 and -3**2. Python is not a concatenative programming language[*]; you can't directly textually replace a vari

Re: Variables with cross-module usage

2009-11-29 Thread Terry Reedy
Dennis Lee Bieber wrote: In these languages, the names always refer to the same location. Python confuses matters by having names that don't really refer to location, but are attached to the objects. In everyday life and natural languages, names refer to people, other objects, roles,

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread Esmail
Brian J Mingus wrote: I think you answered your own question. 3**2 comes first in the order of operations, followed by the negation. No, that's not the problem, I'm ok with the operator precedence of - vs ** My problem is why I don't get the same result if I use the literal -3 or a variabl

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread Chris Rebert
On Sun, Nov 29, 2009 at 4:39 PM, Esmail wrote: > Ok, this is somewhat unexpected: > > Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) > [GCC 4.3.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > > -3**2 > -9 > x = -3 > x**2 > 9 > > I

Re: Creating a local variable scope.

2009-11-29 Thread Steve Howell
On Nov 29, 4:26 pm, markolopa wrote: > Less than 3 hours have passed since my last post and got yet another > bug that could be prevented if Python had the functionality that other > languages have to destroy variables when a block ends. Here is the > code: > > = > > arg_columns = [] > for

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread Brian J Mingus
On Sun, Nov 29, 2009 at 5:39 PM, Esmail wrote: > Ok, this is somewhat unexpected: > > Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) > [GCC 4.3.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > > > >>> -3**2 > -9 > > >>> x = -3 > > >>> x**2 > 9 > >>> >

semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread Esmail
Ok, this is somewhat unexpected: Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> -3**2 -9 >>> x = -3 >>> x**2 9 >>> I would have expected the same result in both cases. Initially I would h

Re: Creating a local variable scope.

2009-11-29 Thread markolopa
Hi Lie! On Nov 29, 11:11 pm, Lie Ryan wrote: > here is another bug you might have if python have an "even-more-local" > scope: > > while True: >      s = raw_input("enter something: ") >      if s not in ('q', 'quit', 'exit'): break > print s > > if the while block has become its own namespace; p

Re: [Edu-sig] teaching python using turtle module

2009-11-29 Thread Brian Blais
On Nov 29, 2009, at 17:51 , Edward Cherlin wrote: If you use the Python-programmable tile in Turtle Art in Sugar, or Smalltalk in the Turtle Graphics in Etoys, it's even better. I'll have to check this out. sequences, where I can use a conditional to stop when the turtle would go off the scr

Re: [Edu-sig] teaching python using turtle module

2009-11-29 Thread Edward Cherlin
On Sun, Nov 29, 2009 at 11:34, Brian Blais wrote: > Hello, > I was just playing with the turtle module, and thought it was an interesting > way to augment the introduction to python (I teach college students, who > haven't had any programming).  It's a great way to introduce functions, > for-loops

Re: Creating a local variable scope.

2009-11-29 Thread Lie Ryan
On 11/30/2009 8:12 AM, markolopa wrote: Hi, On 18 Sep, 10:36, "markol...@gmail.com" wrote: On Sep 11, 7:36 pm, Johan Grönqvist wrote: I find several places in my code where I would like tohavea variable scope that is smaller than the enclosing function/class/module definition. This is one

Re: Variables with cross-module usage

2009-11-29 Thread Nitin Changlani.
Thanks Dennis and Steve, This explains it all! I will discard using one.a and use one.myList[0] directly, instead. I really appreciate your patience and the elaboration of the concept. Warm Regards, Nitin Changlani. On Sun, Nov 29, 2009 at 1:02 AM, Steven D'Aprano < st...@remove-this-cybersource

Re: Number of distinct substrings of a string [continuation]

2009-11-29 Thread Bearophile
n00m: > I suspect that building of Suffix Tree would > be a big exec.time-consuming overhead In C/D/C++ there are ways to allocate memory in smarter ways, using pools, arenas, stacks, freelists, etc. With that, using a compact encoding of tree nodes (there are many different tricks to reduce spac

Re: Creating a local variable scope.

2009-11-29 Thread markolopa
Hi, On 18 Sep, 10:36, "markol...@gmail.com" wrote: > On Sep 11, 7:36 pm, Johan Grönqvist wrote: > > I find several places in my code where I would like tohavea variable > > scope that is smaller than the enclosing function/class/module definition. > > This is one of the single major frustrations

Exec Statement Question

2009-11-29 Thread Victor Subervi
Hi; I have the following line of code: exec('%s()' % table) where 'table' is a variable in a for loop that calls variables from another script. I've made it so that it only calls one variable. I know for a fact that it's calling that variable in the script because it found errors in that script.

Re: * for generic unpacking and not just for arguments?

2009-11-29 Thread Tim Chase
The feature is available in Python 3.x: a, b, *c = 1, 2, 3, 4, 5 a, b, c (1, 2, [3, 4, 5]) a, *b, c = 1, 2, 3, 4, 5 a, b, c (1, [2, 3, 4], 5) This is a nice feature of 3.x but I'm disappointed (especially in light of the move to make more things iterators/generators), that the first form

teaching python using turtle module

2009-11-29 Thread Brian Blais
Hello, I was just playing with the turtle module, and thought it was an interesting way to augment the introduction to python (I teach college students, who haven't had any programming). It's a great way to introduce functions, for-loops, and general program structures. After a bit of pl

Re: * for generic unpacking and not just for arguments?

2009-11-29 Thread Lie Ryan
On 11/30/2009 1:25 AM, Russell Warren wrote: Maybe it's just that * is strictly for arguments, and trying it for generic tuple unpacking is abuse (which is down the corridor in 12A). Because (1, 2, *x) == (1, 2, 3, 4) is not tuple unpacking [!] Tuple unpacking is related with assignment, e.

Re: debugger on system with Python 2 and 3

2009-11-29 Thread Nir
rpdb2 should be compatible with Python 3.x. And once you start a debugging session with rpdb2 (running with Python 3.x) you can attach to it from a winpdb instance (running with Python 2.x) On Nov 29, 2:29 pm, Yo Sato wrote: > If there's no other choice I don't mind using winpdb, but it is > ins

Re: delete column content

2009-11-29 Thread Vlastimil Brom
2009/11/29 Francesco Pietra : > Hi: > How to replace with blank the single-character in column 21 of a pdb > file (in pdb numbering it is column 22). Attached is an incomplete > exercise with slices. I am unable to get real plain text with gmail. > > Thanks for help > > francesco pietra > > -- > ht

Re: Installing Python 2.5 with Python 2.6

2009-11-29 Thread pranav
On Nov 29, 11:06 pm, pranav wrote: > Hi, > I used to develop applications on Google AppEngine SDK (which supports > Python 2.5) on my Fedora 10. > I upgraded to Fedora 12 recently and it has Python 2.6. > Unfortunately, some things are breaking up with the SDK. Here is the > tracehttp://dpaste.com

Re: delete column content

2009-11-29 Thread Diez B. Roggisch
Francesco Pietra schrieb: Hi: How to replace with blank the single-character in column 21 of a pdb file (in pdb numbering it is column 22). Attached is an incomplete exercise with slices. I am unable to get real plain text with gmail. Thanks for help Wasn't the help you already got a few days

Re: Filling in a tuple from unknown size list

2009-11-29 Thread Ned Deily
In article , inhahe wrote: > maybe that thing in python 3 that someone mentioned is the answer, but > otherwise i always think Python should admit something like this: > > a, b, c, *d = list > > i.e. if list were [1,2,3,4,5], you'd get a=1, b=2, c=3, d=[4, 5] Extended iterable unpacking (http

delete column content

2009-11-29 Thread Francesco Pietra
Hi: How to replace with blank the single-character in column 21 of a pdb file (in pdb numbering it is column 22). Attached is an incomplete exercise with slices. I am unable to get real plain text with gmail. Thanks for help francesco pietra # Sample line # Slice indexes cut to the left of the co

Installing Python 2.5 with Python 2.6

2009-11-29 Thread pranav
Hi, I used to develop applications on Google AppEngine SDK (which supports Python 2.5) on my Fedora 10. I upgraded to Fedora 12 recently and it has Python 2.6. Unfortunately, some things are breaking up with the SDK. Here is the trace http://dpaste.com/hold/126668/ I had been suggested by the AppE

Re: * for generic unpacking and not just for arguments?

2009-11-29 Thread Russell Warren
On Nov 29, 11:09 am, Christian Heimes wrote: > The feature is available in Python 3.x: > > >>> a, b, *c = 1, 2, 3, 4, 5 > >>> a, b, c > (1, 2, [3, 4, 5]) > >>> a, *b, c = 1, 2, 3, 4, 5 > >>> a, b, c > > (1, [2, 3, 4], 5) Interesting... especially the recognition of how both ends work with the "a,

Re: staticmethod not callable? (trying to make a Singleton metaclass..)

2009-11-29 Thread Gabriel Genellina
En Sun, 29 Nov 2009 10:25:21 -0300, inhahe escribió: I'm trying to come up with a system for singletons, where I don't have to modify anything for an individual class except to define __metaclass__ or, if possible, to inherit another class. I want it to raise an error if making a duplicate

[ANNC] pybotwar-0.7

2009-11-29 Thread Lee Harr
pybotwar is a fun and educational game where players write computer programs to control simulated robots. http://pybotwar.googlecode.com/ pybotwar uses pybox2d for the physical simulation. It can be run in text-only mode -- useful for longer tournaments -- or use pyqt or pygame for a graphical

Auto net surfing

2009-11-29 Thread joao abrantes
How can I make a python program that votes on certain polls ? Atm I am using ClientForm to fill forms but the polls that I found are always of the type = "hidden" and I don't know how to do it. I would also want to do a python program that would vote on a website. For example, if I go to this url

Re: Best strategy for overcoming excessive gethostbyname timeout.

2009-11-29 Thread r0g
r0g wrote: > r0g wrote: >> Gabriel Genellina wrote: >>> En Fri, 27 Nov 2009 22:35:36 -0300, r0g >>> escribió: >>> gethostbyname ignores setdefaulttimeout. How big a job is it to use non-blocking sockets to write a DNS lookup function with a customisable timeout? A few lines? A

Re: Implementation of Book Organization tool (Python2.[x])

2009-11-29 Thread Aahz
In article <4b0a06b...@dnews.tpgi.com.au>, Lie Ryan wrote: > >Python dictionary is stored in memory and closing the program == >deleting the database. You can pickle dictionary; and this might be >sufficient for quick and dirty, low-volume purpose. Pickled dictionary >is the least portable soluti

Re: * for generic unpacking and not just for arguments?

2009-11-29 Thread Christian Heimes
Russell Warren wrote: > but the code below is not? > x = (3, 4) (1, 2, *x) == (1, 2, 3, 4) > Traceback (most recent call last): > File "", line 1, in > invalid syntax: , line 1, pos 8 > > Why does it only work when unpacking arguments for a function? Is it > because the code below i

Re: * for generic unpacking and not just for arguments?

2009-11-29 Thread inhahe
On Sun, Nov 29, 2009 at 10:40 AM, Mel wrote: > Russell Warren wrote: > >> Maybe it's just that * is strictly for arguments, and trying it for >> generic tuple unpacking is abuse (which is down the corridor in 12A). > > I'd agree with that.  It's a feature of function calls, not a feature of > sequ

Re: slightly OT: Python BootCamp

2009-11-29 Thread Aahz
In article , J wrote: >On Sun, Nov 29, 2009 at 03:57, Carl Banks wrote: >> On Nov 28, 6:15=A0pm, J wrote: >>> >>> http://www.otg-nc.com/python-bootcamp >>> >>> It's a week long Python Bootcamp. >> >> >> I'm surprised they're able to fill out 5 days with intensive training >> on Python. > >but o

Re: Number of distinct substrings of a string [continuation]

2009-11-29 Thread n00m
Tested both my codes against a random string of length = 1. === from random import choice s = '' for i in xrange(1): s += choice(('a','b','c','d','e','f')) === C++: ~0.28s Python: ~0.48s PS I suspect th

Re: mysqldb cursor returning type along with result ?

2009-11-29 Thread Lie Ryan
On 11/30/2009 12:14 AM, Paul O'Sullivan wrote: Just taken to Python (2.5)and started to look at some DB cursor stuff using MySQL. Anyway, after creating a query that in MySQL that has a result set of decimals I find that the cursor in python after a fetchall() returns a tuple that contains the f

Re: slightly OT: Python BootCamp

2009-11-29 Thread Steve Howell
On Nov 28, 6:15 pm, J wrote: > Ok... so I've been re-teaching myself python, as it's been several > years since I last really used it.  And in the midst of this, my > contracting company came up to me on Friday and asked if I'd be > interested in filling a last minute vacancy in this: > > http://w

Re: xmlrpc idea for getting around the GIL

2009-11-29 Thread Aahz
In article <4b0b07a1$0$22159$9b622...@news.freenet.de>, =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= wrote: > >In any case, I don't think you'll need a multi-process solution; a >single-process multi-threading approach will do fine. Just create >*another* thread, that runs at a low priority and is

Re: string payload expected: error

2009-11-29 Thread Lie Ryan
On 11/27/2009 8:43 PM, Ramdas wrote: I tried with MIMEBASE but it still fails.. I changed it to MIMEText, hoping that might trick __handletext to think its a string Anyway that also doesn't work. just pass the string directly to MIMEBase.set_payload: fp = open('...') msg1 = MIMEBase(maint

Re: python setup.py build 32-bits on x86_64 machine

2009-11-29 Thread Aahz
In article <4b08d6e9$0$28097$a729d...@news.telepac.pt>, =?UTF-8?B?U8Opcmdpbw==?= Monteiro Basto wrote: > >I am in x86_64 arch , but I need >compile things on 32 bits. >python setup.py build Googling for "linux force 32-bit build" and similar phrases should find some useful results. -- Aahz (a.

Re: * for generic unpacking and not just for arguments?

2009-11-29 Thread Mel
Russell Warren wrote: > Maybe it's just that * is strictly for arguments, and trying it for > generic tuple unpacking is abuse (which is down the corridor in 12A). I'd agree with that. It's a feature of function calls, not a feature of sequence types, so that you can handle a set of function ar

Re: Feature request: String-inferred names

2009-11-29 Thread David Robinow
On Sun, Nov 29, 2009 at 6:58 AM, inhahe wrote: > Did you say you were using gmail to post?  I think mailing lists tend to > have issues with gmail because it puts html in the message or something like > that.  Btw I recently set up this mailing list to send me a message back > when I successfully

Re: Number of distinct substrings of a string [continuation]

2009-11-29 Thread inhahe
On Sun, Nov 29, 2009 at 9:10 AM, n00m wrote: > > Even if Py by 4x *slower* -- it's still a perfect Ok for it (C# will > be > much (much) slower than Python). > > How do you figure? As far as I know C# is many, many times faster than Python. (i was disappointed to find out that even IronPython is

* for generic unpacking and not just for arguments?

2009-11-29 Thread Russell Warren
Is there a reason that this is fine: >>> def f(a,b,c): ... return a+b+c ... >>> f(1, *(2,3)) 6 but the code below is not? >>> x = (3, 4) >>> (1, 2, *x) == (1, 2, 3, 4) Traceback (most recent call last): File "", line 1, in invalid syntax: , line 1, pos 8 Why does it only work when unpackin

Re: Number of distinct substrings of a string [continuation]

2009-11-29 Thread n00m
http://en.wikipedia.org/wiki/Suffix_tree Looks not very friendly appealing :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Number of distinct substrings of a string [continuation]

2009-11-29 Thread n00m
On Nov 29, 3:15 pm, Bearophile wrote: > Maybe in your C++ code there's something that can be improved, this is > a 1:1 translation to D (V.1) language (using dlibs) and it's about 2.2 > times faster than the Psyco version:http://codepad.org/MQLj0ydB > Using a smarter usage of memory (that is avoid

Re: mysqldb cursor returning type along with result ?

2009-11-29 Thread Tim Chase
((Decimal("101.10"),), (Decimal("99.32"),), (Decimal("97.95"),), (Decimal("98.45"),), (Decimal("97.39"),), (Decimal("97.91"),), (Decimal ("98.08"),), (Decimal("97.73"),)) as such : sum(result) fails with "TypeError: unsupported operand type(s) for +: 'int' and 'tuple'" How do I either get the

staticmethod not callable? (trying to make a Singleton metaclass..)

2009-11-29 Thread inhahe
I'm trying to come up with a system for singletons, where I don't have to modify anything for an individual class except to define __metaclass__ or, if possible, to inherit another class. I want it to raise an error if making a duplicate instance of a class is attempted, rather than to return the

Re: Number of distinct substrings of a string [continuation]

2009-11-29 Thread Bearophile
n00m: > my home tests proved Python is a fellow fast beast of C++. > Quite unexpected (I expected Py would be by ~10 times slower). > PS > Both my codes are identical in their algorithms. > = > 0.016         0.0150001049042   <--- exec times Maybe in your C++ code ther

mysqldb cursor returning type along with result ?

2009-11-29 Thread Paul O'Sullivan
Just taken to Python (2.5)and started to look at some DB cursor stuff using MySQL. Anyway, after creating a query that in MySQL that has a result set of decimals I find that the cursor in python after a fetchall() returns a tuple that contains the following :: ((Decimal("101.10"),), (Decimal("99.

Re: Number of distinct substrings of a string [continuation]

2009-11-29 Thread Bearophile
n00m: > My Py solution: > ... Cute. You can replace: a[ord(s[i])] += [i] With: a[ord(s[i])].append(i) If you want to micro-optimize this with Psyco may be a little faster: (lev >> 1) Than: lev // 2 But to increase speed it's usually better to reduce memory allocations. So you can try to find a w

  1   2   >