ANN: Webware for Python 1.1.1 released

2013-01-18 Thread Christoph Zwerschke
Version 1.1.1 of Webware for Python can now be downloaded at http://downloads.sourceforge.net/webware/Webware-1.1.1.tar.gz. This is a bugfix release with some fixes and small improvements. Webware for Python is a mature and stable web framework that has been around since more than a decade.

Vote tallying...

2013-01-18 Thread Andrew Robinson
Hi, I have a problem which may fit in a mysql database, but which I only have python as an alternate tool to solve... so I'd like to hear some opinions... I'm building a experimental content management program on a standard Linux Web server. And I'm needing to keep track of archived votes

Re: Vote tallying...

2013-01-18 Thread Lie Ryan
On 18/01/13 10:59, Andrew Robinson wrote: Hi, I have a problem which may fit in a mysql database, but which I only have python as an alternate tool to solve... so I'd like to hear some opinions... Since you have a large dataset, you might want to use sqlite3

Re: Vote tallying...

2013-01-18 Thread Stefan Behnel
Andrew Robinson, 18.01.2013 00:59: I have a problem which may fit in a mysql database Everything fits in a MySQL database - not a reason to use it, though. Py2.5 and later ship with sqlite3 and if you go for an external database, why use MySQL if you can have PostgreSQL for the same price?

Re: Loading a PKCS#1 public key using M2Crypto

2013-01-18 Thread Marc Aymerich
On Fri, Jan 18, 2013 at 12:10 AM, Piet van Oostrum p...@vanoostrum.org wrote: Marc Aymerich glicer...@gmail.com writes: Thank you very much Piet, I'm just starting to grasp these cryptography related concepts and your code is helping me a lot to understand how to handle these keys in a low

Re: Param decorator - can you suggest improvements

2013-01-18 Thread Steven D'Aprano
On Fri, 18 Jan 2013 03:38:08 +, Dan Sommers wrote: On Thu, 17 Jan 2013 15:21:08 +, Steven D'Aprano wrote: On Thu, 17 Jan 2013 06:35:29 -0800, Mark Carter wrote: I thought it would be interesting to try to implement Scheme SRFI 39 (Parameter objects) in Python. The idea is that

Re: Weirdness with python and stdin redirection under Win32

2013-01-18 Thread dexter . rao19
On Saturday, December 7, 2002 5:10:07 AM UTC+5:30, Jonathan M. Gilligan wrote: The bug is NOT fixed in Win2k. That's where I am seeing it (Win2K Pro SP3). Jonathan Thomas Heller thel...@python.net wrote in message news:fzteezlp@python.net... norbert.klam...@klamann-software.de

Any built-in ishashable method ?

2013-01-18 Thread Jean-Michel Pichavant
Hello people, Is there any built-in way to know if an object is a valid dictionary key ? From what I know, the object must be hashable, and from the python doc, an object is hashable if it has the __hash__ and (__cmp__ or __eq__) methods. http://docs.python.org/2/glossary.html#term-hashable I

Re: Any built-in ishashable method ?

2013-01-18 Thread Dave Angel
On 01/18/2013 05:36 AM, Jean-Michel Pichavant wrote: Hello people, Is there any built-in way to know if an object is a valid dictionary key ? From what I know, the object must be hashable, and from the python doc, an object is hashable if it has the __hash__ and (__cmp__ or __eq__) methods.

Re: Any built-in ishashable method ?

2013-01-18 Thread Peter Otten
Jean-Michel Pichavant wrote: Hello people, Is there any built-in way to know if an object is a valid dictionary key ? From what I know, the object must be hashable, and from the python doc, an object is hashable if it has the __hash__ and (__cmp__ or __eq__) methods.

Re: Any built-in ishashable method ?

2013-01-18 Thread Terry Reedy
On 1/18/2013 5:36 AM, Jean-Michel Pichavant wrote: Hello people, Is there any built-in way to know if an object is a valid dictionary key ? For the instances of a class to be properly useable as set members or dict keys, __eq__ must return bool, __hash__ must return int, the __eq__ and

Re: Any built-in ishashable method ?

2013-01-18 Thread Jean-Michel Pichavant
So I'm guessing you had a key where key1 == key2 did not imply hash(key1) == hash(key2) I don't see a way to avoid that problem in a look-before-you-leap test. -- http://mail.python.org/mailman/listinfo/python-list You guessed right. But it took me a lot of time before jumping to

