PyCon DE 2011 - Call for Papers

2011-05-20 Thread Mike Müller
This is the call for papers for the first PyCon DE in October 2011 in Leipzig. Please have a look at the website http://de.pycon.org for more information about the conference. Since the conference language will be German, the call is in German too. Vortragsvorschläge für die PyCon DE 2011 in

Re: Faster Recursive Fibonacci Numbers

2011-05-20 Thread Steven D'Aprano
On Fri, 20 May 2011 09:37:59 +1000, Chris Angelico wrote: On Fri, May 20, 2011 at 8:47 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 17 May 2011 10:02:21 -0700, geremy condra wrote: or O(1): φ = (1 + sqrt(5)) / 2     numerator = (φ**n) - (1 - φ)**n I'd just

Re: Faster Recursive Fibonacci Numbers

2011-05-20 Thread Chris Angelico
On Fri, May 20, 2011 at 3:58 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: ... until you deleted most of it :) Minimalist quoting practice! :) If you want an *accurate* fib() function using exponentiation of φ, you need arbitrary precision non-integers. I believe the 'bc'

Re: obviscating python code for distribution

2011-05-20 Thread harrismh777
geremy condra wrote: Anonymous, Maximum Linux Security: A Hacker's Guide to Protecting Your Linux Server and Workstation, Indianapolis: Sams Publishing, 2000. This is a good volume, but very dated. I'd probably pass on it. Actually, although dated, its still a very good

Re: Faster Recursive Fibonacci Numbers

2011-05-20 Thread harrismh777
Chris Angelico wrote: I believe the 'bc' command-line calculator can do a-p non-i, and I know REXX can Yes, bc is wonderful in this regard. Actually, bc does this sort of thing in 'circles' around Python. This is one of Python's weaknesses for some problem solving... no arbitrary precision.

Problem running pylons webtests. ImportError and TestController is not defined error.

