Re: Does '!=' equivelent to 'is not'

2008-06-18 Thread Lie
On Jun 18, 7:26 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 17 Jun 2008 09:09:41 -0300, Derek Martin <[EMAIL PROTECTED]>   > escribió: > > > On Tue, Jun 17, 2008 at 04:33:03AM -0300, Gabriel Genellina wrote: > >> > Basically 'a is b' and 'not(a is b)' is similar to 'id(a) == id(b)'

Re: Does '!=' equivelent to 'is not'

2008-06-18 Thread Lie
On Jun 18, 12:32 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > >> Saying a flat "no" alone, without qualifying your statement is > >> generally interpreted as rude in English...  It's kind of like how you > >> talk to children when they're too young to understand the explanation. > >> Yucky. > > > I

python string comparison oddity

2008-06-18 Thread Faheem Mitha
Hi everybody, I was wondering if anyone can explain this. My understanding is that 'is' checks if the object is the same. However, in that case, why this inconsistency for short strings? I would expect a 'False' for all three comparisons. This is reproducible across two different machines, so

Re: Calling pcre with ctypes

2008-06-18 Thread Thomas Heller
moreati schrieb: > Recently I discovered the re module doesn't support POSIX character > classes: > > Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) > [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. import re r = re

Re: Function argument conformity check

2008-06-18 Thread dlists . cad
On Jun 18, 3:13 pm, Cédric Lucantis <[EMAIL PROTECTED]> wrote: > Hi, > > Le Wednesday 18 June 2008 20:19:12 [EMAIL PROTECTED], vous avez écrit : > > > Hi. I am looking for a way to check if some given set of (*args, > > **kwds) conforms to the argument specification of a given function, > > without

Re: Does '!=' equivelent to 'is not'

2008-06-18 Thread Paul McGuire
On Jun 18, 2:22 pm, Lie <[EMAIL PROTECTED]> wrote: > > I'm not a native English speaker, although I think my parents would > have liked me to be more straightforward when talking, cause I tend to > say things like "possibly", "maybe", "probably", and other ambiguous > expressions to the extent that

Re: python string comparison oddity

2008-06-18 Thread Lie
On Jun 19, 2:26 am, Faheem Mitha <[EMAIL PROTECTED]> wrote: > Hi everybody, > > I was wondering if anyone can explain this. My understanding is that 'is' > checks if the object is the same. However, in that case, why this > inconsistency for short strings? I would expect a 'False' for all three > c

Re: Numeric type conversions

2008-06-18 Thread Hrvoje Niksic
John Dann <[EMAIL PROTECTED]> writes: > I suppose there must be some logic in including the start position > but excluding the end position, though it does escape me for now. I > can understand making a range inclusive or exclusive but not a > mixture of the two. Suppose it's just something you ha

Re: PEP 372 -- Adding an ordered directory to collections

2008-06-18 Thread Martin v. Löwis
> What's the purpose of having list.insert? It's a convenience function: you don't have to write a loop to move all items to a later index. Any reformulation of it is easy to get wrong, and difficult to read. > One creates tons of unnecessary method calls, the other creates a full > blown list ob

Re: Function argument conformity check

2008-06-18 Thread Matthew Woodcraft
In article <[EMAIL PROTECTED]>, > The problem is that using these attributes, I would essentially have > to re-write the logic python uses when calling a function with a > given set of arguments. I was hoping there is a way to get at that > logic without rewriting it. I don't think there is. I end

Re: Does '!=' equivelent to 'is not'

2008-06-18 Thread Lie
On Jun 19, 2:51 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Jun 18, 2:22 pm, Lie <[EMAIL PROTECTED]> wrote: > > > > > I'm not a native English speaker, although I think my parents would > > have liked me to be more straightforward when talking, cause I tend to > > say things like "possibly", "

Re: Ternary operator alternative in Ptyhon