Re: Any built-in ishashable method ?

2013-01-18 Thread Peter Otten
Jean-Michel Pichavant wrote: That brings me to another question, is there any valid test case where key1 != key2 and hash(key1) == hash(key2) ? Or is it some kind of design flaw ? I don't think there is a use case for such a behaviour other than annoying your collegues ;) --

Re: Any built-in ishashable method ?

2013-01-18 Thread Steven D'Aprano
On Fri, 18 Jan 2013 12:56:09 +0100, Jean-Michel Pichavant wrote: So I'm guessing you had a key where key1 == key2 did not imply hash(key1) == hash(key2) I don't see a way to avoid that problem in a look-before-you-leap test. -- http://mail.python.org/mailman/listinfo/python-list

Re: Any built-in ishashable method ?

2013-01-18 Thread Christian Heimes
Am 18.01.2013 12:56, schrieb Jean-Michel Pichavant: You guessed right. But it took me a lot of time before jumping to that conclusion, mostly because the code worked in the first place (it can with a little bit of luck). Now I'm extra careful about what I use as dict key, I was just

Re: Any built-in ishashable method ?

2013-01-18 Thread Terry Reedy
On 1/18/2013 6:56 AM, Jean-Michel Pichavant wrote: is there any valid test case You mean use case? where key1 != key2 and hash(key1) == hash(key2) ? This is the normal case. There are many unequal items that have the same hash. The point of using hash is to quickly find items in the

Re: Forcing Python to detect DocumentRoot

2013-01-18 Thread Ferrous Cranus
Τη Πέμπτη, 17 Ιανουαρίου 2013 5:14:19 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε: On Thu, Jan 17, 2013 at 9:09 AM, Roy Smith r...@panix.com wrote: In article 339d9d6d-b000-4cf3-8534-375e0c44b...@googlegroups.com,  Ferrous Cranus nikos...@gmail.com wrote: When trying to open an

Inconsistent behaviour of methods waiting for child process

2013-01-18 Thread Marcin Szewczyk
Hi, I've done some experiments with: 1) multiprocessing.Process.join() 2) os.waitpid() 3) subprocess.Popen.wait() These three methods behave completely different when interrupted with a signal which I find disturbing. Reactions are: 1) exit with no exception or special return code 2) OSError

Re: Forcing Python to detect DocumentRoot

2013-01-18 Thread Joel Goldstick
On Fri, Jan 18, 2013 at 8:02 AM, Ferrous Cranus nikos.gr...@gmail.comwrote: Τη Πέμπτη, 17 Ιανουαρίου 2013 5:14:19 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε: On Thu, Jan 17, 2013 at 9:09 AM, Roy Smith r...@panix.com wrote: In article 339d9d6d-b000-4cf3-8534-375e0c44b...@googlegroups.com,

Re: Forcing Python to detect DocumentRoot

2013-01-18 Thread Rodrick Brown
On Friday, January 18, 2013, Ferrous Cranus wrote: Τη Πέμπτη, 17 Ιανουαρίου 2013 5:14:19 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε: On Thu, Jan 17, 2013 at 9:09 AM, Roy Smith r...@panix.comjavascript:; wrote: In article

Re: Inconsistent behaviour of methods waiting for child process

2013-01-18 Thread Matt Jones
What version of python and os are you running? *Matt Jones* On Fri, Jan 18, 2013 at 6:04 AM, Marcin Szewczyk python-l...@wodny.orgwrote: Hi, I've done some experiments with: 1) multiprocessing.Process.join() 2) os.waitpid() 3) subprocess.Popen.wait() These three methods behave

Re: Any built-in ishashable method ?

2013-01-18 Thread Jean-Michel Pichavant
The flaw would be key1 == key2 and hash(key1) != hash(key2). Then the set/dict could store equal items multiple times in different places (unless it did a linear search of all members, which would make hashing pointless!). -- Terry Jan Reedy My understanding of a hash function was wrong

Re: Inconsistent behaviour of methods waiting for child process

