Re: PyCrypto builds neither with MSVC nor MinGW

2012-02-05 Thread Terry Reedy
On 2/6/2012 1:53 AM, Chris Angelico wrote: On Mon, Feb 6, 2012 at 12:26 PM, Terry Reedy wrote: On 2/5/2012 6:23 PM, Dennis Lee Bieber wrote: On Mon, 6 Feb 2012 03:42:08 +1100, Alec Taylor wrote: A 4 year old compiler? I also have MSVC11 installed. Can the python project add support for tha

Re: help function and operetors overloading

2012-02-05 Thread Terry Reedy
On 2/6/2012 12:48 AM, Mohsen Pahlevanzadeh wrote: Dear all, You know python has many functions for operators overloading such as __add__, __radd__, __invert__, __eq__ and so on. How i see the complete list of them with help function? >>> import operator >>> help(operator) Help on built-in modu

Re: difference between random module in python 2.6 and 3.2?

2012-02-05 Thread Terry Reedy
On 2/6/2012 12:56 AM, Steven D'Aprano wrote: On Mon, 06 Feb 2012 00:07:04 -0500, Terry Reedy wrote: On 2/5/2012 11:01 PM, Steven D'Aprano wrote: Reading the docs, I would expect that when using an int as seed, you should get identical results. That is similar to expecting hash to be consist

Re: PyCrypto builds neither with MSVC nor MinGW

2012-02-05 Thread Chris Angelico
On Mon, Feb 6, 2012 at 12:26 PM, Terry Reedy wrote: > On 2/5/2012 6:23 PM, Dennis Lee Bieber wrote: >> >> On Mon, 6 Feb 2012 03:42:08 +1100, Alec Taylor >> wrote: >> >>> A 4 year old compiler? >>> >>> I also have MSVC11 installed. Can the python project add support for >>> that so that we aren't w

Re: [Perl Golf] Round 1

2012-02-05 Thread Chris Angelico
On Mon, Feb 6, 2012 at 10:03 AM, Heiko Wundram wrote: > You're only allowed to bash him for one-liners as soon as he formulates > something that in some way or another resembles a programming challenge, and > not some incoherent listing of words without actual intent... ;-) Nah, one-liners are fu

Re: help function and operetors overloading

2012-02-05 Thread Chris Rebert
On Sun, Feb 5, 2012 at 9:48 PM, Mohsen Pahlevanzadeh wrote: > Dear all, > > You know python has many functions for operators overloading such as > __add__, __radd__, __invert__, __eq__ and so on. > How i see the complete list of them with help function? I don't know if there's a help() entry for

Re: difference between random module in python 2.6 and 3.2?

2012-02-05 Thread Steven D'Aprano
On Mon, 06 Feb 2012 00:07:04 -0500, Terry Reedy wrote: > On 2/5/2012 11:01 PM, Steven D'Aprano wrote: > >> Reading the docs, I would expect that when using an int as seed, you >> should get identical results. > > That is similar to expecting hash to be consistent from version to > version. No.

Re: Common LISP-style closures with Python

2012-02-05 Thread Antti J Ylikoski
On 5.2.2012 22:58, Ian Kelly wrote: On Sat, Feb 4, 2012 at 9:19 PM, Antti J Ylikoski wrote: I'm not sure how naughty this is, but the same thing can be done without using nonlocal by storing the local state as an attribute of the enclosed function object: ... Yes, I do know that, but then it

help function and operetors overloading

2012-02-05 Thread Mohsen Pahlevanzadeh
Dear all, You know python has many functions for operators overloading such as __add__, __radd__, __invert__, __eq__ and so on. How i see the complete list of them with help function? Yours, Mohsen signature.asc Description: This is a digitally signed message part -- http://mail.python.org/mai

Re: difference between random module in python 2.6 and 3.2?

2012-02-05 Thread Terry Reedy
On 2/5/2012 11:01 PM, Steven D'Aprano wrote: Reading the docs, I would expect that when using an int as seed, you should get identical results. That is similar to expecting hash to be consistent from version to version. There is no mention that the PRNG has changed between 2.6 and 3.2; The

Re: difference between random module in python 2.6 and 3.2?

