Re: [Tutor] Why do I not get an error when I mistakenly type "humdrum.sigh_strenght" instead of the correct "humdrum.sigh_strength"?

2016-01-20 Thread Danny Yoo
humdrum.sigh_strenght = 'high' humdrum.snort() > Snort! > > At this point I wondered why my output was not "SNORT!!!". Then I > noticed my typo. But now I wonder why I did not get an error from > this typo? Hi boB, Just to be explicit: you are pointing out that:

Re: [Tutor] Why do I not get an error when I mistakenly type "humdrum.sigh_strenght" instead of the correct "humdrum.sigh_strength"?

2016-01-20 Thread Cameron Simpson
On 20Jan2016 22:34, boB Stepp wrote: My intent was to deliberately introduce an error into my class definition: class Hmm(object): def __init__(self, sigh_type, sigh_strength): self.sigh_type = sigh_type self.sigh_strength = sigh_strength

[Tutor] Why is the name "self" optional instead of mandatory?

2016-01-20 Thread boB Stepp
I'm whizzing along in "Python Crash Course" and am in the chapter on classes. Just to satisfy my suspicion that "self" is just a placeholder for creating an object instance, I tried the following: >>> class Dog(object): def __init__(this, name, age): this.name = name

Re: [Tutor] Why is the name "self" optional instead of mandatory?

2016-01-20 Thread Cameron Simpson
On 20Jan2016 21:42, boB Stepp wrote: I'm whizzing along in "Python Crash Course" and am in the chapter on classes. Just to satisfy my suspicion that "self" is just a placeholder for creating an object instance, No, it is a placeholder for a _preexiting_ object

[Tutor] Why do I not get an error when I mistakenly type "humdrum.sigh_strenght" instead of the correct "humdrum.sigh_strength"?

2016-01-20 Thread boB Stepp
My intent was to deliberately introduce an error into my class definition: >>> class Hmm(object): def __init__(self, sigh_type, sigh_strength): self.sigh_type = sigh_type self.sigh_strength = sigh_strength def snort(self): if self.sigh_strength

Re: [Tutor] Why is the name "self" optional instead of mandatory?

2016-01-20 Thread Danny Yoo
> So I really only have one question: Why not make Python's > *traditional* name, "self", mandatory? Why give the programmer this > kind of choice? [OK, that was two questions.] There are situations where it might not be mandatory. This is definitely not beginner Python material, so I don't

Re: [Tutor] Why is the name "self" optional instead of mandatory?

2016-01-20 Thread Ben Finney
boB Stepp writes: > So I really only have one question: Why not make Python's > *traditional* name, "self", mandatory? Why give the programmer this > kind of choice? For the same reason that four-space indentation is not mandatory, yet anyone who chooses a different

Re: [Tutor] Why do I not get an error when I mistakenly type "humdrum.sigh_strenght" instead of the correct "humdrum.sigh_strength"?

2016-01-20 Thread Ben Finney
boB Stepp writes: > My intent was to deliberately introduce an error into my class definition: > > >>> class Hmm(object): > def __init__(self, sigh_type, sigh_strength): > self.sigh_type = sigh_type > self.sigh_strength = sigh_strength >

Re: [Tutor] Why is an OrderedDict not sliceable?

2016-01-20 Thread Steven D'Aprano
On Wed, Jan 20, 2016 at 01:33:17PM +, Albert-Jan Roskam wrote: > Hi, > > Like the subject says: Why is an OrderedDict not sliceable? (From the > collections library). Was that an intentional omission, or a mistake? > [1] Because slicing a dict makes no sense. A dict is a mapping, not a

[Tutor] import cv, not cv2

2016-01-20 Thread Rheeya Uppaal
After successfully installing dlib and cv2, I have now been asked to install the cv library on Ubuntu. >From what I have read, it seems OpenCV has discontinued support for cv and only cv2 is used now. Am I correct? Regardless, does anyone know how I can get this library? I apologize in advance

Re: [Tutor] import cv, not cv2

2016-01-20 Thread Alan Gauld
On 20/01/16 10:55, Rheeya Uppaal wrote: > After successfully installing dlib and cv2, I have now been asked to > install the cv library on Ubuntu. > > From what I have read, it seems OpenCV has discontinued support for cv and > only cv2 is used now. Am I correct? Regardless, does anyone know how

[Tutor] Why is an OrderedDict not sliceable?

2016-01-20 Thread Albert-Jan Roskam
Hi, Like the subject says: Why is an OrderedDict not sliceable? (From the collections library). Was that an intentional omission, or a mistake? [1] Background: I do not use OrderedDict very often, but I thought I could use it to look up street and city names using postcodes ([0-9]{4} [a-z]{2}