2013-01-18 Thread Marcin Szewczyk
On Fri, Jan 18, 2013 at 08:10:03AM -0600, Matt Jones wrote: What version of python and os are you running? $ python --version Python 2.7.3rc2 $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description:Debian GNU/Linux 7.0 (wheezy) Release:7.0 Codename:

Re: Param decorator - can you suggest improvements

2013-01-18 Thread Dan Sommers
On Fri, 18 Jan 2013 09:10:34 +, Steven D'Aprano wrote: On Fri, 18 Jan 2013 03:38:08 +, Dan Sommers wrote: This, or something like this, is very old: sentinel = object() class Magic: def __init__(self, value): self.value = value def __call__(self, value=sentinel):

Beginner Tutorials

2013-01-18 Thread Rik
Hi, I've developed a website for beginners to Python. I'd appreciate any comments or criticism. It's still under development, and should be finished in the next few months. Oh, and it's free to use. www.usingpython.com -- http://mail.python.org/mailman/listinfo/python-list

RE: Vote tallying...

2013-01-18 Thread Nick Cash
I have a problem which may fit in a mysql database, but which I only have python as an alternate tool to solve... so I'd like to hear some opinions... Is there a reason you can't use an RDBMS for this? MySQL would certainly be fine, although I always recommend PostgreSQL over it. Based on the

Re: Beginner Tutorials

2013-01-18 Thread marco . kretz
Am Freitag, 18. Januar 2013 15:47:52 UTC+1 schrieb Rik: Hi, I've developed a website for beginners to Python. I'd appreciate any comments or criticism. It's still under development, and should be finished in the next few months. Oh, and it's free to use. www.usingpython.com Very nice

Re: Beginner Tutorials

2013-01-18 Thread Virgil Stokes
On 18-Jan-2013 15:47, Rik wrote: Hi, I've developed a website for beginners to Python. I'd appreciate any comments or criticism. It's still under development, and should be finished in the next few months. Oh, and it's free to use. www.usingpython.com You have done well Rik. I like your

Re: Beginner Tutorials

2013-01-18 Thread Joel Goldstick
On Fri, Jan 18, 2013 at 10:52 AM, Virgil Stokes v...@it.uu.se wrote: On 18-Jan-2013 15:47, Rik wrote: Hi, I've developed a website for beginners to Python. I'd appreciate any comments or criticism. It's still under development, and should be finished in the next few months. Oh, and it's free

Re: Beginner Tutorials

2013-01-18 Thread Ian Foote
On 18/01/13 14:47, Rik wrote: Hi, I've developed a website for beginners to Python. I'd appreciate any comments or criticism. It's still under development, and should be finished in the next few months. Oh, and it's free to use. www.usingpython.com Is there a particular reason you disable

Re: Beginner Tutorials

2013-01-18 Thread Ian Foote
On 18/01/13 14:47, Rik wrote: Hi, I've developed a website for beginners to Python. I'd appreciate any comments or criticism. It's still under development, and should be finished in the next few months. Oh, and it's free to use. www.usingpython.com Your example code on

Re: Beginner Tutorials

2013-01-18 Thread Rik
Thanks for the comments. I have changed the headings to lower case as you suggested. The site was created in wordpress using a standard theme, and linked pages rather than posts. i'd recommend using it to quickly set up a site; i started developing my own site but wanted to focus on site

Re: Beginner Tutorials

2013-01-18 Thread Rik
The reason for disabling right-click has nothing to do with protecting content, and everything to do with stopping my students from taking the lazy way out. Given the chance, they'll copy/paste the code and download the designs and edit them slightly. They'd get through the tutorials in about

Re: Beginner Tutorials

2013-01-18 Thread Rik
Well spotted! Your final print should be: print(Hello + name + !) Regards, Ian F -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner Tutorials

2013-01-18 Thread Ritchie Flick
Still a student myself and even if you really want to become good at what you're doing, some days one just feels lazy and in the mood for copy/pasting to get the job done quickly xD I like the site, will check it out ;) On Fri, Jan 18, 2013 at 6:34 PM, Joel Goldstick

Re: Forcing Python to detect DocumentRoot

2013-01-18 Thread Ferrous Cranus
Τη Παρασκευή, 18 Ιανουαρίου 2013 3:28:10 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε: DocumentRoot = os.environ['HOME'] + 'public_html' Yes, iam using this and it works. One last thing: my python script file is located at /home/nikos/public_html/addon_domain/cgi-bin/ How python is able to

