Re: why did you choose the programming language(s)you currently use?

2009-07-14 Thread Aahz
In article <[email protected]>, Stefan Behnel wrote: >Deep_Feelings wrote: >> >> So you have chosen programming language "x" so shall you tell us why >> you did so , and what negatives or positives it has ? > >*duck* Where do you get the duck programming lang

ANN: RuPy '09 Conference

2009-07-14 Thread Jakub P. Nowak
RuPy 2009 :: Strongly Dynamic Conference Poznan, Poland November 7-8, 2009 :: Call for speakers RuPy is a conference about dynamically typed programming languages. Held for the first time in April 2007 it gathered enthusiasts from Poland and other countries. The idea behind the conference is to

Calling functions: Why this complicated ?

2009-07-14 Thread Mohan Parthasarathy
Hi, I am a newbie. I am reading http://www.network-theory.co.uk/docs/pytut/KeywordArguments.html Defining a function with "N" arguments and calling them in "M" different ways. Why does it have to be this complicated ? I like the idea of calling the function by explicitly naming the arguments, but

Re: Best Way to Handle All Exceptions

2009-07-14 Thread Piet van Oostrum
> Carl Banks (CB) wrote: >CB> On Jul 14, 4:48 am, Lawrence D'Oliveiro central.gen.new_zealand> wrote: >>> In message <93f6a517-63d8-4c80- >>> >>> [email protected]>, Carl Banks wrote: >>> > Or would you rather let all unexpected exceptions print to standard >>> >

Re: missing 'xor' Boolean operator

2009-07-14 Thread Robert Kern
On 2009-07-14 14:56, Dr. Phillip M. Feldman wrote: != does do what I want, except that it doesn't indicate to someone reading the code that the operands are being treated as logicals. (Readability is supposed to be one of the major selling points of Python). But, this is probably good enough.

Re: How to keep a function as a generator function when the yield operator is moved into its sub-functions??

2009-07-14 Thread Diez B. Roggisch
weafon schrieb: Hi guys, I have a question about the usage of yield. As shown in the below example, in general, if there is a code segment commonly used by two or more functions, we may isolate the segment into a function and then call it from other functions if necessary. def func1(): .

Re: The meaning of "="

2009-07-14 Thread Piet van Oostrum
> [email protected] (Aahz) (A) wrote: >A> In article , Piet van Oostrum >A> wrote: >>> And to get c.x = 4 working you also need a __setitem__. >A> Nope. You do need __setitem__ so that this works: >A> c['x'] = 4 Sorry, I meant such that c.x = 4 does the same as c['x'] = 4 because th

Re: Why not enforce four space indentations in version 3.x?

2009-07-14 Thread David Bolen
John Nagle writes: >Python 3 enforces the rule that you can't mix tabs and spaces > for indentation in the same file. That (finally) guarantees that > the indentation you see is what the Python parser sees. That's > enough to prevent non-visible indentation errors. Are you sure? It seems

Re: missing 'xor' Boolean operator

2009-07-14 Thread Ethan Furman
Robert Kern wrote: On 2009-07-14 14:56, Dr. Phillip M. Feldman wrote: != does do what I want, except that it doesn't indicate to someone reading the code that the operands are being treated as logicals. (Readability is supposed to be one of the major selling points of Python). But, this is

Re: How to check if any item from a list of strings is in a big string?

2009-07-14 Thread Nobody
On Tue, 14 Jul 2009 02:06:04 -0300, Gabriel Genellina wrote: >> Matt, how many words are you looking for, in how long a string ? >> Were you able to time any( substr in long_string ) against re.compile >> ( "|".join( list_items )) ? > > There is a known algorithm to solve specifically this proble

decorators - would be nice if...

2009-07-14 Thread Ken Seehart
Almost every time I use decorators, I find myself wishing I had access to the local namespace of the context from which the decorator is executed. In practice, decorator is being applied to a method, so the namespace in question would be the dictionary of the class being created. Similarly, befo

Re: bad behaviour in interactive Python prompt

2009-07-14 Thread ~km
On 14 Jul., 15:26, Mark Dickinson wrote: > Where did your version of Python 2.6 come from? > > If you built your copy of Python 2.6 from source, then the problem is > probably that either the readline library is missing, or (much more > likely) the include files for the readline library are missin

Re: bad behaviour in interactive Python prompt

2009-07-14 Thread ~km
On 14 Jul., 15:26, Mark Dickinson wrote: > Where did your version of Python 2.6 come from? > > If you built your copy of Python 2.6 from source, then the problem is > probably that either the readline library is missing, or (much more > likely) the include files for the readline library are missin