2012-02-05 Thread Steven D'Aprano
On Mon, 06 Feb 2012 02:27:38 +0100, Matej Cepl wrote: > Strange thing is that this unit tests correctly with python3, but fails > with python2. The problem is that apparently python3 random.choice picks > different element of self[k] than the one python2 (at least, both of > them are constant in t

difference between random module in python 2.6 and 3.2?

2012-02-05 Thread Matej Cepl
Hi, I have this working function: def as_xml(self): out = etree.Element("or") for k in sorted(self.keys()): out.append(etree.Element("hostname", attrib={'op': '=', 'value': random.choice(self[k])})) # ... return somehow string representing

Re: PyCrypto builds neither with MSVC nor MinGW

2012-02-05 Thread Terry Reedy
On 2/5/2012 6:23 PM, Dennis Lee Bieber wrote: On Mon, 6 Feb 2012 03:42:08 +1100, Alec Taylor wrote: A 4 year old compiler? I also have MSVC11 installed. Can the python project add support for that so that we aren't waiting 5 years between compiler support? 3.3 will almost certainly be built

Python and TAP

2012-02-05 Thread Matej Cepl
I have just finished listening to the FLOSS Weekly podcast #200 (http://twit.tv/show/floss-weekly/200) on autotest, where I've learned about the existence of TAP (http://testanything.org/). A standardization of testing seems to be so obviously The Right Thing™, that it is strange that I don't s

Re: MySQLdb not allowing hyphen

2012-02-05 Thread Emeka
Dennis , Chris Thanks so much! On Mon, Feb 6, 2012 at 1:23 AM, Dennis Lee Bieber wrote: > On Mon, 6 Feb 2012 00:41:24 +0200, Emeka wrote: > > >Hello All, > > > >I noticed that MySQLdb not allowing hyphen may be way to prevent injection > >attack. > > What hyphen? > > >I have something

Re: [Perl Golf] Round 1

2012-02-05 Thread Heiko Wundram
Am 05.02.2012 23:15, schrieb Neal Becker: Heiko Wundram wrote: Am 05.02.2012 12:49, schrieb Alec Taylor: Solve this problem using as few lines of code as possible[1]. Pardon me, but where's "the problem"? If your intention is to propose "a challenge", say so, and state the associated problem

Re: MySQLdb not allowing hyphen

2012-02-05 Thread Chris Rebert
On Sun, Feb 5, 2012 at 2:41 PM, Emeka wrote: > > Hello All, > > I noticed that MySQLdb not allowing hyphen may be way to prevent injection > attack. > I have something like below: > > "insert into reviews(message, title)values('%s', '%s')" %( "We don't know > where to go","We can't wait till morro

MySQLdb not allowing hyphen

2012-02-05 Thread Emeka
Hello All, I noticed that MySQLdb not allowing hyphen may be way to prevent injection attack. I have something like below: "insert into reviews(message, title)values('%s', '%s')" %( "We don't know where to go","We can't wait till morrow" ) ProgrammingError(1064, "You have an error in your SQL sy

Re: [Perl Golf] Round 1

2012-02-05 Thread Neal Becker
Heiko Wundram wrote: > Am 05.02.2012 12:49, schrieb Alec Taylor: >> Solve this problem using as few lines of code as possible[1]. > > Pardon me, but where's "the problem"? If your intention is to propose "a > challenge", say so, and state the associated problem clearly. > But this really misses

Re: [Perl Golf] Round 1

2012-02-05 Thread Ben Finney
Alec Taylor writes: > One sentence can contain one or more strings next to each-other, which > can be joined to make another word. > > e.g.: > > "to get her" == "together" > "an other" == "another" > "where about" == "whereabouts" > > &etc Yes, that's true. > Solve this problem using as few lin

Re: Common LISP-style closures with Python

2012-02-05 Thread Ian Kelly
On Sat, Feb 4, 2012 at 9:19 PM, Antti J Ylikoski wrote: >> I'm not sure how naughty this is, but the same thing can be done without >> using >> nonlocal by storing the local state as an attribute of the enclosed >> function >> object: >> >> ... > > Yes, I do know that, but then it would not be a c

Re: Help about dictionary append

2012-02-05 Thread Anatoli Hristov
Thanks Chris, It works fine, I see it will take time till I understand all the syntax :( A.H On Sun, Feb 5, 2012 at 4:20 PM, Chris Angelico wrote: > On Mon, Feb 6, 2012 at 2:13 AM, Anatoli Hristov wrote: > > Hi there, > > > > I`m again confused and its the dictionary. As dictionary does not s

Re: [Perl Golf] Round 1

2012-02-05 Thread Heiko Wundram
Am 05.02.2012 12:49, schrieb Alec Taylor: Solve this problem using as few lines of code as possible[1]. Pardon me, but where's "the problem"? If your intention is to propose "a challenge", say so, and state the associated problem clearly. -- --- Heiko. -- http://mail.python.org/mailman/listi

Re: PyCrypto builds neither with MSVC nor MinGW

2012-02-05 Thread Steven D'Aprano
On Mon, 06 Feb 2012 03:42:08 +1100, Alec Taylor wrote: > A 4 year old compiler? Compilers aren't like milk. They don't go off after a few weeks. A good compiler/operating system combination should still be usable after 4 or 14 years. The compiler I'm using is six years old, and I expect that it

Re: PyCrypto builds neither with MSVC nor MinGW

2012-02-05 Thread Alec Taylor
A 4 year old compiler? I also have MSVC11 installed. Can the python project add support for that so that we aren't waiting 5 years between compiler support? On Mon, Feb 6, 2012 at 2:23 AM, Christian Heimes wrote: > Am 05.02.2012 15:40, schrieb Alec Taylor: >> PIL, PyCrypto and many other modules

Re: Common LISP-style closures with Python

2012-02-05 Thread Alan Ristow
On 02/05/2012 05:19 AM, Antti J Ylikoski wrote: Yes, I do know that, but then it would not be a closure :-) Forgive me if this is terribly naive, but what is the advantage of using a closure as opposed to, say, some other function that returns the same value in the same context, but

Re: Help about dictionary append

2012-02-05 Thread Andrew Berg
On 2/5/2012 9:13 AM, Anatoli Hristov wrote: > and I get and error that TUPLE object has no attribute Append !!! You defined mydict['name'] as a tuple, and tuples are immutable. Using a tuple means that you don't ever want the values to change. > But how to add new Values to a dictionary then ? Thi

Re: PyCrypto builds neither with MSVC nor MinGW

2012-02-05 Thread Christian Heimes
Am 05.02.2012 15:40, schrieb Alec Taylor: > PIL, PyCrypto and many other modules require a C compiler and linker. > > Unfortunately neither install on my computer, with a PATH with the following: > > C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC > C:\libraries\MinGW\msys\1.0\bin > C:\lib

Re: Help about dictionary append

2012-02-05 Thread James Broadhead
On 5 February 2012 15:13, Anatoli Hristov wrote: > Hi there, > > I`m again confused and its the dictionary. As dictionary does not support > append I create a variable list with dictionary key values and want to add > new values to it and then copy it again to the dictionary as I dont know > other

Re: Help about dictionary append

2012-02-05 Thread Chris Angelico
On Mon, Feb 6, 2012 at 2:13 AM, Anatoli Hristov wrote: > Hi there, > > I`m again confused and its the dictionary. As dictionary does not support > append I create a variable list with dictionary key values and want to add > new values to it and then copy it again to the dictionary as I dont know >

Help about dictionary append

2012-02-05 Thread Anatoli Hristov
Hi there, I`m again confused and its the dictionary. As dictionary does not support append I create a variable list with dictionary key values and want to add new values to it and then copy it again to the dictionary as I dont know other methods. mydict = {'Name':('Name1','Name2','Name3'),'Tel':(

PyCrypto builds neither with MSVC nor MinGW

2012-02-05 Thread Alec Taylor
PIL, PyCrypto and many other modules require a C compiler and linker. Unfortunately neither install on my computer, with a PATH with the following: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC C:\libraries\MinGW\msys\1.0\bin C:\libraries\MinGW C:\Python27\Scripts Output from G:\pycrypt

[Perl Golf] Round 1

2012-02-05 Thread Alec Taylor
One sentence can contain one or more strings next to each-other, which can be joined to make another word. e.g.: "to get her" == "together" "an other" == "another" "where about" == "whereabouts" &etc Solve this problem using as few lines of code as possible[1]. Good luck! [1] Don't use extern