[Tutor] List comprehension possible with condition statements?

2010-03-03 Thread Jojo Mwebaze
Hi There, i would like to implement the following in lists assuming x = 3 y = 4 z = None i want to create a dynamic list such that mylist = [ x , y, z ] , if z in not None if z is None then mylist = [x,y] Anyhelp! cheers Jojo ___ Tutor maillis

[Tutor] Encoding

2010-03-03 Thread Giorgio
Hi, i am looking for more informations about encoding in python: i've read that Amazon SimpleDB accepts every string encoded in UTF-8. How can I encode a string? And, what's the default string encoding in python? the other question is about mysql DB: if i have a mysql field latin1 and extract hi

Re: [Tutor] List comprehension possible with condition statements?

2010-03-03 Thread Alan Gauld
"Jojo Mwebaze" wrote i would like to implement the following in lists assuming x = 3 y = 4 z = None i want to create a dynamic list such that mylist = [ x , y, z ] , if z in not None if z is None then mylist = [x,y] Assuming you actually mean that you don;t want to include any item

Re: [Tutor] List comprehension possible with condition statements?

2010-03-03 Thread C.T. Matsumoto
Jojo Mwebaze wrote: Hi There, i would like to implement the following in lists assuming x = 3 y = 4 z = None i want to create a dynamic list such that mylist = [ x , y, z ] , if z in not None if z is None then mylist = [x,y] Anyhelp! cheers Jojo --

Re: [Tutor] List comprehension possible with condition statements?

2010-03-03 Thread Christian Witts
Jojo Mwebaze wrote: Hi There, i would like to implement the following in lists assuming x = 3 y = 4 z = None i want to create a dynamic list such that mylist = [ x , y, z ] , if z in not None if z is None then mylist = [x,y] Anyhelp! cheers Jojo --

Re: [Tutor] List comprehension possible with condition statements?

2010-03-03 Thread Dave Angel
Jojo Mwebaze wrote: Hi There, i would like to implement the following in lists assuming x = 3 y = 4 z = None i want to create a dynamic list such that mylist = [ x , y, z ] , if z in not None if z is None then mylist = [x,y] Anyhelp! cheers Jojo Are there any constraints on x an

Re: [Tutor] Encoding

2010-03-03 Thread Stefan Behnel
Giorgio, 03.03.2010 09:36: i am looking for more informations about encoding in python: i've read that Amazon SimpleDB accepts every string encoded in UTF-8. How can I encode a string? byte_string = unicode_string.encode('utf-8') If you use unicode strings throughout your application, you w

Re: [Tutor] List comprehension possible with condition statements?

2010-03-03 Thread Jojo Mwebaze
Thanks to everyone, nice ideas! cheers On Wed, Mar 3, 2010 at 10:02 AM, Christian Witts wrote: > Jojo Mwebaze wrote: > >> Hi There, >> >> i would like to implement the following in lists >> >> assuming >> >> x = 3 >> y = 4 >> z = None >> >> i want to create a dynamic list such that >> >> mylist

Re: [Tutor] List comprehension possible with condition statements?

2010-03-03 Thread C.T. Matsumoto
Dave Angel wrote: Jojo Mwebaze wrote: Hi There, i would like to implement the following in lists assuming x = 3 y = 4 z = None i want to create a dynamic list such that mylist = [ x , y, z ] , if z in not None if z is None then mylist = [x,y] Anyhelp! cheers Jojo Are there any

Re: [Tutor] List comprehension possible with condition statements?