2011-05-20 Thread SONAL ...
I have directory structure as gnukhata/tests/functional. In functional folder I have web tests files. Following is the sample tests: *from gnukhata.tests import * class TestVendorController(TestController): def test_index(self): response = self.app.get(url(controller='vendor',

Re: hash values and equality

2011-05-20 Thread Peter Otten
Ethan Furman wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ I'm hoping somebody can tell me what horrible thing will happen if this isn't the case? Here's a toy

Re: hash values and equality

2011-05-20 Thread Chris Rebert
On Thu, May 19, 2011 at 10:43 PM, Ethan Furman et...@stoneleaf.us wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ I'm hoping somebody can tell me what horrible thing

Re: Faster Recursive Fibonacci Numbers

2011-05-20 Thread Chris Angelico
On Fri, May 20, 2011 at 4:26 PM, harrismh777 harrismh...@charter.net wrote: Actually, it should be relatively easy to incorporate parts of bc into Python as C extensions. On the other hand, when needing specialized math work from bc, its probably just better to use bc and leave Python alone.

Re: Inheriting Object

2011-05-20 Thread Ian Kelly
On Thu, May 19, 2011 at 10:11 PM, Navkirat Singh n4vpyt...@gmail.com wrote: Thanks Guys...I will look deeper into this. I thought I read somewhere that it was required in older python releases, but in newer releases it is not. I might be wrong though. In Python 3.x all classes inherit from

Re: English Idiom in Unix: Directory Recursively

2011-05-20 Thread Roland Hutchinson
On Wed, 18 May 2011 07:19:08 +0200, Pascal J. Bourguignon wrote: Roland Hutchinson my.spamt...@verizon.net writes: Sorry to have to contradict you, Don't be sorry. but it really is a textbook example of recursion. Try this psuedo-code on for size: FUNCTION DIR-DELETE (directory)

Re: English Idiom in Unix: Directory Recursively

2011-05-20 Thread Steven D'Aprano
On Thu, 19 May 2011 22:13:14 -0700, rusi wrote: [I agree with you Xah that recursion is a technical word that should not be foisted onto lay users.] I think that is a patronizing remark that under-estimates the intelligence of lay people and over-estimates the difficulty of understanding

Re: obviscating python code for distribution

2011-05-20 Thread Steven D'Aprano
On Fri, 20 May 2011 05:48:50 +0100, Hans Georg Schaathun wrote: Either way, the assumption that your system will not be handled by idiots is only reasonable if you yourself is the only user. Nonsense. How do you (generic you, not any specific person) know that you are not an idiot? If you

Re: English Idiom in Unix: Directory Recursively

2011-05-20 Thread Jonathan de Boyne Pollard
〈English Idiom in Unix: Directory Recursively〉 http://xahlee.org/comp/idiom_directory_recursively.html -- English Idiom in Unix: Directory Recursively Xah Lee, 2011-05-17 Today, let's discuss something in the category of lingustics. You know how in unix

embedding and extending on windows

2011-05-20 Thread rusi
A client wants to 'be lectured' on extending and embedding python on windows. I am familiar with this (or was until python2.3 or thereabouts) on linux -- never done it on windows. Can some kind soul point me to some link on the issues/pitfalls re this? I see three choices: 1. Us MS C for the C

Re: English Idiom in Unix: Directory Recursively

2011-05-20 Thread Jonathan de Boyne Pollard
AFAICS what emacs calls recursive delete is what the ordinary person would simply call delete. Presumably the non-recursive delete is called simply delete but is actually something more complicated than delete, and you're supposed to know what that is. The non-recursive delete would be simply

Re: English Idiom in Unix: Directory Recursively

2011-05-20 Thread Chris Angelico
On Wed, 18 May 2011 12:59:45 -0500, Victor Eijkhout wrote: Recursion: (N). See recursion. See also tail recursion. caching proxy (n): If you already know what recursion is, this is the same. Otherwise, see recursion. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: obviscating python code for distribution

2011-05-20 Thread Steven D'Aprano
On Thu, 19 May 2011 17:56:12 -0700, geremy condra wrote: TL;DR version: large systems have indeed been verified for their security properties. How confident are we that the verification software is sufficiently bug- free that we should trust their results? How confident are we that the

Re: hash values and equality

2011-05-20 Thread Ulrich Eckhardt
Ethan Furman wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ I'm hoping somebody can tell me what horrible thing will happen if this isn't the case? If you were

Re: Faster Recursive Fibonacci Numbers

2011-05-20 Thread Ian Kelly
On Thu, May 19, 2011 at 11:58 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Sure, which is why the above fib() function will become increasing inaccurate beyond some given n, by memory about n=71 or so. Er, at least the fib() function that *was* above until you deleted most of

Re: Faster Recursive Fibonacci Numbers

2011-05-20 Thread Ian Kelly
2011/5/20 Ian Kelly ian.g.ke...@gmail.com: def fib_decimal(n):    with localcontext() as ctx:        ctx.prec = n // 4 + 1        sqrt_5 = Decimal('5').sqrt()        phi = (1 + sqrt_5) / 2        numerator = (phi ** n) - (1 - phi) ** n        return int((numerator /

Re: connect SIGINT to custom interrupt handler

2011-05-20 Thread Thomas 'PointedEars' Lahn
Christoph Scheingraber wrote: On 2011-05-15, Thomas 'PointedEars' Lahn pointede...@web.de wrote: Obviously. `signal' refers to an `int' object, probably by something like signal = 42 before. E.g. `print' or a debugger will tell you, as you have not showed the relevant parts of the

Re: English Idiom in Unix: Directory Recursively

2011-05-20 Thread Jonathan de Boyne Pollard
I think what happens is that the “recursive” has become a idiom associated with directory to such a degree that the unix people don't know what the fuck they are talking about. They just simply use the word to go with directory whever they mean the whole directory. In the emacs case:

Re: os.access giving incorrect results on Windows

2011-05-20 Thread Tim Golden
On 19/05/2011 21:40, Andrew Berg wrote: On 2011.05.19 03:08 PM, Tim Golden wrote: * A R_OK check always succeeds if the file's attributes can be read at all So is this the same as F_OK then, or does it return false if the user isn't allowed to read permissions? * A W_OK check fails if the

Re: os.access giving incorrect results on Windows

2011-05-20 Thread Tim Golden
On 20/05/2011 09:21, Tim Golden wrote: [... re os.access on Windows ...] (Sorry; just got back to this this morning). I might raise this on python-dev. If you want to follow, my post is here: http://mail.python.org/pipermail/python-dev/2011-May/111530.html TJG --

Re: English Idiom in Unix: Directory Recursively

2011-05-20 Thread Hans Georg Schaathun
On 20 May 2011 06:55:35 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : On Thu, 19 May 2011 22:13:14 -0700, rusi wrote: : : [I agree with you Xah that recursion is a technical word that should not : be foisted onto lay users.] : : I think that is a patronizing remark

Re: obviscating python code for distribution

2011-05-20 Thread Hans Georg Schaathun
On 20 May 2011 07:04:27 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : On Fri, 20 May 2011 05:48:50 +0100, Hans Georg Schaathun wrote: : : Either way, the assumption that your system will not be handled by : idiots is only reasonable if you yourself is the only user. : :

Re: English Idiom in Unix: Directory Recursively

2011-05-20 Thread Antti J Ylikoski
On 20.5.2011 3:38, Pascal J. Bourguignon wrote: t...@sevak.isi.edu (Thomas A. Russ) writes: Pascal J. Bourguignonp...@informatimago.com writes: t...@sevak.isi.edu (Thomas A. Russ) writes: This will only work if there is a backpointer to the parent. No, you don't need backpointers; some

Re: obviscating python code for distribution

2011-05-20 Thread Disc Magnet
On Mon, May 16, 2011 at 9:06 AM, Littlefield, Tyler ty...@tysdomain.com wrote: I'm putting lots of work into this. I would rather not have some script kiddy dig through it, yank out chunks and do whatever he wants. I just want to distribute the program as-is, not distribute it and leave it open

RE: starting a separate thread in maya

2011-05-20 Thread Andreas Tawn
Hi, I'm using python2.5 in maya 2009 x64 (in linux). For Maya/Python stuff you'll probably have more success at http://www.tech-artists.org/ Cheers, Drea -- http://mail.python.org/mailman/listinfo/python-list

Re: turn monitor off and on

2011-05-20 Thread Jack Krieger
def turnOffMonitor(): SC_MONITORPOWER = 0xF170 win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, SC_MONITORPOWER, 2) This code does not return control to you, so programm still locked. In my opinion it due broadcasting message. But I do not know how to send message to

Re: turn monitor off and on

2011-05-20 Thread Leotis buchanan
@Astan If you really want to turn your monitor on and off, you should probably try pyserial are pyparrallel(http://pyserial.sourceforge.net/pyparallel.html), along with a solid state relay. That worked for me on linux not sure about windowXP,but it should work. On Sat, May 14, 2011 at 1:08 AM,

Re: Faster Recursive Fibonacci Numbers

2011-05-20 Thread SigmundV
There is a nice matrix representation of consecutive Fibonacci numbers: [[1, 1], [1, 0]] ** n = [[F_n+1, F_n], [F_n, F_n-1]]. Using the third party mpmath module, which uses arbitrary precision floating point arithmetic, we can calculate the n'th Fibonacci number for an arbitrary n as follows:

Re: os.access giving incorrect results on Windows

2011-05-20 Thread Ayaskanta Swain
Hi Tim, Thanks for the reply and suggestions. I followed the patch provided by you in issue 2528, but the code looks very tricky to me. Anyways I wrote my Test.py script tried only the def test_access_w(self): test case which is defined under class FileTests(unittest.TestCase) by providing my

Python sets which support multiple same elements

2011-05-20 Thread ErichCart ErichCart
Many times when I am writing some program in python, I notice that I could transform my list into set, then use the set methods like union, intersection, set equality etc. , and it will solve my problem easily. But then I realize that if I transform my list into set, it will remove duplicates of

Re: Python sets which support multiple same elements

2011-05-20 Thread Shunichi Wakabayashi
Many times when I am writing some program in python, I notice that I could transform my list into set, then use the set methods like union, intersection, set equality etc. , and it will solve my problem easily. But then I realize that if I transform my list into set, it will remove duplicates

RE: Python sets which support multiple same elements

2011-05-20 Thread Andreas Tawn
For example, I was writing a program to detect whether two strings are anagrams of each other. I had to write it like this: def isAnagram(w1, w2): w2=list(w2) for c in w1: if c not in w2: return False else: w2.remove(c) return True But if there was a data

Re: Python sets which support multiple same elements

2011-05-20 Thread Chris Angelico
On Fri, May 20, 2011 at 9:37 PM, ErichCart ErichCart erichc...@gmail.com wrote: For example, I was writing a program to detect whether two strings are anagrams of each other. I had to write it like this: def isAnagram(w1, w2):  w2=list(w2)  for c in w1:    if c not in w2:      return False

Re: Python sets which support multiple same elements

2011-05-20 Thread ErichCart ErichCart
I see! How could I overlook sorting )) It seems that collections.Counter is what I was talking about. It seems to support all the set operations. Also I realized that the data structure which i was describing is called miltiset, and collections.Counter is python implementation of multiset. --