2008-06-18 Thread Jeffrey Froman
jeremie fouche wrote: > You can also use : > self.SomeField = params.has_key("mykey") and params["mykey"] or None Have caution with this solution: it may not provide the desired result in the case where params["mykey"] is a false value, such as 0, or [] Jeffrey -- http://mail.python.org/mailman

Re: How to split a string containing nested commas-separated substrings

2008-06-18 Thread Matimus
On Jun 18, 10:54 am, Matimus <[EMAIL PROTECTED]> wrote: > On Jun 18, 10:19 am, Robert Dodier <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > I'd like to split a string by commas, but only at the "top level" so > > to speak. An element can be a comma-less substring, or a > > quoted string, or a su

Re: Who is using python-ldap with Python 1.5.x and 2.0-2.2?

2008-06-18 Thread Jeffrey Froman
Michael Ströder wrote: > Please tell me > which Python version you're using We do have one venerable machine here at work using python2.2 with python-ldap2.0.0pre04. As you can see, we haven't bothered to update either in quite a while ;-) > and why it'd be important for you to > have python-ld

NumPy chararray and whitespace

2008-06-18 Thread OKB (not okblacke)
Hi. I'm trying to use NumPy's chararray class for an array of characters. I notice that when I try to set a chararray element to a space, it actually gets set to an empty string. I found some pages online indicating that the chararray strips trailing whitespace from its values.

Re: Function argument conformity check

2008-06-18 Thread George Sakkis
On Jun 18, 3:41 pm, [EMAIL PROTECTED] wrote: > On Jun 18, 3:13 pm, Cédric Lucantis <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > Le Wednesday 18 June 2008 20:19:12 [EMAIL PROTECTED], vous avez écrit : > > > > Hi. I am looking for a way to check if some given set of (*args, > > > **kwds) conforms t

Re: NumPy chararray and whitespace

2008-06-18 Thread Robert Kern
OKB (not okblacke) wrote: Hi. I'm trying to use NumPy's chararray class for an array of characters. I notice that when I try to set a chararray element to a space, it actually gets set to an empty string. I found some pages online indicating that the chararray strips trailing whitespace

extra positional arguments before optional parameters syntax

2008-06-18 Thread MisterWilliam
I noticed that in PEP 3105, the PEP about turning print to print(), the syntax for print() is defined as follows: def print(*args, sep=' ', end='\n', file=None) Ignoring the fact that print is a reserved keyword in python, this is not valid python because extra positional arguments (*args), cannot

Re: Function argument conformity check

2008-06-18 Thread crazychimp132
On Jun 18, 5:05 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jun 18, 3:41 pm, [EMAIL PROTECTED] wrote: > > > > > On Jun 18, 3:13 pm, Cédric Lucantis <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > Le Wednesday 18 June 2008 20:19:12 [EMAIL PROTECTED], vous avez écrit : > > > > > Hi. I am looking

Re: Does '!=' equivelent to 'is not' [drifting a little more]

2008-06-18 Thread Gabriel Genellina
En Wed, 18 Jun 2008 14:26:31 -0300, Ethan Furman <[EMAIL PROTECTED]> escribió: Gabriel Genellina wrote: (This thread is getting way above 1cp...) What is 1cp? cp = centipoise, a unit of dynamic viscosity, measuring the resistence to flow. Honey viscosity is a few hundreds, corn

Re: extra positional arguments before optional parameters syntax

2008-06-18 Thread George Sakkis
On Jun 18, 5:25 pm, MisterWilliam <[EMAIL PROTECTED]> wrote: > I noticed that in PEP 3105, the PEP about turning print to print(), > the syntax for print() is defined as follows: > def print(*args, sep=' ', end='\n', file=None) > > Ignoring the fact that print is a reserved keyword in python, this

advanced listcomprehenions?