2010-03-03 Thread Steven D'Aprano
On Wed, 3 Mar 2010 07:46:39 pm Alan Gauld wrote: > mylist = [irtem for item in aList where item != None] Comparisons with None almost always should be one of: item is None item is not None The reason is that "item is None" is ONLY ever true if the item actually is the singleton object None (ac

[Tutor] sorting algorithm

2010-03-03 Thread C.T. Matsumoto
Hello, This is follow up on a question I had about algorithms. In the thread it was suggested I make my own sorting algorithm. Here are my results. #!/usr/bin/python def sort_(list_): for item1 in list_: pos1 = list_.index(item1) pos2 = pos1 + 1 try: item2

Re: [Tutor] Why is the max size so low in this mail list?

2010-03-03 Thread spir
On Wed, 03 Mar 2010 02:38:57 +1100 Lie Ryan wrote: > On 03/02/2010 04:13 AM, Wayne Watson wrote: > > See Subject. 40K here, but other Python lists allow for larger (total) > > sizes. > > I don't know, I've never realized it; that's an indication that the 40K > limit is reasonable, at least to me

Re: [Tutor] Encoding

2010-03-03 Thread Patrick Sabin
Giorgio wrote: i am looking for more informations about encoding in python: i've read that Amazon SimpleDB accepts every string encoded in UTF-8. How can I encode a string? And, what's the default string encoding in python? I think the safest way is to use unicode strings in your application

Re: [Tutor] Encoding

2010-03-03 Thread Giorgio
> > >> byte_string = unicode_string.encode('utf-8') > > If you use unicode strings throughout your application, you will be happy > with the above. Note that this is an advice, not a condition. Mmm ok. So all strings in the app are unicode by default? Do you know if there is a function/method

Re: [Tutor] Encoding

2010-03-03 Thread Giorgio
Oh, sorry, let me update my last post: if i have a string, let's say: s = "hi giorgio"; and want to store it in a latin1 db, i need to convert it to latin1 before storing, right? 2010/3/3 Giorgio > >>> byte_string = unicode_string.encode('utf-8') >> >> If you use unicode strings throughout y

[Tutor] Bowing out

2010-03-03 Thread Kent Johnson
Hi all, After six years of tutor posts my interest and energy have waned and I'm ready to move on to something new. I'm planning to stop reading and contributing to the list. I have handed over list moderation duties to Alan Gauld and Wesley Chun. Thanks to everyone who contributes questions and

Re: [Tutor] Encoding

2010-03-03 Thread Patrick Sabin
Mmm ok. So all strings in the app are unicode by default? Depends on your python version. If you use python 2.x, you have to use a u before the string: s = u'Hallo World' Do you know if there is a function/method i can use to check encoding of a string? AFAIK such a function doesn't exis

Re: [Tutor] Bowing out

2010-03-03 Thread kevin parks
Dang! I wish you were not going. But really, I have to say a HUGE thank you to you for all the fine teaching you have done on this list. I learned so much from reading your posts. Thanks for all the time and effort (and code) you put into this! I wish you were staying. Hats off to you. Wi

Re: [Tutor] Bowing out

2010-03-03 Thread Shashwat Anand
Kent We salute you. Thanks for everything you did for the community. ~l0nwlf On Wed, Mar 3, 2010 at 7:09 PM, kevin parks wrote: > Dang! > > I wish you were not going. But really, I have to say a HUGE thank you to > you for all the fine teaching you have done on this list. I learned so much > f

Re: [Tutor] Encoding

2010-03-03 Thread Stefan Behnel
Giorgio, 03.03.2010 14:09: byte_string = unicode_string.encode('utf-8') If you use unicode strings throughout your application, you will be happy with the above. Note that this is an advice, not a condition. Mmm ok. So all strings in the app are unicode by default? Do you know if there is

Re: [Tutor] Bowing out

2010-03-03 Thread عمـ نوفل ـاد
On Wed, Mar 3, 2010 at 9:17 AM, Shashwat Anand wrote: > Kent > > We salute you. Thanks for everything you did for the community. > > ~l0nwlf > > > On Wed, Mar 3, 2010 at 7:09 PM, kevin parks wrote: > >> Dang! >> >> I wish you were not going. But really, I have to say a HUGE thank you to >> you fo

Re: [Tutor] Encoding

2010-03-03 Thread Giorgio
> > >> Depends on your python version. If you use python 2.x, you have to use a > u before the string: > > s = u'Hallo World' Ok. So, let's go back to my first question: s = u'Hallo World' is unicode in python 2.x -> ok s = 'Hallo World' how is encoded? >> I think the encoding of the db doesn

Re: [Tutor] Bowing out

2010-03-03 Thread Vern Ceder
Kent, Thanks for all of the work you've done over the years to help make this one of the best/most useful lists around. Enjoy the new challenges ahead! It was great to finally meet you at PyCon! Cheers, Vern Kent Johnson wrote: Hi all, After six years of tutor posts my interest and energy

Re: [Tutor] Bowing out

2010-03-03 Thread Daniel Sarmiento
> > Date: Wed, 3 Mar 2010 08:17:45 -0500 > From: Kent Johnson > To: Tutor@python.org > Subject: [Tutor] Bowing out > Message-ID: ><1c2a2c591003030517r66cf067fgf2f5a052a4a08...@mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > Hi all, > > After six years of tutor posts my i

Re: [Tutor] Bowing out

2010-03-03 Thread Wayne Werner
I can only add my personal thanks, and echo the sentiments of others. I'm certainly glad the archives exist, and that those inheriting responsibility are certainly well qualified. So long and thanks for all the fish! -Wayne 2010/3/3 Emad Nawfal (عمـ نوفل ـاد) > > > On Wed, Mar 3, 2010 at 9:17

Re: [Tutor] Bowing out

2010-03-03 Thread Modulok
> After six years of tutor posts my interest and energy have waned and > I'm ready to move on to something new. I'm planning to stop reading > and contributing to the list. I have handed over list moderation > duties to Alan Gauld and Wesley Chun. > > Thanks to everyone who contributes questions an

Re: [Tutor] Bowing out

2010-03-03 Thread Philip Kilner
Hi Kent, Thank you! -- Regards, PhilK 'work as if you lived in the early days of a better nation' - alasdair gray smime.p7s Description: S/MIME Cryptographic Signature ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription

Re: [Tutor] Encoding

2010-03-03 Thread Stefan Behnel
Giorgio, 03.03.2010 15:50: Depends on your python version. If you use python 2.x, you have to use a u before the string: s = u'Hallo World' Ok. So, let's go back to my first question: s = u'Hallo World' is unicode in python 2.x -> ok Correct. s = 'Hallo World' how is encoded? Depend

Re: [Tutor] Encoding

2010-03-03 Thread Patrick Sabin
Giorgio wrote: Depends on your python version. If you use python 2.x, you have to use a u before the string: s = u'Hallo World' Ok. So, let's go back to my first question: s = u'Hallo World' is unicode in python 2.x -> ok s = 'Hallo World' how is encoded? I am not 100% sure,

Re: [Tutor] Bowing out

2010-03-03 Thread Dave Angel
Kent Johnson wrote: Hi all, After six years of tutor posts my interest and energy have waned and I'm ready to move on to something new. I'm planning to stop reading and contributing to the list. I have handed over list moderation duties to Alan Gauld and Wesley Chun. Thanks to everyone who cont

Re: [Tutor] Encoding

2010-03-03 Thread Giorgio
Uff, encoding is a very painful thing in programming. Ok so now comes last "layer" of the encoding: the webserver. I now know how to handle encoding in a python app and in interactions with the db, but the last step is sending the content to the webserver. How should i encode pages? The encoding

Re: [Tutor] sorting algorithm

2010-03-03 Thread Dave Angel
C.T. Matsumoto wrote: Hello, This is follow up on a question I had about algorithms. In the thread it was suggested I make my own sorting algorithm. Here are my results. #!/usr/bin/python def sort_(list_): for item1 in list_: pos1 = list_.index(item1) pos2 = pos1 + 1

Re: [Tutor] Encoding

2010-03-03 Thread Dave Angel
Giorgio wrote: Depends on your python version. If you use python 2.x, you have to use a u before the string: s = u'Hallo World' Ok. So, let's go back to my first question: s = u'Hallo World' is unicode in python 2.x -> ok s = 'Hallo World' how is encoded? Since it's a

Re: [Tutor] Bowing out

2010-03-03 Thread Sander Sweers
On 3 March 2010 14:17, Kent Johnson wrote: > After six years of tutor posts my interest and energy have waned and > I'm ready to move on to something new. Let me join the other people and thank you for your contribution to this list. Good luck with something new :-) Greets Sander ___

Re: [Tutor] Encoding

2010-03-03 Thread Giorgio
Ok. So, how do you encode .py files? UTF-8? 2010/3/3 Dave Angel > Giorgio wrote: > >> >>> Depends on your python version. If you use python 2.x, you have to use a >>> u before the string: >>> >>> s = u'Hallo World' >>> >>> >> >> >> Ok. So, let's go back to my first question

Re: [Tutor] Bowing out

2010-03-03 Thread Albert-Jan Roskam
Hi Kent, Thank you very much for sharing your knowledge. Much appreciated! Cheers!! Albert-Jan ~~ In the face of ambiguity, refuse the temptation to guess. ~~~

[Tutor] no bowing out for you

2010-03-03 Thread Gman
Nope ya can't do it Kent, we wont have it ! Looks like a good time to start a patitiion to get you a salary or something to keep you on :) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/

Re: [Tutor] getting diagonals from a matrix

2010-03-03 Thread Emile van Sebille
On 3/2/2010 2:54 PM David Eccles (gringer) said... I've managed to drum up some code to obtain a list containing joined diagonal elements of a matrix (I'm making a word finder generator), but am wondering if there's any better way to do this: This works. Lots of other ways would work too. Wha