Re: how to get PID from subprocess library

2011-05-20 Thread TheSaint
Miki Tebeka wrote: The best module for doing such things is subprocess. And the Popen object has a pid attribute I knew that, it's my fault that I'm not good to manage with popen. I found simplier to use subprocess.getstatusoutput. Maybe this function doesn't return the child pid, so I

Re: hash values and equality

2011-05-20 Thread MRAB
On 20/05/2011 07:33, Ulrich Eckhardt wrote: Ethan Furman wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ I'm hoping somebody can tell me what horrible thing will

Re: hash values and equality

2011-05-20 Thread Chris Angelico
On Sat, May 21, 2011 at 1:50 AM, MRAB pyt...@mrabarnett.plus.com wrote: [snip] Is this strictly true? I thought that the hash value, an integer, is moduloed (Is that how you spell it? Looks weird!) with the number of array elements to give an index into the array, so different hashes could

Re: obviscating python code for distribution

2011-05-20 Thread geremy condra
On Fri, May 20, 2011 at 12:10 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 19 May 2011 17:56:12 -0700, geremy condra wrote: TL;DR version: large systems have indeed been verified for their security properties. How confident are we that the verification software is

Re: hash values and equality

2011-05-20 Thread Chris Kaynor
On Fri, May 20, 2011 at 9:20 AM, Chris Angelico ros...@gmail.com wrote: On Sat, May 21, 2011 at 1:50 AM, MRAB pyt...@mrabarnett.plus.com wrote: [snip] Is this strictly true? I thought that the hash value, an integer, is moduloed (Is that how you spell it? Looks weird!) with the number of

