Re: [Tutor] Why difference between printing string typing its object reference at the prompt?

2012-10-04 Thread Dave Angel
On 10/03/2012 11:11 PM, boB Stepp wrote: Thanks to all who responded. SNIP. What happens if str() or repr() is not supported by a particular object? Is an exception thrown, an empty string returned or something else I am not imagining? Let's try it and see: class A:pass ... a = A() a

Re: [Tutor] modifying lists of lists

2012-10-04 Thread Dave Angel
On 10/03/2012 11:52 PM, Ed Owens wrote: You are fundamentally correct about my confusion, though I'm trying to work with tuples as the lowest level, which may not be relevant here. The tuples are an example of an immutable object. An immutable object (which contains only immutable objects) may

Re: [Tutor] Why difference between printing string typing its object reference at the prompt?

2012-10-04 Thread Steven D'Aprano
On 04/10/12 13:39, boB Stepp wrote: But not always. For example: py from decimal import Decimal as D py x = D(1.23) py print(str(x)) 1.23 py print(repr(x)) Decimal('1.23') These contrasting examples are very illuminating. So in print(str(x)) the object, D(1.23), is being converted into a

Re: [Tutor] Why difference between printing string typing its object reference at the prompt?

2012-10-04 Thread Steven D'Aprano
On 04/10/12 13:11, boB Stepp wrote: What happens if str() or repr() is not supported by a particular object? Is an exception thrown, an empty string returned or something else I am not imagining? I don't think that is possible, at least not by accident or neglect. In Python 3, everything

[Tutor] MAXIMUM LOOP LOGIC

2012-10-04 Thread medusa
Hello i got stuck with the last bit of my programming practice. Can somebody help me? Write a program to read through a mail log, and figure out who had the most messages in the file. The program looks for “From” lines and takes the second parameter on those lines as the person who sent the

[Tutor] Newbie help with .pyc

2012-10-04 Thread tfahey1
Hey everyone, I am a Maya user, so I only come into contact with Python scripting on a surface level, but I downloaded a python script from a CG website that I would like to check out but I am getting an error when it is run. The only file included was a .pyc file. I'm wondering if there should

Re: [Tutor] modifying lists of lists