Re: [Tutor] Bowing out

2010-03-03 Thread Hansen, Mike
> -Original Message- > From: tutor-bounces+mike.hansen=atmel@python.org > [mailto:tutor-bounces+mike.hansen=atmel@python.org] On > Behalf Of Kent Johnson > Sent: Wednesday, March 03, 2010 6:18 AM > To: Tutor@python.org > Subject: [Tutor] Bowing out > > Hi all, > > After six year

[Tutor] Script Building

2010-03-03 Thread David Hutto
I'm new to Python, so I thought as a first project I'd create a basic script building wizard to help with my understanding of the flow, and for basic practice. The following is a outline of what I would initially like to accomplish. I've begun creating small functions, and very lightly worded

Re: [Tutor] Bowing out

2010-03-03 Thread Robert
so you're "done" with Python ? :) > On 3 March 2010 14:17, Kent Johnson wrote: >> After six years of tutor posts my interest and energy have waned and >> I'm ready to move on to something new. ___ Tutor maillist - Tutor@python.org To unsubscribe or c

Re: [Tutor] Bowing out

2010-03-03 Thread David Hutto
--- On Wed, 3/3/10, Sander Sweers wrote: From: Sander Sweers Subject: Re: [Tutor] Bowing out To: "Kent Johnson" Cc: Tutor@python.org Date: Wednesday, March 3, 2010, 11:06 AM On 3 March 2010 14:17, Kent Johnson wrote: > After six years of tutor posts my interest and energy have waned and > I