Reinforced Concrete: Mechanics and Design (5th Ed., James G. MacGregor James K. Wight)

2013-01-18 Thread kalvinmanual1
I have solutions manuals to all problems and exercises in these textbooks. To get one in an electronic format contact me at: kalvinmanual(at)gmail(dot)com and let me know its title, author and edition. Please this service is NOT free. solutions manual :: Reinforced Concrete: Mechanics and

Re: Forcing Python to detect DocumentRoot

2013-01-18 Thread Joel Goldstick
On Fri, Jan 18, 2013 at 1:58 PM, Ferrous Cranus nikos.gr...@gmail.comwrote: Τη Παρασκευή, 18 Ιανουαρίου 2013 3:28:10 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε: DocumentRoot = os.environ['HOME'] + 'public_html' Yes, iam using this and it works. One last thing: my python script file is

Re: Vote tallying...

2013-01-18 Thread Kwpolska
On Fri, Jan 18, 2013 at 4:19 PM, Nick Cash nick.c...@npcinternational.com wrote: MySQL would certainly be fine, although I always recommend PostgreSQL over it. Bonus question, why? -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail| always bottom-post

Re: Vote tallying...

2013-01-18 Thread Ben Finney
Kwpolska kwpol...@gmail.com writes: On Fri, Jan 18, 2013 at 4:19 PM, Nick Cash nick.c...@npcinternational.com wrote: MySQL would certainly be fine, although I always recommend PostgreSQL over it. Bonus question, why? The PostgreSQL community gets asked this question so often that they

Uniquely identifying each every html template

2013-01-18 Thread Ferrous Cranus
I use this .htaccess file to rewrite every .html request to counter.py # = RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^/?(.+\.html)

Re: Forcing Python to detect DocumentRoot

2013-01-18 Thread Ferrous Cranus
Yes, iam using this and it works. One last thing: my python script file is located at /home/nikos/public_html/addon_domain/cgi-bin/ How python is able to run the following statement? f = open( '/home/nikos/public_html/' + page ) which is clearly levels up of addon domain's DocumentRoot?

Re: Vote tallying...

2013-01-18 Thread Tim Chase
On 01/18/13 13:26, Kwpolska wrote: On Fri, Jan 18, 2013 at 4:19 PM, Nick Cash wrote: MySQL would certainly be fine, although I always recommend PostgreSQL over it. Bonus question, why? I write only from my personal experience, but the following might be reasons that Nick recommends

Re: Uniquely identifying each every html template

2013-01-18 Thread John Gordon
In 8deb6f5d-ff10-4b36-bdd6-36f9eed58...@googlegroups.com Ferrous Cranus nikos.gr...@gmail.com writes: Problem is that i have to insert at the very first line of every .html template of mine, a unique string containing a number like: index.html !-- 1 -- somefile.html !-- 2--

Re: Forcing Python to detect DocumentRoot

2013-01-18 Thread Chris Angelico
On Sat, Jan 19, 2013 at 5:58 AM, Ferrous Cranus nikos.gr...@gmail.com wrote: Τη Παρασκευή, 18 Ιανουαρίου 2013 3:28:10 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε: DocumentRoot = os.environ['HOME'] + 'public_html' Yes, iam using this and it works. One last thing: my python script file is

Re: Vote tallying...

2013-01-18 Thread Andrew Robinson
On 01/18/2013 08:47 AM, Stefan Behnel wrote: Andrew Robinson, 18.01.2013 00:59: I have a problem which may fit in a mysql database Everything fits in a MySQL database - not a reason to use it, though. Py2.5 and later ship with sqlite3 and if you go for an external database, why use MySQL if

Re: Vote tallying...

2013-01-18 Thread Chris Angelico
On Sat, Jan 19, 2013 at 7:24 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: * MySQL's development has suffered under Sun, and become virtually moribund under Oracle. They operate as a closed shop, occasionally tossing GPL-licensed releases over the wall, with very little input accepted

Re: Uniquely identifying each every html template

2013-01-18 Thread Dave Angel
On 01/18/2013 03:48 PM, Ferrous Cranus wrote: I use this .htaccess file to rewrite every .html request to counter.py # = RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f

