Re: Eric - No module named MainWindow

2013-02-18 Thread Vincent Vande Vyvre
Le 18/02/13 00:04, Phil a écrit : ... from PyQt4 import QtCore, QtGui from ui.MainWindow import MainWindow As I've sayed in my last post, this is not ui.MainWindow but ui.mainwindow -- Vincent V.V. Oqapy https://launchpad.net/oqapy . Qarte https://launchpad.net/qarte . PaQager

Re: Struggling with program

2013-02-18 Thread Jean-Michel Pichavant
- Original Message - I'm trying to do this assignment and it not working, I don't understand why... This is what I have to do: Write the definition of a class Player containing: An instance variable name of type String , initialized to the empty String. An instance variable

Re: Struggling with program

2013-02-18 Thread Jean-Michel Pichavant
So your assignment is a bit misleading when it says a constructor is not required, because if you want to initialize some instance attributes, it has to be done in a method, usually the constructor, which in Python is __init__. By constructor, he may actually refer to the __new__ method.

Re: Eric - No module named MainWindow

2013-02-18 Thread Phil
On 18/02/13 18:07, Vincent Vande Vyvre wrote: Le 18/02/13 00:04, Phil a écrit : ... from PyQt4 import QtCore, QtGui from ui.MainWindow import MainWindow As I've sayed in my last post, this is not ui.MainWindow but ui.mainwindow Thanks again Vincent, Your answer is correct but that wasn't

Re: Python-list Digest, Vol 113, Issue 111

2013-02-18 Thread Jean-Michel Pichavant
- Original Message - Hi, I don't know if I should ask this on here, or in the tutor section, but I heard that http://www.lighttable.com was an innovative IDE, so I was wondering if it works for python since I'm learning python over time. Thanks Hi, Please do not use html

python mail box

2013-02-18 Thread cyberkishor
I want to display mail to django apps from my google accout. and when the fetch all unread message,i want to replay them from my apps so i need replay option also. by point: 1. First Fetch all unread mail from google account. 2. If replay from apps it's replay those email. 3. i want to same this

Differences creating tuples and collections.namedtuples

2013-02-18 Thread John Reid
Hi, I was hoping namedtuples could be used as replacements for tuples in all instances. There seem to be some differences between how tuples and namedtuples are created. For example with a tuple I can do: a=tuple([1,2,3]) with namedtuples I get a TypeError: from collections import namedtuple

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread Oscar Benjamin
On 18 February 2013 11:47, John Reid johnbaronr...@gmail.com wrote: Hi, I was hoping namedtuples could be used as replacements for tuples in all instances. namedtuples are not really intended to serves as tuples anywhere. They are intended to provide lightweight, immutable, hashable objects

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread Oscar Benjamin
On 18 February 2013 12:03, Oscar Benjamin oscar.j.benja...@gmail.com wrote: On 18 February 2013 11:47, John Reid johnbaronr...@gmail.com wrote: I'm seeing this problem because of the following code in IPython: def canSequence(obj): if isinstance(obj, (list, tuple)): t = type(obj)

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread Dave Angel
On 02/18/2013 06:47 AM, John Reid wrote: Hi, I was hoping namedtuples could be used as replacements for tuples in all instances. There seem to be some differences between how tuples and namedtuples are created. For example with a tuple I can do: a=tuple([1,2,3]) with namedtuples I get a

Re: Python trademark - A request for civility

2013-02-18 Thread Jean-Michel Pichavant
- Original Message - Folks, It seems that people have been sending threats and abuse to the company claiming a trademark on the name Python. And somebody, somewhere, may have launched a DDOS attack on their website. The Python Software Foundation has asked the community for

Re: Recording live video stream from IP camera issue

2013-02-18 Thread Sam Berry
Thanks for the advice! I looked into it, seems using windows was an issue, switched to ubuntu and it worked! Just wondering if you have used opencv for recording purposes? Or if you know of any python documentation for opencv2? Information is hard to come by! Thanks again, Sam --

Re: Simulation of human body in movement