Why did Quora choose Python for its development?

2011-05-20 Thread Beliavsky
I thought this essay on why one startup chose Python was interesting. http://www.quora.com/Why-did-Quora-choose-Python-for-its-development PHP was out of the question. Facebook is stuck on that for legacy reasons, not because it's the best choice right now.[1] Our main takeaway from that

Re: Faster Recursive Fibonacci Numbers

2011-05-20 Thread Steven D'Aprano
On Fri, 20 May 2011 16:54:06 +1000, Chris Angelico wrote: If someone has time to kill (as if!), it'd be awesome to get a new numeric type that uses bc's code; any other numeric type (int, long, float) could autopromote to it, removing the dilemma of which to promote out of long and float.

Re: English Idiom in Unix: Directory Recursively

2011-05-20 Thread rusi
On May 20, 1:48 pm, Hans Georg Schaathun h...@schaathun.net wrote: On 20 May 2011 06:55:35 GMT, Steven D'Aprano  steve+comp.lang.pyt...@pearwood.info wrote: :  On Thu, 19 May 2011 22:13:14 -0700, rusi wrote: : : [I agree with you Xah that recursion is a technical word that should not :

Re: hash values and equality

2011-05-20 Thread Ethan Furman
Chris Rebert wrote: On Thu, May 19, 2011 at 10:43 PM, Ethan Furman et...@stoneleaf.us wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ I'm hoping somebody can tell me

Re: hash values and equality

2011-05-20 Thread Ethan Furman
Peter Otten wrote: Ethan Furman wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ I'm hoping somebody can tell me what horrible thing will happen if this isn't the

Re: obviscating python code for distribution