Re: missing 'xor' Boolean operator

2009-07-14 Thread MRAB
Ethan Furman wrote: Robert Kern wrote: On 2009-07-14 14:56, Dr. Phillip M. Feldman wrote: != does do what I want, except that it doesn't indicate to someone reading the code that the operands are being treated as logicals. (Readability is supposed to be one of the major selling points of Py

Re: why did you choose the programming language(s)you currently use?

2009-07-14 Thread Nobody
On Tue, 14 Jul 2009 11:47:08 -0700, Paul Rubin wrote: >> - unlimited precision integers >> - easy to program >> - IDE not required >> - reasonable speed >> - math library needs to include number theoretic functions >> like GCD, LCM, Modular Inverse, etc. >> - not fucking retarded like F# > > Ha

Re: decorators - would be nice if...

2009-07-14 Thread Diez B. Roggisch
Ken Seehart schrieb: Almost every time I use decorators, I find myself wishing I had access to the local namespace of the context from which the decorator is executed. In practice, decorator is being applied to a method, so the namespace in question would be the dictionary of the class being cre

Re: missing 'xor' Boolean operator

2009-07-14 Thread Ethan Furman
MRAB wrote: Ethan Furman wrote: Robert Kern wrote: On 2009-07-14 14:56, Dr. Phillip M. Feldman wrote: != does do what I want, except that it doesn't indicate to someone reading the code that the operands are being treated as logicals. (Readability is supposed to be one of the major sellin

Re: decorators - would be nice if...