Re: Uniquely identifying each every html template

2013-01-18 Thread Ferrous Cranus
Τη Παρασκευή, 18 Ιανουαρίου 2013 10:59:17 μ.μ. UTC+2, ο χρήστης John Gordon έγραψε: Instead of inserting unique content in every page, can't you use the document path itself as the identifier? No, i cannot, becaue it would mess things at later time when i for example: 1. mv name.html

Re: Vote tallying...

2013-01-18 Thread Zero Piraeus
: On 18 January 2013 16:57, Tim Chase python.l...@tim.thechases.com wrote: - there are just some serious what-the-heck's in MySQL's handling of some edge cases regarding NULL values and dates (Feb 31st anybody). There's a good compilation of them at [1]. [1]

Re: PyWart: Exception error paths far too verbose

2013-01-18 Thread Rick Johnson
On Wednesday, January 16, 2013 6:51:31 PM UTC-6, Terry Reedy wrote: I missed in your original post that you only want one consistent personal library path abbreviated, leaving everything else alone. So the above is not applicable. And a custom excepthook very easy. How should the traceback

Re: Vote tallying...

2013-01-18 Thread Kushal Kumaran
Chris Angelico ros...@gmail.com writes: On Sat, Jan 19, 2013 at 7:24 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: * MySQL's development has suffered under Sun, and become virtually moribund under Oracle. They operate as a closed shop, occasionally tossing GPL-licensed releases over

Re: Beginner Tutorials

2013-01-18 Thread Rick Johnson
On Friday, January 18, 2013 11:04:39 AM UTC-6, Rik wrote: The reason for disabling right-click has nothing to do with protecting content, and everything to do with stopping my students from taking the lazy way out. Given the chance, they'll copy/paste the code and download the designs and

Re: Reinforced Concrete: Mechanics and Design (5th Ed., James G. MacGregor James K. Wight)

2013-01-18 Thread Roy Smith
Can whoever manages the mailing list block this bozo? In article db2dnygmdpv4agtnnz2dnuvz_o-dn...@giganews.com, kalvinmanual1 kalvinmanu...@gmail.com wrote: I have solutions manuals to all problems and exercises in these textbooks. To get one in an electronic format contact me at:

Re: Any built-in ishashable method ?

2013-01-18 Thread Kushal Kumaran
Peter Otten __pete...@web.de writes: Jean-Michel Pichavant wrote: That brings me to another question, is there any valid test case where key1 != key2 and hash(key1) == hash(key2) ? Or is it some kind of design flaw ? I don't think there is a use case for such a behaviour other than

Re: Vote tallying...

2013-01-18 Thread Chris Angelico
On Sat, Jan 19, 2013 at 12:25 PM, Kushal Kumaran kushal.kumaran+pyt...@gmail.com wrote: Chris Angelico ros...@gmail.com writes: On Sat, Jan 19, 2013 at 7:24 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: * MySQL's development has suffered under Sun, and become virtually moribund under

Re: Safely add a key to a dict only if it does not already exist?

2013-01-18 Thread Chris Rebert
On Friday, January 18, 2013, Steven D'Aprano wrote: I wish to add a key to a dict only if it doesn't already exist, but do it in a thread-safe manner. The naive code is: if key not in dict: dict[key] = value but of course there is a race condition there: it is possible that another

Re: Beginner Tutorials

2013-01-18 Thread Evan Driscoll
On 1/18/2013 7:25 PM, Rick Johnson wrote: Well anyone who is just blindly copying code to get through a CS course is obviously not a natural problem solver ,and thus, /incapable/ of becoming a proficient programmer anyhow. Programming *IS* problem solving. If you don't get any thrill from the

Question related to multiprocessing.Process

2013-01-18 Thread Cen Wang
Hi, when I use multiprocessing.Process in this way: from multiprocessing import Process class MyProcess(Process): def __init__(self): Process.__init__(self) def run(self): print 'x' p = MyProcess() p.start() It just keeps printing 'x' on my command prompt and

Re: Safely add a key to a dict only if it does not already exist?

2013-01-18 Thread Lie Ryan
On 19/01/13 15:15, Chris Rebert wrote: On Friday, January 18, 2013, Steven D'Aprano wrote: I wish to add a key to a dict only if it doesn't already exist, but do it in a thread-safe manner. The naive code is: if key not in dict: dict[key] = value but of

