ANN: ActivePython 2.6.0.0 is now available

2008-11-15 Thread Trent Mick
I'm happy to announce that ActivePython 2.6.0.0 is now available for download from: http://www.activestate.com/Products/activepython/ ActivePython 2.6.0.0 is based on Python 2.6.0. What is ActivePython? - ActivePython is ActiveState's binary distribution of Python.

Re: Project layout / Import files from different subdirectories

2008-11-15 Thread Gabriel Genellina
En Tue, 11 Nov 2008 09:29:44 -0200, Stef Mientki [EMAIL PROTECTED] escribió: On Tue, Nov 11, 2008 at 8:46 AM, Markus Mayer [EMAIL PROTECTED] wrote: I'm new to python and have a slight problem importing - or maybe understanding - modules. I'm writing a GUI application using Qt4 and wanted to

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-15 Thread Aaron Brady
On Nov 15, 12:51 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Fri, 14 Nov 2008 22:56:52 -0500, Terry Reedy wrote: snip I would say that the answer to this is, Would you like to include behaviour in value?. Let me give you an example: class String(string):     def

Re: duck-type-checking?

2008-11-15 Thread Arnaud Delobelle
Duck typing... For a while I thought the word _duck_ was used in the sense of _dodge_. -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list

Re: duck-type-checking?

2008-11-15 Thread Steven D'Aprano
On Sat, 15 Nov 2008 20:00:03 +1300, greg wrote: Joe Strout wrote: So, in this case, the simplest solution was to have the method that initially accepts and stores the data check to make sure that data satisfies the assumptions of the class. In hindsight, yes, but the trouble is that you

Re: multiple breaks

2008-11-15 Thread Robert Lehmann
On Thu, 13 Nov 2008 02:16:32 -0800, Chris Rebert wrote: On Thu, Nov 13, 2008 at 2:07 AM, TP [EMAIL PROTECTED] wrote: In the following example, is this possible to affect the two iterators to escape the two loops once one j has been printed: Non-exception alternative: done = False for i

Good practice when writing modules...

2008-11-15 Thread r0g
I'm collecting together a bunch of fairly random useful functions I have written over the years into a module. Generally speaking is it best to a) Import all the other modules these functions depend on into the modules global namespace by putting them at the top of the module or should I... b)

Re: Good practice when writing modules...

2008-11-15 Thread Arnaud Delobelle
r0g [EMAIL PROTECTED] writes: I'm collecting together a bunch of fairly random useful functions I have written over the years into a module. Generally speaking is it best to a) Import all the other modules these functions depend on into the modules global namespace by putting them at the top

Re: Question: what to do, my Python is getting crazy

2008-11-15 Thread Gabriel Genellina
En Fri, 14 Nov 2008 18:21:17 -0200, Pekeika [EMAIL PROTECTED] escribió: Good morning group, When I open my Python window, this is appearing instead of the command line . (I'm somehow new to Python). File boot_com_servers.py, line 21, in module File

Re: special editor support for indentation needed.

2008-11-15 Thread John Yeung
This is such a fascinating and compelling thread that it has pulled me out of lurker mode. Eric, I would like to say I also admire your initiative, but even more so your patience. You seem to handle comments of all types gracefully. Perhaps it comes from working with speech recognition so much.

Redirect Graphical output

2008-11-15 Thread Indian
Hi Friends, Is there any way we can redirect graphical output to some file What i require is to run a test for my function but it involves dialog boxes but a test shld be run without user intervention :( import sys import dialog import wx app = wx.PySimpleApp() sys.stdout =

don't get JPE (Java Python Extension) compiled.

2008-11-15 Thread Tamer Higazi
Hi people! I want to compile the Java Python Extension which I downloaded through CVS http://jpe.cvs.sourceforge.net/jpe/; Building JPE by bootstrapping the makefile system with the cmd: python makefile.py from the top source directory. I receive the following error message: working in

Re: ElementTree XML Namspace

2008-11-15 Thread Stefan Behnel
Hunter wrote: We are reviewing a vendor who will output some data in an XML format. I will then use python to convert the data to another format for upload to another vendor. Take a look at lxml.objectify, it has a nicer API, especially if you are new to XML. It also handles loads of namespace

Optional parameter object re-used when instantiating multiple objects

2008-11-15 Thread Rick Giuly
Hello All, Why is python designed so that b and c (according to code below) actually share the same list object? It seems more natural to me that each object would be created with a new list object in the points variable. class Blob: def __init__(self, points=[]): self._points =

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-15 Thread Arnaud Delobelle
Rick Giuly [EMAIL PROTECTED] writes: Hello All, Hello, Why is python designed so that b and c (according to code below) actually share the same list object? It seems more natural to me that each object would be created with a new list object in the points variable. class Blob: def

Re: Good practice when writing modules...

2008-11-15 Thread bearophileHUGS
r0g: a) Import all the other modules these functions depend on into the modules global namespace by putting them at the top of the module or should I... b) Include them in each function individually. This is a interesting topic, that requires some care. Generally I suggest you put them at the