Re: [Tutor] Bowing out

2010-03-03 Thread Glen Zangirolami
Thank you for all your hard work! I learned a ton from your tutorials. Good luck on your future endeavors. On Wed, Mar 3, 2010 at 10:18 AM, Albert-Jan Roskam wrote: > Hi Kent, > > Thank you very much for sharing your knowledge. Much appreciated! > > Cheers!! > Albert-Jan > > ~~~

Re: [Tutor] getting diagonals from a matrix

2010-03-03 Thread Glen Zangirolami
I am not really sure of a better way but if your looking for a way to make your code cleaner or more efficient you can try Numpy - http://numpy.scipy.org/ On Tue, Mar 2, 2010 at 4:54 PM, David Eccles (gringer) wrote: > I've managed to drum up some code to obtain a list containing joined > diagon

[Tutor] unittest

2010-03-03 Thread C.T. Matsumoto
Hello, Can someone tell me the difference between unittests assertEqual and assertEquals? Cheers, T ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Encoding

2010-03-03 Thread Giorgio
Ops, i have another update: string = u"blabla" This is unicode, ok. Unicode UTF-8? Thankyou 2010/3/3 Giorgio > Ok. > > So, how do you encode .py files? UTF-8? > > 2010/3/3 Dave Angel > > Giorgio wrote: >> >>> > Depends on your python version. If you use python 2.x, you have to use