2011-05-20 Thread Nobody
On Fri, 20 May 2011 07:10:45 +, Steven D'Aprano wrote: How confident are we that the verification software tests every possible vulnerability, Formal verification is based upon mathematical proof, not empirical results. As Dijkstra said: Program testing can be used to show the presence

List of WindowsError error codes and meanings

2011-05-20 Thread Andrew Berg
This is probably somewhat off-topic, but where would I find a list of what each error code in WindowsError means? WindowsError is so broad that it could be difficult to decide what to do in an except clause. Fortunately, sys.exc_info()[1][0] holds the specific error code, so I could put in an

Re: hash values and equality

2011-05-20 Thread Ian Kelly
On Fri, May 20, 2011 at 10:36 AM, Chris Kaynor ckay...@zindagigames.com wrote: I think the question was: can this dummy code ever produce a set containing less then itemCount items (for 0 itemCount 2**32)? In CPython, no. Even when you get a hash collision, the code checks to see whether the

Re: English Idiom in Unix: Directory Recursively

2011-05-20 Thread GSO
On 20 May 2011 18:21, rusi rustompm...@gmail.com wrote: On May 20, 1:48 pm, Hans Georg Schaathun h...@schaathun.net wrote: On 20 May 2011 06:55:35 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : On Thu, 19 May 2011 22:13:14 -0700, rusi wrote: : : [I agree with

TK program problem

2011-05-20 Thread bvdp
I've just done an update to my system here to Ubuntu 11.04. Mostly no problems ... but I have an important (to me) python/TK program that's stopped working. Well, it works ... mostly. The python version is 2.7.1+ (no idea what the + means!). I _think_ I have traced the problem to certain menus

Re: hash values and equality

2011-05-20 Thread Ethan Furman
Ulrich Eckhardt wrote: Ethan Furman wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ I'm hoping somebody can tell me what horrible thing will happen if this isn't the

maybe useful : datetime conversion

2011-05-20 Thread Stef Mientki
hello, using datetimes from a lot of different sources, in many languages, I had about 30 python helper routines, which I now packed in one class, much simpler. Although I used the Delphi date-format as the base, it shouldn't be difficult to rewrite the class for another type. The input can be

Re: hash values and equality

2011-05-20 Thread Ethan Furman
Ethan Furman wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ Two things I didn't make clear originally: I'm using Python3. My objects (of type Wierd) obey the

Re: Faster Recursive Fibonacci Numbers

2011-05-20 Thread geremy condra
On Fri, May 20, 2011 at 10:07 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 20 May 2011 16:54:06 +1000, Chris Angelico wrote: If someone has time to kill (as if!), it'd be awesome to get a new numeric type that uses bc's code; any other numeric type (int, long,

Re: hash values and equality

2011-05-20 Thread Chris Rebert
On Fri, May 20, 2011 at 10:56 AM, Ethan Furman et...@stoneleaf.us wrote: Chris Rebert wrote: On Thu, May 19, 2011 at 10:43 PM, Ethan Furman et...@stoneleaf.us wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this

Re: hash values and equality

2011-05-20 Thread Christian Heimes
Am 20.05.2011 17:50, schrieb MRAB: Is this strictly true? I thought that the hash value, an integer, is moduloed (Is that how you spell it? Looks weird!) with the number of array elements to give an index into the array, so different hashes could give the same index, and objects with different

ABC validation strictly on an instance

2011-05-20 Thread Eric Snow
The current ABC implementation in Python implies that the class of a conformant instance complies with the ABC. The implication does not carry down to the compliance of the instance itself. This means that if you inherit from an ABC that has an abstract property, your subclass must have a

Re: TK program problem

2011-05-20 Thread Ian Kelly
On Fri, May 20, 2011 at 12:03 PM, bvdp b...@mellowood.ca wrote: All this is fine (and worked perfectly before my upgrade). The menu items which are ordinary functions continue to work. BUT the callbacks which are classes are just ignored when they are clicked. I'm not a tk user, but it sounds

Re: What other languages use the same data model as Python?

2011-05-20 Thread Albert van der Horst
In article mailman.1286.1304760534.9059.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Sat, May 7, 2011 at 7:21 PM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Hans Georg Schaathun wrote: You cannot reference nor manipulate a reference in python, and that IMHO makes

Re: What other languages use the same data model as Python?

2011-05-20 Thread Albert van der Horst
In article 4dc7fa2f$0$29991$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 09 May 2011 12:52:27 +1200, Gregory Ewing wrote: Steven D'Aprano wrote: Since you haven't explained what you think is happening, I can only guess. Let me save

Re: List of WindowsError error codes and meanings

2011-05-20 Thread Genstein
On 20/05/2011 18:56, Andrew Berg wrote: This is probably somewhat off-topic, but where would I find a list of what each error code in WindowsError means? Assuming it's a Win32 error code, winerror.h from the Platform SDK holds the answer. One version is linked below, it's in theory out of

Re: hash values and equality

2011-05-20 Thread MRAB
On 20/05/2011 20:01, Christian Heimes wrote: Am 20.05.2011 17:50, schrieb MRAB: Is this strictly true? I thought that the hash value, an integer, is moduloed (Is that how you spell it? Looks weird!) with the number of array elements to give an index into the array, so different hashes could

Re: List of WindowsError error codes and meanings

2011-05-20 Thread Tim Golden
On 20/05/2011 18:56, Andrew Berg wrote: This is probably somewhat off-topic, but where would I find a list of what each error code in WindowsError means? WindowsError is so broad that it could be difficult to decide what to do in an except clause. Fortunately, sys.exc_info()[1][0] holds the

Re: hash values and equality

2011-05-20 Thread Peter Otten
Ethan Furman wrote: Peter Otten wrote: Ethan Furman wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ I'm hoping somebody can tell me what horrible thing will

Re: obviscating python code for distribution

2011-05-20 Thread harrismh777
Steven D'Aprano wrote: Nonsense. How do you (generic you, not any specific person) know that you are not an idiot? lol Sum, ergo Idiot cogitat. Reminds me of a philosophical story I heard one time from my religion professor... ... as it goes, De Carte leads his horse into town ;-)

Re: Why did Quora choose Python for its development?

2011-05-20 Thread Dotan Cohen
On Fri, May 20, 2011 at 19:39, Beliavsky beliav...@aol.com wrote: I thought this essay on why one startup chose Python was interesting. http://www.quora.com/Why-did-Quora-choose-Python-for-its-development PHP was out of the question. Facebook is stuck on that for legacy reasons, not because

Re: hash values and equality

2011-05-20 Thread Ethan Furman
Peter Otten wrote: Ethan Furman wrote: Peter Otten wrote: Ethan Furman wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ -- class Wierd(): ... def

Re: List of WindowsError error codes and meanings

2011-05-20 Thread Andrew Berg
On 2011.05.20 02:47 PM, Genstein wrote: On 20/05/2011 18:56, Andrew Berg wrote: This is probably somewhat off-topic, but where would I find a list of what each error code in WindowsError means? Assuming it's a Win32 error code, winerror.h from the Platform SDK holds the answer. One

Re: TK program problem

2011-05-20 Thread bvdp
I'm not a tk user, but it sounds like it has regressed from accepting arbitrary callables as callbacks to accepting functions specifically. What happens if you replace: (Favorites, selectFav), with: (Favorites, lambda: selectFav()), Okay, this works. Great and thanks! Seems to me that

Re: TK program problem

2011-05-20 Thread Ian Kelly
On Fri, May 20, 2011 at 4:12 PM, bvdp b...@mellowood.ca wrote: Okay, this works. Great and thanks! Seems to me that the way I was doing it should be alright ... and I've got some other programs exhibiting the same problem. Before I go fixing the issue ... is this known or even a bug? The

Re: obviscating python code for distribution

2011-05-20 Thread geremy condra
On Fri, May 20, 2011 at 1:24 PM, harrismh777 harrismh...@charter.net wrote: Steven D'Aprano wrote: Nonsense. How do you (generic you, not any specific person) know that you are not an idiot? lol     Sum, ergo Idiot cogitat. Reminds me of a philosophical story I heard one time from my

Re: validating a class against an ABC at definition time

2011-05-20 Thread Eric Snow
On Thu, May 19, 2011 at 11:33 PM, Eric Snow ericsnowcurren...@gmail.comwrote: Thinking about class APIs and validating a class against an API. The abc module provides the tools to do some of this. One thing I realized, that I hadn't noticed before, is that the abstractness of a class is

Re: TK program problem

2011-05-20 Thread bvdp
Probably the fix is to use a function :) The docs [1] say that a callback is a function, so I guess that if it worked before it was just luck.  You should bring it up on the tkinter list and see what they have to say about it, though. I'm a bit confused about why you would want to use a

Re: TK program problem

2011-05-20 Thread Ian Kelly
On Fri, May 20, 2011 at 5:07 PM, bvdp b...@mellowood.ca wrote: You mention the tkinter group. Ummm, what group is that??? http://tkinter.unpythonic.net/wiki/TkinterDiscuss -- http://mail.python.org/mailman/listinfo/python-list

Re: TK program problem

2011-05-20 Thread bvdp
On May 20, 4:29 pm, Ian Kelly ian.g.ke...@gmail.com wrote: On Fri, May 20, 2011 at 5:07 PM, bvdp b...@mellowood.ca wrote: You mention the tkinter group. Ummm, what group is that??? http://tkinter.unpythonic.net/wiki/TkinterDiscuss Thanks. New one for me. I'll subscribe and see if they know

Re: TK program problem

2011-05-20 Thread rantingrick
On May 20, 6:07 pm, bvdp b...@mellowood.ca wrote: Probably the fix is to use a function :) The docs [1] say that a callback is a function, so I guess that if it worked before it was just luck.  You should bring it up on the tkinter list and see what they have to say about it, though.