2012-10-04 Thread eryksun
On Thu, Oct 4, 2012 at 7:21 AM, Dave Angel d...@davea.name wrote: This is how eryksun knew that a shallow copy was good enough. And for a shallow copy, using the slice notation is perfect. J42 = [H[:1]] print J42[0] [(1, 2)] print id(J42[0]) 13964568 (Note that my shallow copy is not

Re: [Tutor] Why difference between printing string typing its object reference at the prompt?

2012-10-04 Thread eryksun
On Wed, Oct 3, 2012 at 11:11 PM, boB Stepp robertvst...@gmail.com wrote: What happens if str() or repr() is not supported by a particular object? Is an exception thrown, an empty string returned or something else I am not imagining? The __str__ method inherited from object calls __repr__.

Re: [Tutor] Newbie help with .pyc

2012-10-04 Thread Steven D'Aprano
On 05/10/12 01:21, tfahey1 wrote: Hey everyone, I am a Maya user, so I only come into contact with Python scripting on a surface level, but I downloaded a python script from a CG website that I would like to check out but I am getting an error when it is run. Would you like us to guess what

Re: [Tutor] need help new to python

2012-10-04 Thread Joel Goldstick
On Wed, Oct 3, 2012 at 11:38 AM, bballplaya5...@aim.com wrote: Hi im new to python and im stuck on my homework. I have to define the functions appropriately in the python file so they all test and work but im not even sure where to begin or what to I could really use some help. Ive attached

Re: [Tutor] [Tkinter-discuss] displaying an image

2012-10-04 Thread Matthew Ngaha
You need to install PIL to use the tutorial you are doing. http://www.pythonware.com/products/pil/ the site says The current free version is PIL 1.1.7. This release supports Python 1.5.2 and newer, including 2.5 and 2.6. A version for 3.X will be released later. i have python 3. all the

[Tutor] rounding up to the nearest multiple of 8

2012-10-04 Thread Albert-Jan Roskam
Hi,   The function below works, but it's such a kludge! Is there a way to make this more elegant? As said in the docstring, I want to round up a given integer to the nearest multiple of 8. I was thinking of something like math.ceil.   def _getPadding(charlen):     Helper function to replace

Re: [Tutor] Tutor Digest, Vol 104, Issue 24

2012-10-04 Thread Aceway
your last for iterater maybe should like this: for key,values in messages: if max is None or valuesmax: sender=key max=values 在 2012-10-5,1:13,tutor-requ...@python.org 写道: Send Tutor mailing list submissions to tutor@python.org To subscribe or unsubscribe via the

Re: [Tutor] rounding up to the nearest multiple of 8

2012-10-04 Thread Joel Goldstick
On Thu, Oct 4, 2012 at 3:47 PM, Albert-Jan Roskam fo...@yahoo.com wrote: Hi, The function below works, but it's such a kludge! Is there a way to make this more elegant? As said in the docstring, I want to round up a given integer to the nearest multiple of 8. I was thinking of something

Re: [Tutor] Hello Can someone looked at my problem? stuck

2012-10-04 Thread Walter Prins
On 3 October 2012 04:39, Palice Fan magicwizards...@gmail.com wrote: Hello i got stuck with the last bit of my programming practice. Can somebody help me? Write a program to read through a mail log, and figure out who had the most messages in the file. The program looks for “From” lines and

Re: [Tutor] MAXIMUM LOOP LOGIC

2012-10-04 Thread Brian van den Broek
On 4 Oct 2012 13:22, medusa magicwizards...@gmail.com wrote: Hello i got stuck with the last bit of my programming practice. snip Instead of printing off a number beside the email, i got another email and i dont know how to fix it. http://python.6.n6.nabble.com/file/n4990842/9.4_stuck.png

Re: [Tutor] rounding up to the nearest multiple of 8

2012-10-04 Thread eryksun
On Thu, Oct 4, 2012 at 4:04 PM, Joel Goldstick joel.goldst...@gmail.com wrote: my_string = 123 pad = 8 - len(my_string) % 8 my_string = my_string + * pad my_string '123 ' If len(my_string) is already a multiple of 8, the above sets pad to 8: s = 12345678 pad = 8 -

[Tutor] I Need Help With Using Tkinter/Console/Creating GUIs

2012-10-04 Thread tayo rotimi
Hi, I recently started learning as a python programming 'absolute beginner'. I have Python 3.2 installed on my laptop, and I have learned to a point where I need to create GUIs. I understand from the text book I am reading that all I need to have access to the Tkinter toolkits in a window-OS

Re: [Tutor] I Need Help With Using Tkinter/Console/Creating GUIs

2012-10-04 Thread Steven D'Aprano
On 05/10/12 07:30, tayo rotimi wrote: Hi, I recently started learning as a python programming 'absolute beginner'. I have Python 3.2 installed on my laptop, and I have learned to a point where I need to create GUIs. I understand from the text book I am reading that all I need to have access

Re: [Tutor] [Tkinter-discuss] displaying an image

2012-10-04 Thread Oscar Benjamin
On 4 October 2012 20:31, Matthew Ngaha chigga...@gmail.com wrote: You need to install PIL to use the tutorial you are doing. http://www.pythonware.com/products/pil/ the site says The current free version is PIL 1.1.7. This release supports Python 1.5.2 and newer, including 2.5 and 2.6. A

Re: [Tutor] Newbie help with .pyc

2012-10-04 Thread ken brockman
I wonder if they might be a way for some on this forum to dispense advice and help others without the totally snide and obnoxious attitude? if it is so painfully annoying for you to deal with, why subject yourself to it? I suspect it is the sheer joy of showing others how bright you are and

Re: [Tutor] Newbie help with .pyc

2012-10-04 Thread Ashfaq
Hey Ken, Steve has just made some innocent fun. He is eager to help the guy. Please don't be so harsh. Sincerely Ashfaq ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] [Tkinter-discuss] displaying an image

2012-10-04 Thread eryksun
On Thu, Oct 4, 2012 at 3:31 PM, Matthew Ngaha chigga...@gmail.com wrote: You need to install PIL to use the tutorial you are doing. http://www.pythonware.com/products/pil/ the site says The current free version is PIL 1.1.7. This release supports Python 1.5.2 and newer, including 2.5 and

Re: [Tutor] [Tkinter-discuss] displaying an image

2012-10-04 Thread eryksun
On Fri, Oct 5, 2012 at 12:39 AM, eryksun eryk...@gmail.com wrote: # apt-get install build-essential python3-dev tk8.5-dev \ libjpeg8-dev liblcms1-dev libfreetype6-dev I forgot zlib: # apt-get install build-essential python3-dev tk8.5-dev \ libjpeg8-dev liblcms1-dev