[Tutor] lazy? vs not lazy? and yielding

2010-03-03 Thread John
Hi, I just read a few pages of tutorial on list comprehenion and generator expression. From what I gather the difference is "[ ]" and "( )" at the ends, better memory usage and the something the tutorial labeled as "lazy evaluation". So a generator 'yields'. But what is it yielding too? J

Re: [Tutor] sorting algorithm

2010-03-03 Thread Glen Zangirolami
http://www.sorting-algorithms.com/ It is a fantastic website that explains each kind of sort and how it works. They also show you visuals how the sorts work and how fast they go based on the amount of data. Depending on the amount/kind of data I would choose a sorting algorithm that fits your nee

Re: [Tutor] sorting algorithm

2010-03-03 Thread C.T. Matsumoto
Dave Angel wrote: C.T. Matsumoto wrote: Hello, This is follow up on a question I had about algorithms. In the thread it was suggested I make my own sorting algorithm. Here are my results. #!/usr/bin/python def sort_(list_): for item1 in list_: pos1 = list_.index(item1) pos

Re: [Tutor] Bowing out

2010-03-03 Thread David
>> After six years of tutor posts my interest and energy have waned and >> I'm ready to move on to something new. Another new Python student that received understanding from your style and knowledge, great teacher. I hope you will post some more tutorials on Kents Korner when you find the time and

[Tutor] How to wrap ctype functions

2010-03-03 Thread Jan Jansen
Hi there, I wonder what's the best way to wrap given function calls (in this case ctype function calls but more generally built-in functions and those kinds). I have a huge c library and almost all functions return an error code. The library also contains a function, that returns the corresponding

Re: [Tutor] sorting algorithm

2010-03-03 Thread Dave Angel
(You forgot to do a Reply-All, so your message went to just me, rather than to me and the list ) C.T. Matsumoto wrote: Dave Angel wrote: C.T. Matsumoto wrote: Hello, This is follow up on a question I had about algorithms. In the thread it was suggested I make my own sorting algorithm. He

Re: [Tutor] List comprehension possible with condition statements?

2010-03-03 Thread Alan Gauld
"Steven D'Aprano" wrote Comparisons with None almost always should be one of: item is None item is not None Yes, but the reason I changed it (I originally had "is not") is that != is a more general test for illustrating the use of 'if' within a LC which seemed to be the real issue within the

Re: [Tutor] Bowing out

2010-03-03 Thread Alan Gauld
"kevin parks" wrote Wish Danny Yoo was still here too. Technically he is, but just keeps very, very quiet! :-) Alan G. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinf

Re: [Tutor] Encoding

2010-03-03 Thread Stefan Behnel
Giorgio, 03.03.2010 18:28: string = u"blabla" This is unicode, ok. Unicode UTF-8? No, not UTF-8. Unicode. You may want to read this: http://www.amk.ca/python/howto/unicode Stefan ___ Tutor maillist - Tutor@python.org To unsubscribe or change su

Re: [Tutor] Bowing out

2010-03-03 Thread Ken G.
Thanks for helping out. I enjoyed readying your posts. Good luck on your future endeavors. Ken Kent Johnson wrote: Hi all, After six years of tutor posts my interest and energy have waned and I'm ready to move on to something new. I'm planning to stop reading and contributing to the list. I

Re: [Tutor] Encoding

2010-03-03 Thread Giorgio
Please let me post the third update O_o. You can forgot other 2, i'll put them into this email. --- >>> s = "ciao è ciao" >>> print s ciao è ciao >>> s.encode('utf-8') Traceback (most recent call last): File "", line 1, in s.encode('utf-8') UnicodeDecodeError: 'ascii' codec can't decode by

Re: [Tutor] Encoding