Re: validating a class against an ABC at definition time

2011-05-20 Thread Eric Snow
On Fri, May 20, 2011 at 4:55 PM, Eric Snow ericsnowcurren...@gmail.comwrote: I have revised this and made a recipe for it: http://code.activestate.com/recipes/577711-validating-classes-and-objects-against-an-abstract/ I also added this:

Re: Faster Recursive Fibonacci Numbers

2011-05-20 Thread Chris Angelico
On Sat, May 21, 2011 at 3:07 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 20 May 2011 16:54:06 +1000, Chris Angelico wrote: If someone has time to kill (as if!), it'd be awesome to get a new numeric type that uses bc's code; any other numeric type (int, long, float)

Re: hash values and equality

2011-05-20 Thread Steven D'Aprano
On Fri, 20 May 2011 21:17:29 +0100, MRAB wrote: On 20/05/2011 20:01, Christian Heimes wrote: Am 20.05.2011 17:50, schrieb MRAB: Is this strictly true? I thought that the hash value, an integer, is moduloed (Is that how you spell it? Looks weird!) ... I don't think 'moduloed' is an existing

Python 2.6.7 release candidate 2 now available

2011-05-20 Thread Barry Warsaw
Hello to all you Pythoneers and Pythonistas, I'm happy to announce the availability of Python 2.6.7 release candidate 2. Release candidate 1 was not widely announced due to a mismatch between the Mercurial and Subversion branches. Barring any unforeseen issues, this will be the last release