2009-07-14 Thread Carl Banks
On Jul 14, 2:44 pm, Ken Seehart wrote: [snip] (e.g. there does not > seem to be a good way to use multiple metaclasses in a class hierarchy, > and more generally you can't stack them on top of each other (you can > only have one metaclass per class)). > > Thoughts? If "stacking" metaclasses (what

Re: How to check if any item from a list of strings is in a big string?

2009-07-14 Thread Scott David Daniels
Nobody wrote: On Tue, 14 Jul 2009 02:06:04 -0300, Gabriel Genellina wrote: Matt, how many words are you looking for, in how long a string ? Were you able to time any( substr in long_string ) against re.compile ( "|".join( list_items )) ? There is a known algorithm to solve specifically this pro

Re: Efficient binary search tree stored in a flat array?

2009-07-14 Thread Douglas Alan
On Jul 14, 7:38 am, Florian Brucker wrote: > Douglas Alan wrote: > > Thank you. My question wasn't intended to be Python specific, though. > > I am just curious for purely academic reasons about whether there is > > such an algorithm. All the sources I've skimmed only seem to the > > answer the

Re: The meaning of "="

2009-07-14 Thread Aahz
In article , Piet van Oostrum wrote: >> [email protected] (Aahz) (A) wrote: > >>A> In article , Piet van Oostrum >>A> wrote: > And to get c.x = 4 working you also need a __setitem__. > >>A> Nope. You do need __setitem__ so that this works: > >>A> c['x'] = 4 > >Sorry, I meant such

Re: How to unbuffer Python's output

2009-07-14 Thread David Stanek
2009/7/14 Lily Gao : > Hi, All > > I am calling a python program in perl and use redirection, > > Like : > > `python x.py > 1.log 2>&1` Try tihs instead: python x.py 2>&1 > 1.log -- David blog: http://www.traceback.org twitter: http://twitter.com/dstanek -- http://mail.python.org/mailman/li

Re: missing 'xor' Boolean operator

2009-07-14 Thread Christian Heimes
Chris Rebert wrote: > Using the xor bitwise operator is also an option: > bool(x) ^ bool(y) I prefer something like: bool(a) + bool(b) == 1 It works even for multiple tests (super xor): if bool(a) + bool(b) + bool(c) + bool(d) != 1: raise ValueError("Exactly one of a, b, c and d mus

Passing handlers between bound c++ libs

2009-07-14 Thread Freyr
I have a python bound physics library that uses handler to process events. The passing of handlers between c++ and python causes a huge overhead slowing down the process. Can I implement a handler in my custom python bound c++ lib B and pass it to blackbox python bound c++ lib A so that A would ca

Re: Efficient binary search tree stored in a flat array?

2009-07-14 Thread Douglas Alan
On Jul 14, 8:10 am, Piet van Oostrum wrote: > Of course you can take any BST algorithm and replace pointers by indices > in the array and allocate new elements in the array. But then you need > array elements to contain the indices for the children explicitely. And why is this a problem? This is

Re: why did you choose the programming language(s)you currently use?

2009-07-14 Thread Scott David Daniels
Aahz wrote: In article <[email protected]>, Stefan Behnel wrote: Deep_Feelings wrote: So you have chosen programming language "x" so shall you tell us why you did so , and what negatives or positives it has ? *duck* Where do you get the duck programming

Re: decorators - would be nice if...

2009-07-14 Thread Jack Diederich
On Tue, Jul 14, 2009 at 5:44 PM, Ken Seehart wrote: > Almost every time I use decorators, I find myself wishing I had access > to the local namespace of the context from which the decorator is > executed.  In practice, decorator is being applied to a method, so the > namespace in question would be

Re: Efficient binary search tree stored in a flat array?

2009-07-14 Thread Douglas Alan
On Jul 14, 9:19 am, Scott David Daniels wrote: > It may well be that there is no good simple solution, and people avoid > writing about non-existent algorithms. I can't imagine why that should be the case. The CLRS textbook on algorithms, for instance, goes to some pains to mathematically prove

Re: missing 'xor' Boolean operator

2009-07-14 Thread Scott David Daniels
Ethan Furman wrote: and returns the last object that is "true" A little suspect this. _and_ returns the first object that is not "true," or the last object. or returns the first object that is "true" Similarly: _or_ returns the first object that is "true," or the last object. so should

Re: Calling functions: Why this complicated ?

2009-07-14 Thread Chris Rebert
On Tue, Jul 14, 2009 at 1:40 PM, Mohan Parthasarathy wrote: > Hi, > I am a newbie. I am reading > http://www.network-theory.co.uk/docs/pytut/KeywordArguments.html > Defining a function with "N" arguments and calling them in "M" different > ways. Why does it have to be this complicated ? I like the

Re: Efficient binary search tree stored in a flat array?

2009-07-14 Thread Douglas Alan
I wrote: > On Jul 14, 8:10 am, Piet van Oostrum wrote: > > > Of course you can take any BST algorithm and replace pointers by indices > > in the array and allocate new elements in the array. But then you need > > array elements to contain the indices for the children explicitely. > And why is t

Re: missing 'xor' Boolean operator

2009-07-14 Thread Ethan Furman
Christian Heimes wrote: Chris Rebert wrote: Using the xor bitwise operator is also an option: bool(x) ^ bool(y) I prefer something like: bool(a) + bool(b) == 1 It works even for multiple tests (super xor): if bool(a) + bool(b) + bool(c) + bool(d) != 1: raise ValueError("Exactl

compiling python

2009-07-14 Thread Mag Gam
At my university we are trying to compile python with --enable-shared however when I do a make many things fail. Is it a good idea to compile python with shared libraries? It seems mod-python needs it this way. TIA -- http://mail.python.org/mailman/listinfo/python-list

Reading floats from Excel using COM

2009-07-14 Thread Alagalah
Hi, I am using the Range function to return a tuple from Excel. The data in the range (nREVENUE) in the excel file is 100.0, 101.0, 102.0, 103.0, 104.0 I can successfully iterate across the tuple and list, but when I try and cast to a float to do some math, I get: File "C:\Python25\lib\site-pa

Re: why did you choose the programming language(s)you currently use?

2009-07-14 Thread greg
Deep_Feelings wrote: So you have chosen programming language "x" so shall you tell us why you did so , and what negatives or positives it has ? This summarises my reasons for choosing Python fairly well: http://www1.american.edu/cas/econ/faculty/isaac/choose_python.pdf -- Greg -- http://mail

Re: Calling functions: Why this complicated ?

2009-07-14 Thread Mohan Parthasarathy
Chris, Thanks for your clarifications > > I am a newbie. I am reading > > http://www.network-theory.co.uk/docs/pytut/KeywordArguments.html > > Defining a function with "N" arguments and calling them in "M" different > > ways. Why does it have to be this complicated ? I like the idea of > calling

Re: why did you choose the programming language(s)you currently use?

2009-07-14 Thread Chris Rebert
On Tue, Jul 14, 2009 at 5:32 PM, greg wrote: > Deep_Feelings wrote: >> >> So you have chosen programming language "x" so shall you tell us why >> you did so , and  what negatives or positives it has ? > > This summarises my reasons for choosing Python > fairly well: > > http://www1.american.edu/cas

Re: why did you choose the programming language(s)you currently use?

2009-07-14 Thread Martin P. Hellwig
Aahz wrote: In article <[email protected]>, Stefan Behnel wrote: Deep_Feelings wrote: So you have chosen programming language "x" so shall you tell us why you did so , and what negatives or positives it has ? *duck* Where do you get the duck programming

Re: Reading floats from Excel using COM

2009-07-14 Thread John Machin
Alagalah nekotaku.com> writes: > > Hi, I am using the Range function to return a tuple from Excel. [big snip] Exact duplicate of question asked by "KB" on http://groups.google.com/group/python-excel ... see my answer there. -- http://mail.python.org/mailman/listinfo/python-list

does python have a generic object pool like commons-pool in Java

2009-07-14 Thread Rick Lawson
Appreciate any help on this. I am porting an app from Java to python and need generic object pooling with hooks for object initialization / cleanup and be able to specify an object timeout. Thanks ! Rick -- http://mail.python.org/mailman/listinfo/python-list

Re: why did you choose the programming language(s)you currently use?

2009-07-14 Thread Che M
On Jul 14, 11:55 am, Deep_Feelings wrote: > So you have chosen programming language "x" so shall you tell us why > you did so , and  what negatives or positives it has ? As a hobbyist--and not a real programmer*--I think I chose Python (I don't really recall now) because of things like: - There

Re: Efficient binary search tree stored in a flat array?

2009-07-14 Thread Paul Rubin
Douglas Alan writes: > I can't see that a binary search tree would typically have > particularly good cache-friendliness, so I can't see why a flat-array > representation, such as is done for a binary heap, would have > particularly worse cache-reference. That is a good point. Maybe we should be

Re: explode()

2009-07-14 Thread Dave Angel
The one thing I really dislike about Python over PHP is that Python can usually only appear in the cgi directory (unless other arragements are made with your hosting provider or if you reconfigure Apache on your own server if you have your own). With PHP, I can put them in any folder on

Re: Tkinter / Entry widget problem

2009-07-14 Thread John McMonagle
Andras Szabo wrote: > Hello. I searched the archives but couldn't find a solution to a problem > related to the Entry widget in Tkinter. > > When creating a pop-up window in an app, which contains an Entry widget, > I want this widget to contain some default string, to have all this > default stri

Re: How to keep a function as a generator function when the yield operator is moved into its sub-functions??

2009-07-14 Thread Dave Angel
weafon wrote: Hi guys, I have a question about the usage of yield. As shown in the below example, in general, if there is a code segment commonly used by two or more functions, we may isolate the segment into a function and then call it from other functions if necessary. def func1(): ...

Re: missing 'xor' Boolean operator

2009-07-14 Thread Dr. Phillip M. Feldman
I appreciate the effort that people have made, but I'm not impressed with any of the answers. For one thing, xor should be able to accept an arbitrary number of input arguments (not just two), and should return True if and only if the number of input arguments that evaluate to True is odd (see ww

Re: missing 'xor' Boolean operator

2009-07-14 Thread Miles Kaufmann
On Jul 15, 2009, at 12:07 AM, Dr. Phillip M. Feldman wrote: I appreciate the effort that people have made, but I'm not impressed with any of the answers. For one thing, xor should be able to accept an arbitrary number of input arguments (not just two) You originally proposed this in the c

one more question

2009-07-14 Thread amrita
Dear all, Just one more thing i want to ask that suppose i have a file like:--- 47 8 ALA H H 7.85 0.02 1 48 8 ALA HAH 2.98 0.02 1 49 8 ALA HBH 1.05 0.02 1 50 8 ALA C C179.39 0.3

Re: why did you choose the programming language(s)you currently use?

2009-07-14 Thread Mensanator
On Jul 14, 1:47�pm, Paul Rubin wrote: > Mensanator writes: > > - unlimited precision integers > > - easy to program > > - IDE not required > > - reasonable speed > > - math library needs to include number theoretic functions > > � like GCD, LCM, Modular Inverse, etc.

Re: why did you choose the programming language(s)you currently use?

2009-07-14 Thread Mensanator
On Jul 14, 4:58�pm, Nobody wrote: > On Tue, 14 Jul 2009 11:47:08 -0700, Paul Rubin wrote: > >> - unlimited precision integers > >> - easy to program > >> - IDE not required > >> - reasonable speed > >> - math library needs to include number theoretic functions > >> � like GCD, LCM, Modular Inverse

Re: missing 'xor' Boolean operator

2009-07-14 Thread Tim Roberts
"Dr. Phillip M. Feldman" wrote: > >Here's a related issue: I would like to see an option for type checking on >operands of logical operators, so that attempting to apply a logical >operator to non-Boolean entities generates a warning message. With operand >type checking, 'xor' and != would be dif

Re: one more question

2009-07-14 Thread alex23
[email protected] wrote: > I tried but its not coming. How much are you prepared to pay for help with this? Or are you just asking us to do all the work for you? -- http://mail.python.org/mailman/listinfo/python-list

<    1   2