2010-03-03 Thread Giorgio
I'm sorry, it's utf8_unicode_ci that's confusing me. So, "UTF-8 is one of the most commonly used encodings. UTF stands for "Unicode Transformation Format"" UTF8 is, we can say, a type of "unicode", right? And what about utf8_unicode_ci in mysql? Giorgio 2010/3/3 Stefan Behnel > Giorgio, 03.03.

Re: [Tutor] lazy? vs not lazy? and yielding

2010-03-03 Thread Dave Angel
John wrote: Hi, I just read a few pages of tutorial on list comprehenion and generator expression. From what I gather the difference is "[ ]" and "( )" at the ends, better memory usage and the something the tutorial labeled as "lazy evaluation". So a generator 'yields'. But what is it yiel

Re: [Tutor] Encoding

2010-03-03 Thread Dave Angel
(Don't top-post. Put your response below whatever you're responding to, or at the bottom.) Giorgio wrote: Ok. So, how do you encode .py files? UTF-8? 2010/3/3 Dave Angel I personally use Komodo to edit my python source files, and tell it to use UTF8 encoding. Then I add a encoding lin

Re: [Tutor] Encoding

2010-03-03 Thread Sander Sweers
On 3 March 2010 20:44, Giorgio wrote: s = "ciao è ciao" print s > ciao è ciao s.encode('utf-8') > Traceback (most recent call last): >   File "", line 1, in >     s.encode('utf-8') > UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 5: > ordinal not in range(128)

Re: [Tutor] How to wrap ctype functions

2010-03-03 Thread Hugo Arts
On Wed, Mar 3, 2010 at 6:43 PM, Jan Jansen wrote: > Hi there, > > I wonder what's the best way to wrap given function calls (in this case > ctype function calls but more generally built-in functions and those kinds). > I have a huge c library and almost all functions return an error code. The > li

Re: [Tutor] Bowing out

2010-03-03 Thread Kent Johnson
On Wed, Mar 3, 2010 at 11:51 AM, Robert wrote: > so you're "done" with Python ? :) No, I hope not! I still love Python, but my enthusiasm for beginners questions has pretty much gone away. I'm looking for a place where I can contribute code rather than answers, possibly with the Mercurial project

Re: [Tutor] unittest

2010-03-03 Thread Steven D'Aprano
On Thu, 4 Mar 2010 04:27:23 am C.T. Matsumoto wrote: > Hello, > > Can someone tell me the difference between unittests assertEqual and > assertEquals? assertEqual, assertEquals and failUnless are three spellings for the same thing. There is no difference. -- Steven D'Aprano __

Re: [Tutor] Encoding

2010-03-03 Thread Sander Sweers
On 3 March 2010 22:41, Sander Sweers wrote: > It is confusing but once understand how it works it makes sense. I remembered Kent explained it very clear in [1]. Greets Sander [1] http://mail.python.org/pipermail/tutor/2009-May/068920.html ___ Tutor ma

Re: [Tutor] sorting algorithm

2010-03-03 Thread Steven D'Aprano
On Thu, 4 Mar 2010 04:34:09 am Glen Zangirolami wrote: > http://www.sorting-algorithms.com/ > > It is a fantastic website that explains each kind of sort and how it > works. They also show you visuals how the sorts work and how fast > they go based on the amount of data. For actual practical work,

Re: [Tutor] How to wrap ctype functions

2010-03-03 Thread Steven D'Aprano
On Thu, 4 Mar 2010 04:43:28 am Jan Jansen wrote: > Hi there, > > I wonder what's the best way to wrap given function calls (in this > case ctype function calls but more generally built-in functions and > those kinds). I have a huge c library and almost all functions return > an error code. The libr

Re: [Tutor] List comprehension possible with condition statements?

2010-03-03 Thread Steven D'Aprano
On Thu, 4 Mar 2010 05:18:40 am Alan Gauld wrote: > "Steven D'Aprano" wrote > > > Comparisons with None almost always should be one of: > > > > item is None > > item is not None > > Yes, but the reason I changed it (I originally had "is not") is that > != is a more general test for illustrating the

Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-03-03 Thread Karim Liateni
Hello Alan, Steven, I was narrow minded about this topic and did not see the benefits of these multiple Python implementations. You opened my eyes. Regards Karim Steven D'Aprano wrote: On Tue, 2 Mar 2010 11:25:44 am Andreas Kostyrka wrote: Furthermore I do not think that most of the "c