Re: obviscating python code for distribution

2011-05-20 Thread Steven D'Aprano
On Fri, 20 May 2011 15:45:03 -0700, geremy condra wrote: On Fri, May 20, 2011 at 1:24 PM, harrismh777 harrismh...@charter.net wrote: ... as it goes, De Carte leads his horse into town   ;-)  and having hitched it to the rail outside the local saloon and sauntering up to the bar,  the tender

Re: hash values and equality

2011-05-20 Thread MRAB
On 21/05/2011 01:47, Steven D'Aprano wrote: On Fri, 20 May 2011 21:17:29 +0100, MRAB wrote: On 20/05/2011 20:01, Christian Heimes wrote: Am 20.05.2011 17:50, schrieb MRAB: Is this strictly true? I thought that the hash value, an integer, is moduloed (Is that how you spell it? Looks weird!)

Re: hash values and equality

2011-05-20 Thread Steven D'Aprano
On Sat, 21 May 2011 02:02:48 +0100, MRAB wrote: On 21/05/2011 01:47, Steven D'Aprano wrote: On Fri, 20 May 2011 21:17:29 +0100, MRAB wrote: On 20/05/2011 20:01, Christian Heimes wrote: Am 20.05.2011 17:50, schrieb MRAB: Is this strictly true? I thought that the hash value, an integer, is