2013-02-18 Thread Juhani Karlsson
Does it need to be simulation? That sound quite complicated. Can`t you just get some motion capture animation data? - J On 18 February 2013 06:51, Nick Mellor thebalance...@gmail.com wrote: Hi all, I'm looking for a fairly undetailed simulation of the human body walking and standing. Has

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread John Reid
On 18/02/13 12:05, Oscar Benjamin wrote: On 18 February 2013 12:03, Oscar Benjamin oscar.j.benja...@gmail.com wrote: On 18 February 2013 11:47, John Reid johnbaronr...@gmail.com wrote: I'm seeing this problem because of the following code in IPython: def canSequence(obj): if

Re: Python trademark - A request for civility

2013-02-18 Thread rusi
On Feb 18, 5:19 pm, Jean-Michel Pichavant jeanmic...@sequans.com wrote: - Original Message - Folks, It seems that people have been sending threats and abuse to the company claiming a trademark on the name Python. And somebody, somewhere, may have launched a DDOS attack on

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread John Reid
On 18/02/13 12:03, Oscar Benjamin wrote: On 18 February 2013 11:47, John Reid johnbaronr...@gmail.com wrote: Hi, I was hoping namedtuples could be used as replacements for tuples in all instances. namedtuples are not really intended to serves as tuples anywhere. They are intended to

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread John Reid
On 18/02/13 12:11, Dave Angel wrote: On 02/18/2013 06:47 AM, John Reid wrote: Hi, I was hoping namedtuples could be used as replacements for tuples in all instances. There seem to be some differences between how tuples and namedtuples are created. For example with a tuple I can do:

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread Oscar Benjamin
On 18 February 2013 14:09, John Reid j.r...@mail.cryst.bbk.ac.uk wrote: On 18/02/13 12:11, Dave Angel wrote: On 02/18/2013 06:47 AM, John Reid wrote: Hi, I was hoping namedtuples could be used as replacements for tuples in all instances. There seem to be some differences between how tuples

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread John Reid
On 18/02/13 14:12, Oscar Benjamin wrote: On 18 February 2013 13:51, John Reid johnbaronr...@gmail.com wrote: On 18/02/13 12:03, Oscar Benjamin wrote: On 18 February 2013 11:47, John Reid johnbaronr...@gmail.com wrote: Hi, I was hoping namedtuples could be used as replacements for tuples in

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread Oscar Benjamin
On 18 February 2013 13:51, John Reid johnbaronr...@gmail.com wrote: On 18/02/13 12:03, Oscar Benjamin wrote: On 18 February 2013 11:47, John Reid johnbaronr...@gmail.com wrote: Hi, I was hoping namedtuples could be used as replacements for tuples in all instances. namedtuples are not

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread John Reid
On 18/02/13 14:15, Oscar Benjamin wrote: On 18 February 2013 14:09, John Reid j.r...@mail.cryst.bbk.ac.uk wrote: On 18/02/13 12:11, Dave Angel wrote: On 02/18/2013 06:47 AM, John Reid wrote: Hi, I was hoping namedtuples could be used as replacements for tuples in all instances. There seem

Re: python mail box

2013-02-18 Thread Jean-Michel Pichavant
- Original Message - I want to display mail to django apps from my google accout. and when the fetch all unread message,i want to replay them from my apps so i need replay option also. by point: 1. First Fetch all unread mail from google account. 2. If replay from apps it's replay

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread Oscar Benjamin
On 18 February 2013 14:23, John Reid j.r...@mail.cryst.bbk.ac.uk wrote: [snip] That said it would be nice to know the rationale for namedtuple.__new__ to have a different signature to tuple.__new__. I'm guessing namedtuple._make has a similar interface to tuple.__new__. Does anyone know what

Multiple Plotting in Matplotlib

2013-02-18 Thread subhabangalore
Dear Group, I am trying to view multiple plotting files in matplotlib. My numbers range from 5 to few hundred. I was trying to use plt.subplot(), and plt.figure(n). But they did not work. plt.subplot() did not work at all. plt.figure(n) works till n=4. After that I am trying to get error

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread John Reid
On 18/02/13 14:53, Oscar Benjamin wrote: On 18 February 2013 14:23, John Reid j.r...@mail.cryst.bbk.ac.uk wrote: [snip] That said it would be nice to know the rationale for namedtuple.__new__ to have a different signature to tuple.__new__. I'm guessing namedtuple._make has a similar interface

improving performance of writing into a pipe

2013-02-18 Thread mikprog
Hi guys, on an embedded linux system (BeagleBoard) I am writing data coming from bluetooth dongle into a pipe. The function is the following one: def write_to_pipe(line): # next line ensures that bytes like '0x09' are not translated into '\t' for #example, and they are sent as such

Re: improving performance of writing into a pipe

2013-02-18 Thread Oscar Benjamin
On 18 February 2013 15:12, mikp...@gmail.com wrote: Hi guys, on an embedded linux system (BeagleBoard) I am writing data coming from bluetooth dongle into a pipe. The function is the following one: def write_to_pipe(line): # next line ensures that bytes like '0x09' are not

Re: news.gmane.org (was Re: Awsome Python - chained exceptions

2013-02-18 Thread Kwpolska
On Mon, Feb 18, 2013 at 7:30 AM, Rick Johnson rantingrickjohn...@gmail.com wrote: Terry Reedy tjreedy at udel.edu writes: For at least the 10th time, there is little to no excuse for reading and writing python-list thru google-groups. The news.gmane.org mirror has multiple interfaces: [Sent

memory management

2013-02-18 Thread Sudheer Joseph
HI, I have been trying to compute cross correlation between a time series at a location f(1) and the timeseries of spatial data f(XYT) and saving the resulting correlation coefficients and lags in a 3 dimensional array which is of fairly big size. Though the code I made for this purpose

Re: Multiple Plotting in Matplotlib

2013-02-18 Thread Nelle Varoquaux
Dear Group, I am trying to view multiple plotting files in matplotlib. My numbers range from 5 to few hundred. I was trying to use plt.subplot(), and plt.figure(n). But they did not work. plt.subplot() did not work at all. plt.figure(n) works till n=4. After that I am trying to get error

Re: improving performance of writing into a pipe

2013-02-18 Thread mikprog
On Monday, February 18, 2013 3:21:53 PM UTC, Oscar Benjamin wrote: [..] Can you not open the pipe file directly in Python code? e.g. fout = open('/tmp/mypipe', 'w') fout.write(data) I guess that this would be more efficient than using os.popen to run echo. that's an idea,

Re: Multiple Plotting in Matplotlib

2013-02-18 Thread subhabangalore
On Monday, February 18, 2013 9:18:34 PM UTC+5:30, Nelle Varoquaux wrote: Dear Group, I am trying to view multiple plotting files in matplotlib. My numbers range from 5 to few hundred. I was trying to use plt.subplot(), and plt.figure(n). But they did not work. plt.subplot()

Re: improving performance of writing into a pipe

2013-02-18 Thread Thomas Rachel
Am 18.02.2013 17:31 schrieb mikp...@gmail.com: However I get an exception while trying to open the queue: fout = open('/tmp/mypipe', 'w') I don't see an exception in your answer. Where did you put it for us? I have tried it in a command line and the call doesn't return until in another

Re: improving performance of writing into a pipe

2013-02-18 Thread mikprog
[..] I don't see an exception in your answer. Where did you put it for us? well I just did print a message: PIPEPATH = [/tmp/mypipe] [..] try: self.process = os.popen( self.PIPEPATH, 'w') except: print Error while trying opening the pipe!

Re: news.gmane.org (was Re: Awsome Python - chained exceptions

2013-02-18 Thread rurpy
On 02/17/2013 11:10 PM, Terry Reedy wrote: On 2/18/2013 12:51 AM, Rick Johnson wrote: if you (or anyone else) would be kind enough to recommend an alternative to this gawd awful software [google groups], ? i'm all ears. My expectations at minimum are: For at least the 10th time, there

Python Warts: The where, when, how, and why of a PyWart.

2013-02-18 Thread Rick Johnson
NOTE: This thread is actually an extension (of sorts) to a thread started by Anatoly tecktonik back in December 2012; posted on the python-ideas mailing list;

Re: improving performance of writing into a pipe

2013-02-18 Thread Michael Torrie
On 02/18/2013 10:00 AM, mikp...@gmail.com wrote: [..] I don't see an exception in your answer. Where did you put it for us? well I just did print a message: PIPEPATH = [/tmp/mypipe] [..] try: self.process = os.popen( self.PIPEPATH, 'w') except:

Re: news.gmane.org (was Re: Awsome Python - chained exceptions

2013-02-18 Thread Rick Johnson
rurpy at yahoo.com writes: On 02/17/2013 11:10 PM, Terry Reedy wrote: For at least the 10th time [...] And for at least the 11th time, you are wrong. There are reasons (not applicable to everyone but applicable to many) for using Google Groups, among others it is more accessible and

Python 3.3 vs. MSDOS Basic

2013-02-18 Thread John Immarino
I coded a Python solution for Problem #14 on the Project Euler website. I was very surprised to find that it took 107 sec. to run even though it's a pretty simple program. I also coded an equivalent solution for the problem in the old MSDOS basic. (That's the 16 bit app of 1980s vintage.) It

Re: improving performance of writing into a pipe

2013-02-18 Thread Serhiy Storchaka
On 18.02.13 17:12, mikp...@gmail.com wrote: on an embedded linux system (BeagleBoard) I am writing data coming from bluetooth dongle into a pipe. The function is the following one: def write_to_pipe(line): # next line ensures that bytes like '0x09' are not translated into '\t' for

request for help

2013-02-18 Thread leonardo selmi
pls i need help: i have copied the following from a book and tried to make it work: import math def area(radius): return math.pi * radius**2 def circumference(radius): return 2 * math.pi * radius i saved the above program from python shell into a file as circle.py . when i type import circle

Instances as dictionary key, __hash__ and __eq__

2013-02-18 Thread Jean-Michel Pichavant
Greetings, I opened something like a month ago a thread about hash functions and how I could write classes which instances can be safely used as dictionary keys. I though I had it but when I read back my code, I think I wrote yet another bug. Consider the following simple (buggy) class, python

Re: request for help

2013-02-18 Thread Matt Jones
Is this exactly how it shows in your shell? If so, it seems you need to indent your methods. # import math def area(radius): return math.pi * radius**2 def circumference(radius): return 2 * math.pi * radius

Re: request for help

2013-02-18 Thread Rick Johnson
leonardo selmi l.selmi at icloud.com writes: [...] i saved the above program from python shell into a file as circle.py . when i type import circle i get error.. Urm... would you be so kind as to copy and paste the error message verbatim? You have obvious syntax errors in this code due to

Re: request for help

2013-02-18 Thread Gary Herron
On 02/18/2013 11:42 AM, leonardo selmi wrote: pls i need help: i have copied the following from a book and tried to make it work: import math def area(radius): return math.pi * radius**2 def circumference(radius): return 2 * math.pi * radius i saved the above program from python shell into

Re: request for help

2013-02-18 Thread Stefan Holdermans
Leonardi, i saved the above program from python shell into a file as circle.py . when i type import circle i get error.. Next time, please mention what kind of error you're getting. Was it an indentation error? Because, as you pasted it, your code would lead to one. If I fix the

Re: request for help

2013-02-18 Thread leonardo
thanks guys and sorry for my incomplete datas, here is the error message: Traceback (most recent call last): File pyshell#0, line 1, in module import circle File circle.py, line 1 Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43) ^ SyntaxError: invalid syntax thanks

Re: request for help

2013-02-18 Thread Gary Herron
On 02/18/2013 12:14 PM, leonardo wrote: thanks guys and sorry for my incomplete datas, here is the error message: Traceback (most recent call last): File pyshell#0, line 1, in module import circle File circle.py, line 1 Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)

Re: request for help

2013-02-18 Thread Rick Johnson
leonardo tampucciolina at libero.it writes: here is the error message: [...] Okay, now we are on the road to solving this problem. But first we need to take a slight detour and learn about python packaging, because no matter what the current error is, naming a module circle and then throwing

Re: Instances as dictionary key, __hash__ and __eq__

2013-02-18 Thread Tim Delaney
On 19 February 2013 06:51, Jean-Michel Pichavant jeanmic...@sequans.comwrote: Greetings, I opened something like a month ago a thread about hash functions and how I could write classes which instances can be safely used as dictionary keys. I though I had it but when I read back my code, I

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread Terry Reedy
On 2/18/2013 6:47 AM, John Reid wrote: I was hoping namedtuples could be used as replacements for tuples in all instances. This is a mistake in the following two senses. First, tuple is a class with instances while namedtuple is a class factory that produces classes. (One could think of

Re: Python 3.3 vs. MSDOS Basic

2013-02-18 Thread Ian Kelly
On Mon, Feb 18, 2013 at 12:13 PM, John Immarino joh...@gmail.com wrote: I coded a Python solution for Problem #14 on the Project Euler website. I was very surprised to find that it took 107 sec. to run even though it's a pretty simple program. I also coded an equivalent solution for the

Re: Python 3.3 vs. MSDOS Basic

2013-02-18 Thread Chris Angelico
On Tue, Feb 19, 2013 at 6:13 AM, John Immarino joh...@gmail.com wrote: I coded a Python solution for Problem #14 on the Project Euler website. I was very surprised to find that it took 107 sec. to run even though it's a pretty simple program. I also coded an equivalent solution for the

Re: Python 3.3 vs. MSDOS Basic

2013-02-18 Thread Chris Angelico
On Tue, Feb 19, 2013 at 8:56 AM, Chris Angelico ros...@gmail.com wrote: On Tue, Feb 19, 2013 at 8:55 AM, Chris Angelico ros...@gmail.com wrote: How long did your BASIC version take, and how long did the Python version on the same hardware? Oops, my bad, you already posted the figures :) And I

Re: Python 3.3 vs. MSDOS Basic

2013-02-18 Thread Chris Angelico
On Tue, Feb 19, 2013 at 8:55 AM, Chris Angelico ros...@gmail.com wrote: How long did your BASIC version take, and how long did the Python version on the same hardware? Oops, my bad, you already posted the figures :) And I forgot to ask: Which Python version didyou use? ChrisA --

Re: Python 3.3 vs. MSDOS Basic

2013-02-18 Thread Chris Angelico
On Tue, Feb 19, 2013 at 8:54 AM, Ian Kelly ian.g.ke...@gmail.com wrote: Well, I don't see anything that looks especially slow in that code, but the algorithm that you're using is not very efficient. I rewrote it using dynamic programming (details left as an exercise), which got the runtime

Re: Python 3.3 vs. MSDOS Basic

2013-02-18 Thread Ian Kelly
On Mon, Feb 18, 2013 at 3:01 PM, Chris Angelico ros...@gmail.com wrote: On Tue, Feb 19, 2013 at 8:54 AM, Ian Kelly ian.g.ke...@gmail.com wrote: Well, I don't see anything that looks especially slow in that code, but the algorithm that you're using is not very efficient. I rewrote it using

Re: Python Warts: The where, when, how, and why of a PyWart.

2013-02-18 Thread Terry Reedy
On 2/18/2013 1:04 PM, Rick Johnson wrote: This thread is actually an extension (of sorts) to a thread started by Anatoly tecktonik back in December 2012; posted on the python-ideas mailing list; titled: Documenting Python warts on Stack Overflow. This was a threat to abuse

Re: news.gmane.org (was Re: Awsome Python - chained exceptions

2013-02-18 Thread Terry Reedy
On 2/18/2013 1:32 PM, Rick Johnson wrote: 2. When positing a new message i must enter my email address and username each time. The forms are auto-filled for replys but not for new messages. Go figure! Using the newsreader interface, I get 1 email message per list to verify the email address.

Re: Instances as dictionary key, __hash__ and __eq__

2013-02-18 Thread Terry Reedy
On 2/18/2013 2:51 PM, Jean-Michel Pichavant wrote: Greetings, I opened something like a month ago a thread about hash functions and how I could write classes which instances can be safely used as dictionary keys. I though I had it but when I read back my code, I think I wrote yet another bug.

Re: Python trademark - A request for civility

2013-02-18 Thread Gregory Ewing
Jean-Michel Pichavant wrote: They've been launching at us rantingrick attacks for a long time, Would such an attack be called a rantingrickroll? -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: request for help

2013-02-18 Thread Terry Reedy
On 2/18/2013 2:42 PM, leonardo selmi wrote: i saved the above program from python shell into a file as circle.py . Which copied too much into the file. Edit circle.py until it is a proper python program. My initial guess was that you copied the prompts, but you later message shows that it

Re: Python Warts: The where, when, how, and why of a PyWart.

2013-02-18 Thread Rick Johnson
On Monday, February 18, 2013 4:31:01 PM UTC-6, Terry Reedy wrote: This was a threat to abuse StackOverflow with off-topic posts if 'we' did not pay him more attention. If that is in-fact true then i am going to be as upset with Anatoly as you seem to be. Pointing out problems on appropriate

Re: memory management

2013-02-18 Thread Dave Angel
On 02/18/2013 10:29 AM, Sudheer Joseph wrote: HI, I have been trying to compute cross correlation between a time series at a location f(1) and the timeseries of spatial data f(XYT) and saving the resulting correlation coefficients and lags in a 3 dimensional array which is of fairly

Re: Python 3.3 vs. MSDOS Basic

2013-02-18 Thread Alexander Blinne
Am 18.02.2013 20:13, schrieb John Immarino: I coded a Python solution for Problem #14 on the Project Euler website. I was very surprised to find that it took 107 sec. to run even though it's a pretty simple program. I also coded an equivalent solution for the problem in the old MSDOS

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread Steven D'Aprano
Terry Reedy wrote: On 2/18/2013 6:47 AM, John Reid wrote: I was hoping namedtuples could be used as replacements for tuples in all instances. This is a mistake in the following two senses. First, tuple is a class with instances while namedtuple is a class factory that produces

Re: Python 3.3 vs. MSDOS Basic

2013-02-18 Thread Terry Reedy
On 2/18/2013 2:13 PM, John Immarino wrote: I coded a Python solution for Problem #14 on the Project Euler website. I was very surprised to find that it took 107 sec. to run even though it's a pretty simple program. I also coded an equivalent solution for the problem in the old MSDOS basic.

Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Jon Reyes
So I have a dictionary and the key is a number. The values are either a single tuple or a tuple of tuples. Is there a better way to go about accessing the values of the dictionary? All the tuples contain four elements. So say: col = {1: (0,1,2,3): 2: ((0,1,2,3),(2,3,4,5))} Then to access the

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Mitya Sirenef
On 02/18/2013 07:52 PM, Jon Reyes wrote: So I have a dictionary and the key is a number. The values are either a single tuple or a tuple of tuples. Is there a better way to go about accessing the values of the dictionary? All the tuples contain four elements. So say: col = {1: (0,1,2,3):

Re: memory management

2013-02-18 Thread Sudheer Joseph
Python version and OS please. And is the Python 32bit or 64bit? How much RAM does the computer have, and how big are the swapfiles ? Python 2.7.3 ubuntu 12.04 64 bit 4GB RAM Fairly big is fairly vague. To some people, a list with 100k members is huge, but not to a modern computer.

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Jon Reyes
Wow, why didn't I think of that. Thanks! I'll try it now. By the way I think I don't need to wrap the single tuples in runtime because I'm declaring that dictionary anyway beforehand and I could just do it right there. I won't be adding elements to the tuple. --

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread Roy Smith
Terry Reedy tjre...@udel.edu wrote: Initializaing a namedtuple from an iterable is unusual, and hence gets the longer syntax. I I quick look through our codebase agrees with that. I found 27 namedtuple classes. 21 were initialized with MyTuple(x, y, z) syntax. Three used MyTuple(*data).

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Jon Reyes
Sorry if I didn't check the code before I posted it, I just mocked it up in Google's editor. That's what Mitya suggested too, yep, I guess I just need to make it uniform to get rid of the extra checking. Thanks man! -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Roy Smith
In article c8abdc96-a47c-462a-9d6e-fcbaad110...@googlegroups.com, Jon Reyes everystepsa...@gmail.com wrote: So I have a dictionary and the key is a number. [...] col = {1: (0,1,2,3): 2: ((0,1,2,3),(2,3,4,5))} The keys here are strings, not numbers. But that's a detail. Somewhat more

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Mark Lawrence
On 19/02/2013 00:52, Jon Reyes wrote: So I have a dictionary and the key is a number. The values are either a single tuple or a tuple of tuples. Is there a better way to go about accessing the values of the dictionary? All the tuples contain four elements. So say: col = {1: (0,1,2,3): 2:

Re: Python 3.3 vs. MSDOS Basic

2013-02-18 Thread John Immarino
On Monday, February 18, 2013 2:58:57 PM UTC-7, Chris Angelico wrote: On Tue, Feb 19, 2013 at 8:56 AM, Chris Angelico ros...@gmail.com wrote: On Tue, Feb 19, 2013 at 8:55 AM, Chris Angelico ros...@gmail.com wrote: How long did your BASIC version take, and how long did the Python

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Jon Reyes
Hi Mark. Well, doesn't iteritems() work the same? or am I missing something? By the way I'm sure I read the dictionaries part of Python but I'm unsure if it would take int's as a key for dictionaries. I've been weaned on Java where the keys of hashmaps are always Strings. PS: Just checked,

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread Oscar Benjamin
On 19 February 2013 00:18, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Terry Reedy wrote: On 2/18/2013 6:47 AM, John Reid wrote: [snip] Is this a problem with namedtuples, ipython or just a feature? With canSequence. If isinstance was available and the above were written

Re: Python 3.3 vs. MSDOS Basic

2013-02-18 Thread John Immarino
max=0 max is a bad name -- it masks the built-in max() function m=0 while m=100: m+=1 Since m is only modified here and has a value of 1 for the first pass through, you can replace those three lines with for m in xrange(1, 101):

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Mitya Sirenef
On 02/18/2013 08:38 PM, Jon Reyes wrote: Hi Mark. Well, doesn't iteritems() work the same? or am I missing something? By the way I'm sure I read the dictionaries part of Python but I'm unsure if it would take int's as a key for dictionaries. I've been weaned on Java where the keys of hashmaps

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread alex23
On Feb 18, 9:47 pm, John Reid johnbaronr...@gmail.com wrote: See http://article.gmane.org/gmane.comp.python.ipython.user/10270 for more info. One quick workaround would be to use a tuple where required and then coerce it back to Result when needed as such: def sleep(secs): import os,

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Dave Angel
On 02/18/2013 08:38 PM, Jon Reyes wrote: Hi Mark. Well, doesn't iteritems() work the same? or am I missing something? By the way I'm sure I read the dictionaries part of Python but I'm unsure if it would take int's as a key for dictionaries. I've been weaned on Java where the keys of hashmaps

Re: Awsome Python - chained exceptions

2013-02-18 Thread alex23
On Feb 18, 3:51 pm, Rick Johnson rantingrickjohn...@gmail.com wrote: I apologize for this doubling of my messages and i can assure you i don't do this intentionally. Proper netiquette is very important to me. These double posts are another unfortunate side-effect of using the buggy Google

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Jon Reyes
Thanks Dave and Mitya for enlightening me about dictionaries. I'm still confused about this though: so that if two key objects are equal, they stay equal, and if they differ, they stay different. What does this mean? I won't be comparing key objects with one another. Also, when I had two

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Mark Lawrence
On 19/02/2013 01:38, Jon Reyes wrote: Hi Mark. Well, doesn't iteritems() work the same? It's iteritems for Python 2, items for Python 3. -- Cheers. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Jon Reyes
Oh, I see, thanks! I was thinking I'll study 2.7 and once I'm comfortable with Python as a language I'll move to 3. Heck, I don't even know how to create a simple main method. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Mitya Sirenef
On 02/18/2013 09:17 PM, Jon Reyes wrote: Thanks Dave and Mitya for enlightening me about dictionaries. I'm still confused about this though: so that if two key objects are equal, they stay equal, and if they differ, they stay different. What does this mean? I won't be comparing key

Re: Python 3.3 vs. MSDOS Basic

2013-02-18 Thread Chris Angelico
On Tue, Feb 19, 2013 at 12:39 PM, John Immarino joh...@gmail.com wrote: On Monday, February 18, 2013 2:58:57 PM UTC-7, Chris Angelico wrote: On Tue, Feb 19, 2013 at 8:56 AM, Chris Angelico ros...@gmail.com wrote: On Tue, Feb 19, 2013 at 8:55 AM, Chris Angelico ros...@gmail.com wrote: How

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread Steven D'Aprano
Oscar Benjamin wrote: On 19 February 2013 00:18, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Terry Reedy wrote: On 2/18/2013 6:47 AM, John Reid wrote: [snip] Is this a problem with namedtuples, ipython or just a feature? With canSequence. If isinstance was available and

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Dave Angel
On 02/18/2013 09:54 PM, Mitya Sirenef wrote: On 02/18/2013 09:17 PM, Jon Reyes wrote: Thanks Dave and Mitya for enlightening me about dictionaries. I'm still confused about this though: so that if two key objects are equal, they stay equal, and if they differ, they stay different.

Re: Python Warts: The where, when, how, and why of a PyWart.

2013-02-18 Thread Terry Reedy
On 2/18/2013 6:55 PM, Rick Johnson wrote: Pointing out problems on appropriate list is fine, I agree. Python-list is the most free among python.org lists. But i don't believe a Bug Tracker and a Language Wart listing are the same. I agree. Anyone is free to make their own site or blog,

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Mitya Sirenef
On 02/18/2013 10:14 PM, Dave Angel wrote: On 02/18/2013 09:54 PM, Mitya Sirenef wrote: On 02/18/2013 09:17 PM, Jon Reyes wrote: Thanks Dave and Mitya for enlightening me about dictionaries. I'm still confused about this though: so that if two key objects are equal, they stay equal,

Re: Python 3.3 vs. MSDOS Basic

2013-02-18 Thread Nick Mellor
Hi John, Thanks for the problem. I've been writing Python for about 4 years now and am beginning to feel like I'm writing much better Python code. Python does fine on this problem if you play to its strengths. The following uses dictionary lookups to store previously computed sequence lengths,

Re: First attempt at a Python prog (Chess)

2013-02-18 Thread Tim Roberts
Chris Hinsley chris.hins...@gmail.com wrote: Is a Python list as fast as a bytearray ? Python does not actually have a native array type. Everything in your program that looked like an array was actually a list. -- Tim Roberts, t...@probo.com Providenza Boekelheide, Inc. --

Re: Python 3.3 vs. MSDOS Basic

2013-02-18 Thread Terry Reedy
On 2/18/2013 4:55 PM, Chris Angelico wrote: Running under Python 2.6, both your version and mine take about 90 seconds to run. But under Python 3.3, where (among other things) range() yields values lazily, my version is significantly faster than yours. BUT! Both versions, under 3.3, are

PIL ImageChops.difference not working correctly(?)

2013-02-18 Thread Jon Reyes
I have two images generated from ImageMagick that I need to compare through PIL but when I compare them it says that the two images aren't identical. I tried viewing the supposed difference but all I see is a black image which means the two image are identical. ImageChops even returns the

Re: PIL ImageChops.difference not working correctly(?)

2013-02-18 Thread Jon Reyes
Wow, what the heck, I just learned that using beyond compare if I compare the two images then I'll see a different section under tolerance mode. Anyone an expert on images? The two images have whites on that same image but they're different according to BeyondCompare. What's more, if I do a

Re: First attempt at a Python prog (Chess)

2013-02-18 Thread Steven D'Aprano
On Mon, 18 Feb 2013 20:15:28 -0800, Tim Roberts wrote: Chris Hinsley chris.hins...@gmail.com wrote: Is a Python list as fast as a bytearray ? Python does not actually have a native array type. Everything in your program that looked like an array was actually a list. Actually it does, but

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread raymond . hettinger
On Monday, February 18, 2013 6:09:16 AM UTC-8, John Reid wrote: I'm aware how to construct the namedtuple and the tuple. My point was that they use different syntaxes for the same operation and this seems to break ipython. I was wondering if this is a necessary design feature or perhaps just

Re: Differences creating tuples and collections.namedtuples

2013-02-18 Thread Gregory Ewing
Steven D'Aprano wrote: Terry Reedy wrote: In fact, one reason to subclass a class is to change the initialization api. That might be a reason that people give, but it's a bad reason from the perspective of interface contracts, duck-typing and the LSP. Only if you're going to pass the

  1   2   >