2008-06-18 Thread cirfu
I am wondering if it is possible to write advanced listcomprehensions. For example: """Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and

Re: PEP 372 -- Adding an ordered directory to collections

2008-06-18 Thread [EMAIL PROTECTED]
Wow, I was completely wrong about sorted dicts and odicts. On Jun 17, 4:21 am, [EMAIL PROTECTED] wrote: > mean. I think for this data structure it's important to keep all the > normal dict operations at the same speed. If you use a C Why keep the normal dict operations at the same speed? There is

Re: Getting Python exit code when calling Python script from Java program

2008-06-18 Thread Gabriel Genellina
En Wed, 18 Jun 2008 08:09:58 -0300, A.T.Hofkamp <[EMAIL PROTECTED]> escribió: On 2008-06-18, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: picking up 0. On investigation it turned out that the exit value being read is from python.exe process, not from the Python script. Is there any way I can

Re: python string comparison oddity

2008-06-18 Thread Faheem Mitha
On Wed, 18 Jun 2008 12:57:44 -0700 (PDT), Lie <[EMAIL PROTECTED]> wrote: > On Jun 19, 2:26 am, Faheem Mitha <[EMAIL PROTECTED]> wrote: >> Hi everybody, >> >> I was wondering if anyone can explain this. My understanding is that 'is' >> checks if the object is the same. However, in that case, why thi

Re: PEP 372 -- Adding an ordered directory to collections

2008-06-18 Thread bearophileHUGS
dbpoko...: > Why keep the normal dict operations at the same speed? There is a > substantial cost this entails. I presume now we can create a list of possible odict usages, because I think that despite everyone using it for different purposes, we may find some main groups of its usage. I use odict

Re: advanced listcomprehenions?

2008-06-18 Thread Gabriel Genellina
En Wed, 18 Jun 2008 18:42:00 -0300, cirfu <[EMAIL PROTECTED]> escribió: I am wondering if it is possible to write advanced listcomprehensions. For example: """Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multipl

Re: python string comparison oddity

2008-06-18 Thread Robert Kern
Faheem Mitha wrote: On Wed, 18 Jun 2008 12:57:44 -0700 (PDT), Lie <[EMAIL PROTECTED]> wrote: On Jun 19, 2:26 am, Faheem Mitha <[EMAIL PROTECTED]> wrote: Hi everybody, I was wondering if anyone can explain this. My understanding is that 'is' checks if the object is the same. However, in that ca

Re: Does '!=' equivelent to 'is not'

2008-06-18 Thread MRAB
On Jun 18, 9:43 pm, Lie <[EMAIL PROTECTED]> wrote: > On Jun 19, 2:51 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > > > On Jun 18, 2:22 pm, Lie <[EMAIL PROTECTED]> wrote: > > > > I'm not a native English speaker, although I think my parents would > > > have liked me to be more straightforward when t

Re: PEP 372 -- Adding an ordered directory to collections

2008-06-18 Thread Matimus
On Jun 16, 1:37 am, Armin Ronacher <[EMAIL PROTECTED]> wrote: > Abstract > > > This PEP proposes an ordered dictionary as a new data structure for > the ``collections`` module, called "odict" in this PEP for short.  The > proposed API incorporates the experiences gained from working with >

Re: advanced listcomprehenions?

2008-06-18 Thread MRAB
On Jun 18, 10:42 pm, cirfu <[EMAIL PROTECTED]> wrote: > I am wondering if it is possible to write advanced listcomprehensions. > > For example: > """Write a program that prints the numbers from 1 to 100. But for > multiples of three print "Fizz" instead of the number and for the > multiples of five

Re: Ultimate Prime Sieve -- Sieve Of Zakiya (SoZ)

2008-06-18 Thread George Sakkis
On Jun 13, 1:12 pm, jzakiya <[EMAIL PROTECTED]> wrote: > The paper presents benchmarks with Ruby 1.9.0-1 (YARV). I would love > to see my various prime generators benchmarked with optimized > implementations in other languages. I'm hoping Python gurus will do > better than I, though the methodol

Re: advanced listcomprehenions?

2008-06-18 Thread Dan Bishop
On Jun 18, 4:42 pm, cirfu <[EMAIL PROTECTED]> wrote: > I am wondering if it is possible to write advanced listcomprehensions. > > For example: > """Write a program that prints the numbers from 1 to 100. But for > multiples of three print "Fizz" instead of the number and for the > multiples of five