Re: Python 2.6.7 release candidate 2 now available

2011-05-20 Thread harrismh777
Barry Warsaw wrote: We will support Python 2.6 in security-fix only mode until October 2013. Where can I read about the criteria for security-fix only? Who decides whether the security fix is critical? thanks, kind regards, m harris -- http://mail.python.org/mailman/listinfo/python-list

Re: obviscating python code for distribution

2011-05-20 Thread harrismh777
Steven D'Aprano wrote: ... as it goes, De Carte leads his horse into town;-)and having hitched it to the rail outside the local saloon and sauntering up to the bar, the tender asks, Would you be hav'in an ale sir? ... De Carte replies, I think not... ... and then disappeared.

Re: how to get PID from subprocess library

2011-05-20 Thread Kushal Kumaran
On Thu, May 19, 2011 at 9:32 PM, TheSaint nob...@nowhere.net.no wrote: hello, I'm using to launch a program by subprocess.getstatusoutput. I'd like to know whether I can get the program ID, in order to avoid another launch. For clarity sake, I'm calling aria2 (the download manager for linux)

Re: Overuse of try/except/else?

2011-05-20 Thread Cameron Simpson
On 11May2011 13:37, James Mills prolo...@shortcircuit.net.au wrote: | On Tue, May 10, 2011 at 7:34 PM, Jean-Michel Pichavant | jeanmic...@sequans.com wrote: | You can reraise the exception without loosing the stack trace. | | try: | ... | except SomeException, exc: | log(exc) | print 'Hello

Re: Python 2.6.7 release candidate 2 now available

2011-05-20 Thread Ned Deily
In article I9HBp.13322$oq.10...@newsfe17.iad, harrismh777 harrismh...@charter.net wrote: Barry Warsaw wrote: We will support Python 2.6 in security-fix only mode until October 2013. Where can I read about the criteria for security-fix only? You can read about the Python development

[issue1054041] Python doesn't exit with proper resultcode on SIGINT

2011-05-20 Thread Petri Lehtinen
Changes by Petri Lehtinen pe...@digip.org: -- nosy: +petri.lehtinen ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1054041 ___ ___ Python-bugs-list

[issue12127] Inconsistent leading zero treatment

2011-05-20 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- type: compile error - feature request versions: +Python 3.3 -Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12127 ___

[issue12127] Inconsistent leading zero treatment

2011-05-20 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: I think this is something that should be brought up for wider discussion on the python-dev mailing list. It may be that people are ready to allow those leading zeros for Python 3.3 or 3.4. -- nosy: +mark.dickinson

[issue12105] open() does not able to set flags, such as O_CLOEXEC

2011-05-20 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Why not to implement 'e' letter in py3k ? In systems where O_CLOEXEC is not supported in open(), flag should be set non-atomically using fcntl. Having an atomic or non-atomic behaviour depending on the OS is not a good idea.

[issue12117] Failures with PYTHONDONTWRITEBYTECODE: test_importlib, test_imp, test_distutils, test_packaging, test_runpy, test_import

2011-05-20 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: Several of these could be handled just by having test.support.make_legacy_pyc() fall back to compiling from source if sys.dont_write_bytecode is set. The others may need to be skipped in that situation. --

[issue12127] Inconsistent leading zero treatment

2011-05-20 Thread Eric V. Smith
Changes by Eric V. Smith e...@trueblade.com: -- nosy: +eric.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12127 ___ ___ Python-bugs-list

[issue12105] open() does not able to set flags, such as O_CLOEXEC

2011-05-20 Thread Charles-François Natali
Charles-François Natali neolo...@free.fr added the comment: To exclude races (in concurrent threads), this two ops should be done under lock (GIL?) That won't work, because open(), like other slow syscalls, is called without the GIL held. Furthermore, it wouldn't be atomic anyway (imagine a

[issue12105] open() does not able to set flags, such as O_CLOEXEC

2011-05-20 Thread Petri Lehtinen
Changes by Petri Lehtinen pe...@digip.org: -- nosy: +petri.lehtinen ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12105 ___ ___ Python-bugs-list

  1   2   >