Re: Question related to multiprocessing.Process

2013-01-18 Thread Chris Angelico
On Sat, Jan 19, 2013 at 3:50 PM, Cen Wang iwarob...@gmail.com wrote: Hi, when I use multiprocessing.Process in this way: from multiprocessing import Process class MyProcess(Process): def __init__(self): Process.__init__(self) def run(self): print 'x' p =

Re: Question related to multiprocessing.Process

2013-01-18 Thread Cen Wang
Thanks! It now works! On Saturday, 19 January 2013 13:05:07 UTC+8, Chris Angelico wrote: On Sat, Jan 19, 2013 at 3:50 PM, Cen Wang iwarob...@gmail.com wrote: Hi, when I use multiprocessing.Process in this way: from multiprocessing import Process class MyProcess(Process):

Re: problems trying to build python 2.6 as a shared library

2013-01-18 Thread scubbojj
On Friday, 25 September 2009 04:36:28 UTC-7, Marco Nawijn wrote: On Sep 25, 1:08 pm, Chris Withers ch...@simplistix.co.uk wrote: Hi All, I'm trying to build Python 2.6 as a shared library, so I did:    ./configure --enable-shared    make    make altinstall No obvious signs of

Re: Reinforced Concrete: Mechanics and Design (5th Ed., James G. MacGregor James K. Wight)

2013-01-18 Thread Robert Miles
On 1/18/2013 7:32 PM, Roy Smith wrote: Can whoever manages the mailing list block this bozo? In article db2dnygmdpv4agtnnz2dnuvz_o-dn...@giganews.com, kalvinmanual1 kalvinmanu...@gmail.com wrote: I have solutions manuals to all problems and exercises in these textbooks. To get one in an

Re: Beginner Tutorials

2013-01-18 Thread Rick Johnson
On Friday, January 18, 2013 10:36:09 PM UTC-6, Evan Driscoll wrote: I have only skimmed this thread and so am unsure exactly what is being protected against casual copy/paste, but at least on its face I would *vehemently* disagree with your statement. Well if you skim just a wee bit more you

Re: Vote tallying...

2013-01-18 Thread Stefan Behnel
Chris Angelico, 19.01.2013 03:00: On Sat, Jan 19, 2013 at 12:25 PM, Kushal Kumaran wrote: Chris Angelico writes: On Sat, Jan 19, 2013 at 7:24 AM, Ben Finney wrote: * MySQL's development has suffered under Sun, and become virtually moribund under Oracle. They operate as a closed shop,

Re: Safely add a key to a dict only if it does not already exist?

2013-01-18 Thread Vito De Tullio
Steven D'Aprano wrote: I wish to add a key to a dict only if it doesn't already exist, but do it in a thread-safe manner. The naive code is: if key not in dict: dict[key] = value but of course there is a race condition there: it is possible that another thread may have added

Re: Safely add a key to a dict only if it does not already exist?

2013-01-18 Thread Vito De Tullio
Chris Rebert wrote: How can I add a key in a thread-safe manner? I'm not entirely sure, but have you investigated dict.setdefault() ? but how setdefault makes sense in this context? It's used to set a default value when you try to retrieve an element from the dict, not when you try to set a

Re: Safely add a key to a dict only if it does not already exist?

2013-01-18 Thread Mitya Sirenef
On 01/19/2013 02:27 AM, Vito De Tullio wrote: Chris Rebert wrote: How can I add a key in a thread-safe manner? I'm not entirely sure, but have you investigated dict.setdefault() ? but how setdefault makes sense in this context? It's used to set a default value when you try to retrieve an

Sending a broadcast message using raw sockets

2013-01-18 Thread Peter Steele
I want to write a program in Python that sends a broadcast message using raw sockets. The system where this program will run has no IP or default route defined, hence the reason I need to use a broadcast message. I've done some searches and found some bits and pieces about using raw sockets in

Re: Any built-in ishashable method ?

2013-01-18 Thread Peter Otten
Kushal Kumaran wrote: Peter Otten __pete...@web.de writes: Jean-Michel Pichavant wrote: That brings me to another question, is there any valid test case where key1 != key2 and hash(key1) == hash(key2) ? Or is it some kind of design flaw ? I don't think there is a use case for such a