Re: Redirect Graphical output

2008-11-15 Thread Gabriel Genellina
En Sat, 15 Nov 2008 07:27:47 -0200, Indian [EMAIL PROTECTED] escribió: Is there any way we can redirect graphical output to some file What i require is to run a test for my function but it involves dialog boxes but a test shld be run without user intervention :( import sys import dialog

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-15 Thread Arnaud Delobelle
[EMAIL PROTECTED] writes: I have yet to see any reasonable definition of a Python value in the Python docs or elsewhere, despite the fact that a value is one of the three defining characteristics of an object, a central concept in Python. I don't remember how the expression 'object value' is

Re: best python unit testing framwork

2008-11-15 Thread James Harris
On 15 Nov, 01:02, Brendan Miller [EMAIL PROTECTED] wrote: On Thu, Nov 13, 2008 at 3:54 AM, James Harris [EMAIL PROTECTED] wrote: On 11 Nov, 22:59, Brendan Miller [EMAIL PROTECTED] wrote: What would heavy python unit testers say is the best framework? I've seen a few mentions that maybe

english

2008-11-15 Thread shasha12
En Sat, 15 Nov 2008 07:27:47 -0200, Indian [EMAIL PROTECTED] escribió: ...(I don't get what the above code is supposed to perform) You're right, unit tests should run without user intervention. So in principle, the function being tested should not call a dialog box directly. There are several

comp.lang.python

2008-11-15 Thread shasha12
The Python computer language. Language: English -- http://mail.python.org/mailman/listinfo/python-list

Suggest a Labs feature

2008-11-15 Thread shasha12
Language:English -- http://mail.python.org/mailman/listinfo/python-list

Re: Good practice when writing modules...

2008-11-15 Thread r0g
[EMAIL PROTECTED] wrote: r0g: a) Import all the other modules these functions depend on into the modules global namespace by putting them at the top of the module or should I... b) Include them in each function individually. This is a interesting topic, that requires some care. Generally

Re: best python unit testing framwork

2008-11-15 Thread Kay Schluehr
On 11 Nov., 23:59, Brendan Miller [EMAIL PROTECTED] wrote: What would heavy python unit testers say is the best framework? I've seen a few mentions that maybe the built in unittest framework isn't that great. The UT frameworks follow the same principles and are all alike more or less. Of

Re: special editor support for indentation needed.