Re: [Tutor] parsing a "chunked" text file

2010-03-03 Thread Karim Liateni
Hello Steven, Is there a big difference to write your first functions as below because I am not familiar with yield keyword? def skip_blanks(lines): """Remove leading and trailing whitespace, ignore blank lines.""" return [line.strip() in lines if line.strip()] I tried to write as wel

Re: [Tutor] List comprehension possible with condition statements?

2010-03-03 Thread Alan Gauld
"Steven D'Aprano" wrote List comps can include *any* comparison: [x+1 for x in data if (3*x+2)**2 > 100*x or x < -5] Sure, but the wording suggested (maybe wrongly) that the OP was a real beginner and so the concept of an expression was likely to be foreign. Sticking with equalty or inequa

[Tutor] Understanding (Complex) Modules

2010-03-03 Thread Wayne Watson
First a little preamble before my questions. Most of my work in Python has required modifying a program that uses modules that were imported by the original program. I've made some use of modules on a command line like math, and have used the idea of a qualifier. On occasion, I've used exampl

Re: [Tutor] Understanding (Complex) Modules

2010-03-03 Thread David Hutto
--- On Wed, 3/3/10, Wayne Watson wrote: From: Wayne Watson Subject: [Tutor] Understanding (Complex) Modules To: tutor@python.org Date: Wednesday, March 3, 2010, 8:24 PM First a little preamble before my questions. Most of my work in Python has required modifying a program that uses modules

Re: [Tutor] Encoding

2010-03-03 Thread spir
On Wed, 3 Mar 2010 16:32:01 +0100 Giorgio wrote: > Uff, encoding is a very painful thing in programming. For sure, but it's true for any kind of data, not only text :-) Think at music or images *formats*. The issue is a bit obscured for text but the use of the mysterious, _cryptic_ (!), word "

Re: [Tutor] unittest

2010-03-03 Thread C.T. Matsumoto
Steven D'Aprano wrote: On Thu, 4 Mar 2010 04:27:23 am C.T. Matsumoto wrote: Hello, Can someone tell me the difference between unittests assertEqual and assertEquals? assertEqual, assertEquals and failUnless are three spellings for the same thing. There is no difference. Thank

Re: [Tutor] Bowing out

2010-03-03 Thread Christian Witts
Kent Johnson wrote: Hi all, After six years of tutor posts my interest and energy have waned and I'm ready to move on to something new. I'm planning to stop reading and contributing to the list. I have handed over list moderation duties to Alan Gauld and Wesley Chun. Thanks to everyone who cont

Re: [Tutor] Encoding

2010-03-03 Thread python
Denis, That was a great explanation!! I'm not the OP, but your explanation really clicked with me. Regards, Malcolm For sure, but it's true for any kind of data, not only text :-) Think at music or images *formats*. The issue is a bit obscured for text but the use of the mysterious, _cryptic_ (

Re: [Tutor] Bowing out

2010-03-03 Thread python
Hi Kent, Your posts and web pages really helped me during my early days with python. Wishing you great success in your new endeavors!!! Cheers, Malcolm ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.p

Re: [Tutor] Encoding

2010-03-03 Thread spir
On Wed, 3 Mar 2010 20:44:51 +0100 Giorgio wrote: > Please let me post the third update O_o. You can forgot other 2, i'll put > them into this email. > > --- > >>> s = "ciao è ciao" > >>> print s > ciao è ciao > >>> s.encode('utf-8') > > Traceback (most recent call last): > File "", line 1, in

[Tutor] object representation

2010-03-03 Thread spir
Hello, In python like in most languages, I guess, objects (at least composite ones -- I don't know about ints, for instance -- someone knows?) are internally represented as associative arrays. Python associative arrays are dicts, which in turn are implemented as hash tables. Correct? Does this