[issue16991] Add OrderedDict written in C

2013-01-18 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___ ___

[issue16970] argparse: bad nargs value raises misleading message

2013-01-18 Thread Chris Jerdonek
Chris Jerdonek added the comment: I added some Rietveld comments. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16970 ___ ___ Python-bugs-list

[issue16993] shutil.which() should preserve path case

2013-01-18 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Now which lowercase found directory name and extension on Windows. shutil.which(python) 'c:\\python33\\python.exe' Proposed patch preserve case. shutil.which(python) 'C:\\Python33\\python.exe' Please test this on Windows. -- messages: 180181

[issue16993] shutil.which() should preserve path case

2013-01-18 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- components: +Library (Lib), Windows stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16993 ___

[issue11729] libffi assembler relocation check is not robust, fails with clang

2013-01-18 Thread koobs
koobs added the comment: Stefan, can we merge this to the 2.7 branch as well please? http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%20dtrace%2Bclang%202.7/builds/308/steps/compile/logs/stdio -- nosy: +koobs ___ Python tracker

[issue16939] Broken link in 14. Cryptographic Service

2013-01-18 Thread Chris Jerdonek
Chris Jerdonek added the comment: This was fixed a year and a half ago by issue 12351. For example, see: http://docs.python.org/3/library/crypto.html -- nosy: +chris.jerdonek resolution: - out of date stage: - committed/rejected status: open - closed superseder: - Update URL for

[issue11729] libffi assembler relocation check is not robust, fails with clang

2013-01-18 Thread Stefan Krah
Stefan Krah added the comment: koobs rep...@bugs.python.org wrote: Stefan, can we merge this to the 2.7 branch as well please? If Benjamin is okay with it, yes. The problem with these configure fixes is that they might break other systems in unexpected ways. I already hesitated to put it into

[issue11729] libffi assembler relocation check is not robust, fails with clang

2013-01-18 Thread koobs
koobs added the comment: Thanks for the quick response. I'd be happy for it to be FreeBSD conditional/specific if that's more suitable, safer? Having said that, our buildbot OS coverage is pretty good, no? -- ___ Python tracker

[issue7563] yield in except clause causes exception context to be lost

2013-01-18 Thread Adam Bielański
Changes by Adam Bielański abg...@gmail.com: -- nosy: +Adam.Bielański ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7563 ___ ___ Python-bugs-list

[issue16468] argparse only supports iterable choices