2008-11-15 Thread [EMAIL PROTECTED]
On Nov 14, 9:01 pm, Eric S. Johansson [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote:  I don't understand. If you don't want to terminate the if, why do you hit backspace? What is it that you would like to have happen? the goal is to make some aspects of indentation behave the same

Re: [UnicodeEncodeError] Don't know what else to try

2008-11-15 Thread Gilles Ganault
On Fri, 14 Nov 2008 17:39:00 +0100, Martin v. Löwis [EMAIL PROTECTED] wrote: Can you first please report what happened when you add the print statement? Thanks guys, I found how to handle this: === for id in rows: #Says Unicode, but it's actually not #print type(id[1])

Comparing value in two dictionaries?

2008-11-15 Thread Gilles Ganault
Hello I fill two dictionaries with the same number of keys, and then need to compare the value for each key, eg. #Pour chaque APE, comparaison societe.ape.nombre et verif.ape.nombre import apsw # dic1={} [...] rows=list(cursor.execute(sql)) for id in rows: dic1[id[0]] =

The Best Way To earn Money From The Internet

2008-11-15 Thread [EMAIL PROTECTED]
http://bux.to/?r=mr-sk8er At Bux.to, you get paid to click on ads and visit websites. The process is easy! You simply click a link and view a website for 30 seconds to earn money. You can earn even more by Referring Friends. You'll get paid $0.01 for each website you personally view and $0.01 for

Re: Comparing value in two dictionaries?

2008-11-15 Thread bearophileHUGS
Gilles Ganault: I fill two dictionaries with the same number of keys, and then need to compare the value for each key, eg. Probably using the DBMS capabilities you can find a better solution. Are the keys equal? If you want to do it using dicts, you can iterate on one dict, with iteritems, and

Regular expression and exception

2008-11-15 Thread Mr . SpOOn
Hi, I've never used exception before, but I think now it's time to start. I've seen that there is a list of the built-in exceptions in the Python docs, but this explains the meaning of every exception. Does exist an inverted list? I mean, how may I know what kind of exception is going to raise

Re: duck-type-checking?

2008-11-15 Thread Paul McGuire
On Nov 15, 2:50 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: I wonder whether the best solution is to include all your type checks (isinstance or duck-typing) in the unit tests, so you can avoid paying the cost of those tests at runtime? If your code passes the unit tests,

Re: Comparing value in two dictionaries?

2008-11-15 Thread Arnaud Delobelle
Gilles Ganault [EMAIL PROTECTED] writes: Hello I fill two dictionaries with the same number of keys, and then need to compare the value for each key, eg. #Pour chaque APE, comparaison societe.ape.nombre et verif.ape.nombre import apsw # dic1={} [...]

Re: Regular expression and exception

2008-11-15 Thread Arnaud Delobelle
Mr.SpOOn [EMAIL PROTECTED] writes: Hi, I've never used exception before, but I think now it's time to start. I've seen that there is a list of the built-in exceptions in the Python docs, but this explains the meaning of every exception. Does exist an inverted list? I mean, how may I know

Re: Regular expression and exception

2008-11-15 Thread bearophileHUGS
Mr.SpOOn: try:     m = re.match('[1-9]$', my_string) except:     print 'something...' ... try:    m.group() except:    print 'error...' Generally don't write a nude except, use qualified exceptions, that is put there one of more exceptions that you want to catch (be careful with the

Re: Clustering the keys of a dict according to its values

2008-11-15 Thread Florian Brucker
Wow, thanks everybody! There's a lot to learn for me from these examples... Enjoy your weekend! Florian Florian Brucker wrote: Hi everybody! Given a dictionary, I want to create a clustered version of it, collecting keys that have the same value: d = {'a':1, 'b':2, 'c':1, 'd':1, 'e':2,

Re: [UnicodeEncodeError] Don't know what else to try

2008-11-15 Thread Marc 'BlackJack' Rintsch
On Sat, 15 Nov 2008 14:12:42 +0100, Gilles Ganault wrote: On Fri, 14 Nov 2008 17:39:00 +0100, Martin v. Löwis [EMAIL PROTECTED] wrote: Can you first please report what happened when you add the print statement? Thanks guys, I found how to handle this: === for id in rows:

Re: To throw or to throw not?

2008-11-15 Thread Emanuele D'Arrigo
Thank you all for the insightful replies! Much appreciated! Manu -- http://mail.python.org/mailman/listinfo/python-list

Re: don't get JPE (Java Python Extension) compiled.

2008-11-15 Thread Benjamin Kaplan
On Sat, Nov 15, 2008 at 4:33 AM, Tamer Higazi [EMAIL PROTECTED] wrote: Hi people! I want to compile the Java Python Extension which I downloaded through CVS http://jpe.cvs.sourceforge.net/jpe/; Building JPE by bootstrapping the makefile system with the cmd: python makefile.py from the

[ANN] TZMud 0.7

2008-11-15 Thread Lee Harr
TZMud is a Python MUD server. http://tzmud.googlecode.com/ A MUD is a text-based virtual environment accessed via telnet, or with a specialised MUD client. TZMud development is still in early stages, focusing on API and server stability. TZMud uses several high-quality Python libraries to

Re: Good practice when writing modules...

2008-11-15 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: r0g: a) Import all the other modules these functions depend on into the modules global namespace by putting them at the top of the module or should I... b) Include them in each function individually. This is a interesting topic, that requires some care. Generally I