Personal project announcement

2008-06-18 Thread s0suk3
Hi, Just wanted to announce a little project I've just uploaded. It's a web server written in Python. You can get it at http://code.google.com/p/sws-d/ . Any suggestions or comments are welcome! Regards, Sebastian -- http://mail.python.org/mailman/listinfo/python-list

How do i : Python Threads + KeyboardInterrupt exception

2008-06-18 Thread Brendon Costa
Hi all, I have a small python project i am working on. Basically i always have two threads. A "Read" thread that sits in a loop reading a line at a time from some input (Usually stdin) and then generating events to be processed and a "Proc" thread that processes incoming events from a queue. There

Python email server

2008-06-18 Thread John Sloop
I am starting to build a Python email server. Before assembling the individual pieces I am wondering if there is a prebuilt package anyone would recommend? Thanks in advance for your advice and guidance. John S. -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for lots of words in lots of files

2008-06-18 Thread Cong
On Jun 18, 11:01 pm, Kris Kennaway <[EMAIL PROTECTED]> wrote: > Calvin Spealman wrote: > > Upload, wait, and google them. > > > Seriously tho, aside from using a real indexer, I would build a set of > > thewordsI'mlookingfor, and then loop over each file, looping over > > thewordsand doing quick ch

Re: PEP 372 -- Adding an ordered directory to collections