2013-01-18 Thread Terry J. Reedy
Terry J. Reedy added the comment: If you can somewhat solve the problem by better using the existing api, good. I am not 'stuck' on reusing str/repr*. If metavar is non-optional for non-iterable choices, the doc should say so in the entry for choices. (Does the test suite already have a

[issue16977] argparse: mismatch between choices parsing and usage/error message

2013-01-18 Thread Chris Jerdonek
Chris Jerdonek added the comment: There are also test cases with a string being passed for choices. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16977 ___

[issue16957] shutil.which() shouldn't look in working directory on unix-y systems

2013-01-18 Thread Thomas Kluyver
Thomas Kluyver added the comment: That makes sense - foo/setup.py can be run from the working directory, but you can't refer to subdirectories on $PATH like that. I've added a revised version of the patch. -- Added file: http://bugs.python.org/file28763/shutil_which_cwd2.patch

[issue16994] collections.Counter.least_common

2013-01-18 Thread David Coallier
New submission from David Coallier: The `collections.Counter` library contains very useful methods for playing with dicts and sets (mainly the most_common()) function. Even though it is fairly trivial to retrieve the least common elements in a Counter() by doing

[issue16994] collections.Counter.least_common

2013-01-18 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16994 ___ ___ Python-bugs-list

[issue14255] tempfile.gettempdir() didn't return the path with correct case.

2013-01-18 Thread Takayuki SHIMIZUKAWA
Takayuki SHIMIZUKAWA added the comment: I think that moving to 'normpath' instead of 'normcase' Official manual says 'abspath' include 'normpath' functionality. I think it is need JUST remove '_os.path.normcase' calling. But, I do not understand the circumstances which use 'normcase'.

[issue16468] argparse only supports iterable choices

2013-01-18 Thread Chris Jerdonek
Chris Jerdonek added the comment: Here is a patch for discussion that allows non-iterable choices with or without metavar. It refactors as suggested. However, the patch does not yet have tests. Does the test suite already have a testcase already for non-iterable choices + metavar? No,

[issue10115] Support accept4() for atomic setting of flags at socket creation

2013-01-18 Thread STINNER Victor
STINNER Victor added the comment: My implementation of the PEP 433 uses accept4() for socket.accept() if the (new) cloexec parameter is True: http://hg.python.org/features/pep-433/file/46b7a077ae87/Modules/socketmodule.c#l1961 The code fallbacks to accept() if accept4() fails with ENOSYS. It

[issue16969] test_urlwithfrag fail

2013-01-18 Thread Ezio Melotti
Ezio Melotti added the comment: This has been fixed already in 652286ee23f8, but apparently the fix is not included in 3.3.0. I think it's safe to ignore the failure. In the first message you said that this prevents correct installation. What did you mean exactly? -- type: behavior

[issue16970] argparse: bad nargs value raises misleading message

2013-01-18 Thread Robert Leenders
Robert Leenders added the comment: Chris, you said (in the review) Hmm, since this is for maintenance releases ... This change could cause working code to no longer work. I understood from our original message that you wanted it to change since it is inconsistent. I vote for changing it (so

[issue16970] argparse: bad nargs value raises misleading message

2013-01-18 Thread Robert Leenders
Changes by Robert Leenders robertleender...@gmail.com: Removed file: http://bugs.python.org/file28766/argparse-v2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16970 ___

[issue16970] argparse: bad nargs value raises misleading message

2013-01-18 Thread Robert Leenders
Changes by Robert Leenders robertleender...@gmail.com: Added file: http://bugs.python.org/file28767/argparse-v2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16970 ___

[issue16988] argparse: PARSER option for nargs not documented

2013-01-18 Thread Jeff Knupp
Jeff Knupp added the comment: This is not a bug. The 'PARSER' nargs choice is an implementation detail as a way to handle subparsers. The parser needs to know that the first value should be handled, but everything that follows will be handled by the subparser. By using a subparser, you're

[issue16774] Additional recipes for itertools docs

2013-01-18 Thread Alexey Kachayev
Alexey Kachayev added the comment: Updated patch with: * fix error in islice function name * made n=None default second argument for consume(iterator, n=None) cause it provides specific behavior when n is None which can be assumed as default for function -- Added file:

[issue16977] argparse: mismatch between choices parsing and usage/error message

2013-01-18 Thread Jeff Knupp
Jeff Knupp added the comment: Attached a patch. Rather than altering choices or making a special check for string instances, I just changed the if statement to if action.choices is not None and value not in list(action.choices): from if action.choices is not None and value not in

[issue16953] select module compile errors with broken poll()

2013-01-18 Thread Charles-François Natali
Charles-François Natali added the comment: Could you provide the patch? It's trivial, but at least we'll make sure the patch fixes the problem on your platform. -- nosy: +neologix ___ Python tracker rep...@bugs.python.org

[issue16957] shutil.which() shouldn't look in working directory on unix-y systems

2013-01-18 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo stage: - patch review versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16957 ___

[issue16957] shutil.which() shouldn't look in working directory on unix-y systems

2013-01-18 Thread Éric Araujo
Éric Araujo added the comment: I assume that ./script is working just like dir/script (what the tests exercize is not crystal clear to me). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16957

[issue16978] fix grammar in 'threading' documentation

2013-01-18 Thread Roundup Robot
Roundup Robot added the comment: New changeset 8886d7ca159b by Ezio Melotti in branch '2.7': #16978: rephrase sentence and fix typo. Initial patch by Tshepang Lekhonkhobe. http://hg.python.org/cpython/rev/8886d7ca159b New changeset 4a1a88d25fec by Ezio Melotti in branch '3.2': #16978: rephrase

[issue16978] fix grammar in 'threading' documentation

2013-01-18 Thread Ezio Melotti
Ezio Melotti added the comment: Fixed, thanks for the report and the patch! -- assignee: docs@python - ezio.melotti nosy: +ezio.melotti resolution: - fixed stage: - committed/rejected status: open - closed versions: +Python 3.2, Python 3.3, Python 3.4

  1   2   >