Re: Comparing value in two dictionaries?

2008-11-15 Thread Scott David Daniels
Arnaud Delobelle wrote: Gilles Ganault [EMAIL PROTECTED] writes: Hello I fill two dictionaries with the same number of keys, and then need to compare the value for each key, ... if you know set(dic1) == set(dic2) -- that is that the same keys are used, you could use: Setup: dic1 =

Generators and their next() and send() methods

2008-11-15 Thread Thomas Mlynarczyk
Hello, I was playing around a bit with generators using next() and send(). And I was wondering why an extra send() method was introduced instead of simply allowing an argument for next(). Also, I find it a bit counter-intuitive that send(42) not only sets the generator to the specified

Re: Comparing value in two dictionaries?

2008-11-15 Thread Arnaud Delobelle
Scott David Daniels [EMAIL PROTECTED] writes: Arnaud Delobelle wrote: Gilles Ganault [EMAIL PROTECTED] writes: Hello I fill two dictionaries with the same number of keys, and then need to compare the value for each key, ... if you know set(dic1) == set(dic2) -- that is that the same keys

Re: Generators and their next() and send() methods

2008-11-15 Thread Arnaud Delobelle
Thomas Mlynarczyk [EMAIL PROTECTED] writes: Hello, I was playing around a bit with generators using next() and send(). And I was wondering why an extra send() method was introduced instead of simply allowing an argument for next(). Also, I find it a bit counter-intuitive that send(42) not

Re: Comparing value in two dictionaries?