2008-06-18 Thread [EMAIL PROTECTED]
On Jun 18, 3:15 pm, [EMAIL PROTECTED] wrote: > In Python 2.5 a dict(int:None) needs about 36.2 bytes/element. I am > suggesting to add 2 pointers, to create a linked list, so it probably > becomes (on 32 bit systems) about 44.2 bytes/pair. PyDictEntry is typedef struct { Py_ssize_t me_has

Re: How do i : Python Threads + KeyboardInterrupt exception

2008-06-18 Thread Gabriel Genellina
En Wed, 18 Jun 2008 21:39:41 -0300, Brendon Costa <[EMAIL PROTECTED]> escribió: I have a small python project i am working on. Basically i always have two threads. A "Read" thread that sits in a loop reading a line at a time from some input (Usually stdin) and then generating events to be proc

��python in a nutshell��and��programming python��

2008-06-18 Thread yps
as a new learner of python,which book in and is more suitable? and recommend several books? thanks best regards pase.Y -- http://mail.python.org/mailman/listinfo/python-list

RELEASED Python 2.6b1 and 3.0b1

2008-06-18 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team and the Python community, I am happy to announce the first beta releases of Python 2.6 and Python 3.0. Please note that these are beta releases, and as such are not suitable for production environments.

python/ruby question..

2008-06-18 Thread bruce
hi... can someone point me to where/how i would go about calling a ruby app from a python app, and having the python app being able to get a returned value from the ruby script. something like test.py a = os.exec(testruby.rb) testruby.py foo = 9 return foo i know this doesn't work... but

Re: ¡¶python in a nutshell¡·and¡¶programming p ython¡·

2008-06-18 Thread [EMAIL PROTECTED]
Learning Python may be another good choice. But really, for just starting out, nothing beats online documentation. http://docs.python.org/tut/tut.html http://diveintopython.org/ On Jun 18, 9:02 pm, "yps" <[EMAIL PROTECTED]> wrote: > as a new learner of python,which book in and > is more suitab

Re: Ternary operator alternative in Ptyhon

2008-06-18 Thread kretik
Thank you everyone. I ended up implementing the dict.get() method, which seems "cleaner", but I'll keep the (x if y else z) syntax in mind. I didn't know it existed, I guess it's what I was looking for to begin with. Thanks again! Allen wrote: kretik wrote: I'm sure this is a popular one, but

Re: python/ruby question..

2008-06-18 Thread Mensanator
On Jun 18, 10:33�pm, "bruce" <[EMAIL PROTECTED]> wrote: > hi... > > can someone point me to where/how i would go about calling a ruby app from a > python app, and having the python app being able to get a returned value > from the ruby script. > > something like > > test.py > �a = os.exec(testruby.

Re: ��python in a nutshell��and��programming python��

2008-06-18 Thread Joel Koltner
"yps" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > as a new learner of python,which book in and > is more suitable? I don't have "Python in a Nutshell," but let me ask... do you have a strong programming background in C++, Java, etc.? If so, you'll probably find "Programming

Re: How do i : Python Threads + KeyboardInterrupt exception

2008-06-18 Thread Brendon Costa
> I don't know the "standard" way, but perhaps you can get some ideas from > this recent > thread:http://groups.google.com/group/comp.lang.python/browse_thread/thread/... > I had a quick read through that thread. I think i will need some more time to think about what they are saying in there thou

Why doesnt PDB allow me to view the current line?

2008-06-18 Thread hardcoreUFO
I have some code that I am trying to debug (Python 2.5.2 on OSX) using pdb. However, when the code reaches the pdb.set_trace(), it does not allow me to view the current line: > /Users/chris/Research/ISEC/build/bdist.macosx-10.3-i386/egg/pyrl/reinforcement.py(943)__call__() (Pdb) n > /Users/chris/R

Regular expressions for accents like ó character in python

2008-06-18 Thread Sallu
i want to restrict to user to not enter accents character. si i need to make an Regular expressions for accents like ó character -- http://mail.python.org/mailman/listinfo/python-list

Re: RELEASED Python 2.6b1 and 3.0b1

2008-06-18 Thread Terry Reedy
Barry Warsaw wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team and the Python community, I am happy to announce the first beta releases of Python 2.6 and Python 3.0. As usual, this is the source code release. A Windows installer built from that co

Mr nazim

2008-06-18 Thread raashid bhatt
nazim why you want to use an IDE for gui development as we got a tk wrapper for python use Tkinter import it in python its easy -- http://mail.python.org/mailman/listinfo/python-list

good

2008-06-18 Thread raashid bhatt
I like your programming choice becaz python is safe than c or c++ or any other compiled languages as it protects against buffer overflow which causes potentail security problems i am wanted to know how many requests can it handle is it configurable for that. Raashid Bhatt (C) -- http://mail.p

Doc tests in Python

2008-06-18 Thread J-Burns
Hello. Im new to using doctests in python. Could some1 tel me how to use doctests if i have a constructor in my code? -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular expressions for accents like ó character in python

2008-06-18 Thread Gabriel Genellina
En Thu, 19 Jun 2008 02:08:38 -0300, Sallu <[EMAIL PROTECTED]> escribió: i want to restrict to user to not enter accents character. si i need to make an Regular expressions for accents like ó character You may enumerate all the allowed characters: py> allowed_re = re.compile(r"^[A-Za-z0-9 ]*

Re: How do i : Python Threads + KeyboardInterrupt exception

2008-06-18 Thread Brendon Costa
I tested this a bit more. My windows example was incorrect. It should have used CTRL_C_EVENT. But even then, the problem is that the process will also close the console window from which it was called because of the 0. Also this requires that the process actually have a console and is not a GUI app

Re: Does '!=' equivelent to 'is not'

2008-06-18 Thread Derek Martin
Yaieee! On Wed, Jun 18, 2008 at 01:32:28AM -0400, Terry Reedy wrote: > > >Saying a flat "no" alone, without qualifying your statement is > > >generally interpreted as rude in English... > As a very much native English speaker I disagree that 'No' is > necessarily rude. I never said it was n

<    1   2