2008-11-15 Thread Arnaud Delobelle
Arnaud Delobelle [EMAIL PROTECTED] writes: Or to obtain a dictionary of differences: dict((k, (v, dic2[v]) for k, v in dic1.iteritems() if dic2[v] != v) ^ Should be k of course! -- Arnaud --

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-15 Thread rurpy
On Nov 14, 8:56 pm, Terry Reedy [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Nov 13, 4:53 pm, Terry Reedy wrote: [EMAIL PROTECTED] wrote: I have yet to see any reasonable definition of a Python value in the Python docs or elsewhere, despite the fact that a value is one of the three

Re: Little direction please Python MySQL

2008-11-15 Thread Ethan Furman
len wrote: On Nov 13, 7:32 pm, Ethan Furman [EMAIL PROTECTED] wrote: len wrote: Hi all; [snip] Here is my problem. I need to start doing this in the really world at my company converting some older cobol system and data to python programs and MySQL. I have gotten past packed decimal

Re: Building musical chords starting from (a lot of) rules

2008-11-15 Thread Stefaan Himpe
The costrunction of a chord is based on a root note and a structure, so by default, giving just a note, it creates a major chord adding the third and fifth note. Quite some time ago I wrote something to solve the reverse problem: given a list of note names, find out a chord name.

Re: Good practice when writing modules...

2008-11-15 Thread John Machin
On Nov 15, 9:08 pm, [EMAIL PROTECTED] wrote: I also put a comment after each import, with the name of the function/ class it is used into: import foo # used by baz() import bar # used by spam() Why bother with the ()? Why bother at all? Surely this rapidly becomes tedious clutter: import

Two instances share an attribute

2008-11-15 Thread Filip Gruszczyński
I really don't understand, what's happening with the following code. Am I doing something wrong? #!/usr/bin/python class EnumeratedContent: def __init__(self, values = []): self.values_ = values def values(self): return self.values_ def

Re: Two instances share an attribute

2008-11-15 Thread Cameron Simpson
On 15Nov2008 22:41, Filip Gruszczyński [EMAIL PROTECTED] wrote: | I really don't understand, what's happening with the following code. | Am I doing something wrong? Yes. This is a common mistake: | class EnumeratedContent: | def __init__(self, values = []): | self.values_

Re: Two instances share an attribute

2008-11-15 Thread Filip Gruszczyński
Every day something new. Thanks a lot :) 2008/11/15 Cameron Simpson [EMAIL PROTECTED]: On 15Nov2008 22:41, Filip Gruszczyński [EMAIL PROTECTED] wrote: | I really don't understand, what's happening with the following code. | Am I doing something wrong? Yes. This is a common mistake: | class

Re: Don't know what else to try

2008-11-15 Thread John Machin
On Nov 16, 12:12 am, Gilles Ganault [EMAIL PROTECTED] wrote: On Fri, 14 Nov 2008 17:39:00 +0100, Martin v. Löwis [EMAIL PROTECTED] wrote: Can you first please report what happened when you add the print statement? Thanks guys, I found how to handle this: No you didn't. === for

Re: Good practice when writing modules...

2008-11-15 Thread Robert Kern
r0g wrote: The module I am compiling is kind of a scrapbook of snippets for my own development use, it has no coherent theme and I wouldn't be distributing it or using the whole thing in a production environment anyway, just copying the relevant functions into a new module when needed. I'm

Re: Good practice when writing modules...

2008-11-15 Thread Robert Kern
Robert Kern wrote: r0g wrote: The module I am compiling is kind of a scrapbook of snippets for my own development use, it has no coherent theme and I wouldn't be distributing it or using the whole thing in a production environment anyway, just copying the relevant functions into a new module

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-15 Thread Terry Reedy
[EMAIL PROTECTED] wrote: On Nov 14, 8:56 pm, Terry Reedy [EMAIL PROTECTED] wrote: First of all, thanks. Thanks to your answers I have finally been able to formulate a concept of Python values. Now we'll see if it is valid/usable... :-) Good questions help refine a concept. * Can I create

PP3E error

2008-11-15 Thread ryan payton
How do I fix the PP3E and PP2E errors in Programming Python 3rd Edition? -- http://mail.python.org/mailman/listinfo/python-list

Re: special editor support for indentation needed.

2008-11-15 Thread Eric S. Johansson
Aaron Brady wrote: You see examples here from time to time that don't follow the rigid C+ + formatting. Some examples: def classmaker( ): class X: something return X class X: class Y: something if something: class X: pass else: def X( ): pass Some

Re: special editor support for indentation needed.

2008-11-15 Thread Eric S. Johansson
John Yeung wrote: This is such a fascinating and compelling thread that it has pulled me out of lurker mode. Eric, I would like to say I also admire your initiative, but even more so your patience. You seem to handle comments of all types gracefully. Should have seen me 20 years ago.

Re: special editor support for indentation needed.

2008-11-15 Thread Eric S. Johansson
[EMAIL PROTECTED] wrote: I still don't understand. I elaborated on some of these points in a post to Aaron Brady. If you missed it on the list, let me know and I will forward you a copy. It seems that you want to be able to do: END_CLASS to end the current class. END_DEF to end the

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-15 Thread Steven D'Aprano
On Sat, 15 Nov 2008 01:40:04 -0800, Rick Giuly wrote: Hello All, Why is python designed so that b and c (according to code below) actually share the same list object? It seems more natural to me that each object would be created with a new list object in the points variable. That's not

Re: PP3E error

2008-11-15 Thread Steven D'Aprano
On Sat, 15 Nov 2008 16:37:34 -0800, ryan payton wrote: How do I fix the PP3E and PP2E errors in Programming Python 3rd Edition? Liquid Paper? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-15 Thread rurpy
On Nov 15, 4:12 pm, Terry Reedy [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Nov 14, 8:56 pm, Terry Reedy [EMAIL PROTECTED] wrote: ...snip... * Does an object's behavior (methods) affect its value? My first answer is No. Instance methods are attributes of a class and, in most

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-15 Thread rurpy
[Tried multiple times to post this but Google errors out so will try posting in two parts... this is part 1] On Nov 14, 11:51 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Fri, 14 Nov 2008 22:56:52 -0500, Terry Reedy wrote: [EMAIL PROTECTED] wrote: On Nov 13, 4:53 pm,

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-15 Thread rurpy
[Tried multiple times to post this but Google errors out so will try posting in two parts... this is part 2] On Nov 14, 11:51 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Fri, 14 Nov 2008 22:56:52 -0500, Terry Reedy wrote: [EMAIL PROTECTED] wrote: On Nov 13, 4:53 pm, Terry

Re: Multiprocessing vs. [Pyro, RPyC]

2008-11-15 Thread J Kenneth King
Jeffrey Barish [EMAIL PROTECTED] writes: [EMAIL PROTECTED] wrote: Jeffrey With the release of multiprocessing in Python 2.6, is there any Jeffrey reason to use Pyro or RPyC? As far as I know the multiprocessing module only works on one machine (multi-cpu or multi-core), not

Need help in understanding a python code

2008-11-15 Thread [EMAIL PROTECTED]
Hi, I am trying to understand the following line: # a is an integer array max([(sum(a[j:i]), (j,i)) Can you please tell me what that means, I think sum(a[j:i] means find the some from a[j] to a[i] But what is the meaning of the part (j,i)? -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help in understanding a python code

2008-11-15 Thread Chris Rebert
On Sat, Nov 15, 2008 at 8:41 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I am trying to understand the following line: # a is an integer array max([(sum(a[j:i]), (j,i)) This code isn't valid. You have a [ with no closing ]. Cheers, Chris -- Follow the path of the Iguana...

pyspread 0.0.10 released

2008-11-15 Thread mmanns
Pyspread 0.0.10 has finally been released. About: -- Pyspread is a 3D spreadsheet application. Each cell accepts a Python expression and returns an accessible object. Python modules are usable from the spreadsheet table without external scripts. Changes: + Code completely

Re: Need help in understanding a python code

2008-11-15 Thread John Machin
On Nov 16, 3:41 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I am trying to understand the following line: # a is an integer array max([(sum(a[j:i]), (j,i)) Can you please tell me what that means, I think sum(a[j:i] means find the some from a[j] to a[i] But what is the meaning of

Re: Need help in understanding a python code

2008-11-15 Thread Meryl Silverburgh
This is the full source code: def A(w, v, i,j): if i == 0 or j == 0: return 0 if w[i-1] j: return A(w, v, i-1, j) if w[i-1] = j: return max(A(w,v, i-1, j), v[i-1] + A(w,v, i-1, j - w[i-1])) I am reading this blog http://20bits.com/articles/introduction-to-dynamic-programming/ On

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-15 Thread Aaron Brady
On Nov 15, 3:40 am, Rick Giuly [EMAIL PROTECTED] wrote: Hello All, Why is python designed so that b and c (according to code below) actually share the same list object? It seems more natural to me that each object would be created with a new list object in the points variable. class Blob:

Re: Need help in understanding a python code

2008-11-15 Thread Aaron Brady
See below. On Nov 15, 11:15 pm, Meryl Silverburgh [EMAIL PROTECTED] wrote: This is the full source code: def A(w, v, i,j):     if i == 0 or j == 0: return 0     if w[i-1] j:  return A(w, v, i-1, j)     if w[i-1] = j: return max(A(w,v, i-1, j), v[i-1] + A(w,v, i-1, j - w[i-1])) I am

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-15 Thread Steven D'Aprano
On Sat, 15 Nov 2008 11:17:07 -0800, rurpy wrote: * Can I create an object that has a value that is the same as int(3) without somehow using an int(3) object in its construction? [...] Yes: mpz(3) where mpz is multi-precision int class with same set of possible values as Python ints. The

Palette-mode PNG images

2008-11-15 Thread Lawrence D'Oliveiro
I'm trying to create PNG files to use in menus for authoring DVDs. As you may know, these menus are only allowed to have limited numbers of colours. Ideally I'd like to create a PNG file with just two bits per pixel, with four colour-table entries of my choice. I'm using PyCairo

Re: Building musical chords starting from (a lot of) rules

2008-11-15 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Mr.SpOOn wrote: C 9 is a base chord plus a the ninth note, but this implies the presence of the seventh too, so it results in: C E G B D I don't recall such meanings in the chord names I came across. If you wanted both a seventh and ninth, you had to say so: C7+9

Re: Does Python have Multiple Inheritance ?

2008-11-15 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Larry Bates wrote: Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Steve Holden wrote: Lawrence D'Oliveiro wrote: Not to mention duck typing, which does away with the need for inheritance altogether. That seems a somewhat extreme point of view.

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-15 Thread Steven D'Aprano
On Sat, 15 Nov 2008 21:29:22 -0800, Aaron Brady wrote: I don't think Dennis or Steven read your post very well. It's possible. You said 'Why does Python do X?', and 'It seems natural to you to do not X'. Dennis and Steven both said, 'Python does X'. I also disputed that it is natural to do

Re: Building musical chords starting from (a lot of) rules

2008-11-15 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Dennis Lee Bieber wrote: On Sun, 16 Nov 2008 19:21:49 +1300, Lawrence D'Oliveiro [EMAIL PROTECTED] declaimed the following in comp.lang.python: In message [EMAIL PROTECTED], Mr.SpOOn wrote: C 9 is a base chord plus a the ninth note, but this implies the

about escape string store in mysql

2008-11-15 Thread ylj798
this string from web by the Regular Expression, −−− href=# onClick=ConvertURL2FG('Flashget:// W0ZMQVNIR0VUXWh0dHA6Ly9tb3YuM2dwLmNuL2d1aWxpbi8yMDA4LzExLzExL3l1ZWhvdWppZmVuMDIuM2dwW0ZMQVNIR0VUXQ==233','', 233) oncontextmenu=Flashget_SetHref(this)

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-15 Thread Arnaud Delobelle
Steven D'Aprano [EMAIL PROTECTED] writes: On Sat, 15 Nov 2008 01:40:04 -0800, Rick Giuly wrote: Hello All, Why is python designed so that b and c (according to code below) actually share the same list object? It seems more natural to me that each object would be created with a new list

py2exe 0.6.9 released

2008-11-15 Thread Jimmy Retzlaff
py2exe 0.6.9 released = py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation. Console and Windows (GUI) applications, Windows NT services, exe and dll COM servers are

Re: Clustering the keys of a dict according to its values

2008-11-15 Thread bearophileHUGS
Bruno Desthuilliers: What is data is another type of sequence or iterable ?-) The original problem statement was: Florian Brucker: Given a dictionary, I want to create a clustered version of it, collecting keys that have the same value: [...] Another requirement is that it should also work on

Re: Need help in understanding a python code

2008-11-15 Thread bearophileHUGS
silverburgh: max([(sum(a[j:i]), (j,i)) Other people have already answered you so I'll add only a small note: today the max() function has a key optional attribute, so that code can also be written as: max(((j, i) for ...), key=lambda (j, i): sum(a[j : i])) I think you have copied that part

[issue4326] type of UserList instance returns class instead of instance

2008-11-15 Thread Georg Brandl
Georg Brandl [EMAIL PROTECTED] added the comment: What good is a comparison with InstanceType for? If you want to check whether it's an instance of a custom class, you'll have to check for instances of new-style classes anyway. If you want to check for UserList instances, use isinstance().

[issue4312] Unicode in distutils meta-data?

2008-11-15 Thread Georg Brandl
Changes by Georg Brandl [EMAIL PROTECTED]: -- assignee: georg.brandl - loewis nosy: +loewis ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4312 ___ ___

[issue4324] locale documentation is inconsistent

2008-11-15 Thread Georg Brandl
Georg Brandl [EMAIL PROTECTED] added the comment: Thanks, fixed in r67224. -- resolution: - fixed status: open - closed ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4324 ___

[issue4328] à in ufoo raises a misleading error

2008-11-15 Thread Ezio Melotti
New submission from Ezio Melotti [EMAIL PROTECTED]: With Python 2.x: 'à' in u'foo' Traceback (most recent call last): File stdin, line 1, in ? TypeError: 'in string' requires string as left operand 'à' in u'xàx' Traceback (most recent call last): File stdin, line 1, in ? TypeError: 'in

[issue2706] datetime: define division timedelta/timedelta

2008-11-15 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: timedelta / float or int should be disallowed in true division mode. I don't understand this; why should the division mode affect division operations involving timedeltas at all? The meaning of / is unaffected by the division mode for

[issue2706] datetime: define division timedelta/timedelta

2008-11-15 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: By the way, I assume that any plan to add this division would also include adding the inverse operation: timedelta * float - timedelta. It wouldn't make a whole lot of sense to have one without the other.

[issue4291] Allow Division of datetime.timedelta Objects

2008-11-15 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: [Christian] float(td1) / float(td2) which is far more obvious than td1 / td2 To me, td1/td2 is more obvious that float(td1)/float(td2). float(td) involves an arbitrary choice, to return time in *seconds* (rather than days, or milliseconds,

[issue2736] datetime needs and epoch method

2008-11-15 Thread STINNER Victor
STINNER Victor [EMAIL PROTECTED] added the comment: Le Saturday 15 November 2008 04:17:50 Alexander Belopolsky, vous avez écrit : it is really unnecessary because it can be written as epoch + timedelta(0, seconds, microseconds). I tried yesterday and it doesn't work! datetime.datetime(1970,

[issue2706] datetime: define division timedelta/timedelta

2008-11-15 Thread STINNER Victor
STINNER Victor [EMAIL PROTECTED] added the comment: Some examples to help the choice (using the last patch). int --- 2L print dt2 * 2 3:08:38 print dt1 - dt2 * 2 0:51:22 divmod(dt1, dt2) (2L, datetime.timedelta(0, 3082)) print timedelta(0, 3082) 0:51:22 In 4 hours, you can watch the movie

[issue2666] webbrowser.py doesn't properly handle BROWSER env var

2008-11-15 Thread Oleg Broytmann
Oleg Broytmann [EMAIL PROTECTED] added the comment: Update the patch. Added file: http://bugs.python.org/file12015/webbrowser.py.patch ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue2666 ___

[issue2666] webbrowser.py doesn't properly handle BROWSER env var

2008-11-15 Thread Oleg Broytmann
Changes by Oleg Broytmann [EMAIL PROTECTED]: Removed file: http://bugs.python.org/file10072/webbrowser.py.patch ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue2666 ___

[issue4328] à in ufoo raises a misleading error

2008-11-15 Thread Matthew Barnett
Matthew Barnett [EMAIL PROTECTED] added the comment: The left operand is a bytestring and the right operand is a unicode string, so it makes sense that it raises an exception, although it would be clearer if it said 'in string' requires unicode string as left operand. I agree that if it's going

[issue887237] Machine integers

2008-11-15 Thread Thomas Heller
Thomas Heller [EMAIL PROTECTED] added the comment: I wonder if a patch for ctypes like this (which is not yet complete) could be used to implement this, or MUST it be implemented in C? The patch contains a mixin class that implements the numeric methods. However, the actual operation takes

[issue2706] datetime: define division timedelta/timedelta

2008-11-15 Thread Alexander Belopolsky
Alexander Belopolsky [EMAIL PROTECTED] added the comment: On Sat, Nov 15, 2008 at 5:08 AM, Mark Dickinson [EMAIL PROTECTED] wrote: Mark Dickinson [EMAIL PROTECTED] added the comment: timedelta / float or int should be disallowed in true division mode. I don't understand this; why should

[issue1726687] Bug found in datetime for Epoch time = -1

2008-11-15 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment: on Windows (with Visual Studio), mktime() also sets tm_wday only if successful. But negative time_t are still not allowed by the Microsoft CRT, the tests fail. There are workaround to this - for example python could use techniques

[issue4291] Allow Division of datetime.timedelta Objects

2008-11-15 Thread Alexander Belopolsky
Alexander Belopolsky [EMAIL PROTECTED] added the comment: @Christian Adding a __float__ method to datetime was entertained back in 2003, but was rejected. The same reasons apply to timedelta: - A C double doesn't have enough precision for roundtrip guarantees. - Does it really need to be

  1   2   >