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-24 Thread Steven D'Aprano
On Fri, Jan 22, 2016 at 10:14:57PM -0600, boB Stepp wrote: > On Thu, Jan 21, 2016 at 4:57 AM, Steven D'Aprano wrote: > > def spam(x, y): > > ... > > > > spam.extra_info = "whatever" > > A new thing that I did not suspect I could do. This bothers me for two > reasons: > > 1) It does n

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

2016-01-24 Thread Steven D'Aprano
On Fri, Jan 22, 2016 at 11:10:39PM -0600, boB Stepp wrote: > On Thu, Jan 21, 2016 at 5:49 AM, Steven D'Aprano wrote: > > class X: > > pass > > > > def func(this): > > print("instance %r called method" % this) > > > > X.method = func > > Am I understanding this correctly? It appears to m

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

2016-01-24 Thread Mark Lawrence
On 24/01/2016 20:23, Albert-Jan Roskam wrote: I appear to have confused the terms "sorted" and "ordered" (see the email I just sent to Mark Lawrence). My OrderedDict was sorted on its keys, because I defined the dict using the result of an SQL query that ended with ORDER BY . So in that case

Re: [Tutor] Noob: nested if-clauses

2016-01-24 Thread Alan Gauld
On 24/01/16 19:42, STF wrote: > Let's see the following instructions: > > if condition_A: > instruction_1 > instruction_2 > if condition_B: > instruction_3 > instruction_4 > instruction_5 > else: > instruction_6 > > > * How to make Pythom understa

Re: [Tutor] Noob: nested if-clauses

2016-01-24 Thread Joel Goldstick
On Sun, Jan 24, 2016 at 2:42 PM, STF wrote: > Hi, > > I've just started to learn Python thru some online courses and websites. > They just teach very basic things. I've got some questions about "if" that > I'm unable to find the answers. So let me ask the newbie questions here. > > Let's see th

[Tutor] Noob: nested if-clauses

2016-01-24 Thread STF
Hi, I've just started to learn Python thru some online courses and websites. They just teach very basic things. I've got some questions about "if" that I'm unable to find the answers. So let me ask the newbie questions here. Let's see the following instructions: if condition_A: ins

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-24 Thread Albert-Jan Roskam
> To: tutor@python.org > From: __pete...@web.de > Date: Sun, 24 Jan 2016 11:22:19 +0100 > Subject: Re: [Tutor] Change datatype for specific columns in an 2D array & > computing the mean > How do you want to convert the second and third column to int? Are A4 and B2 > hex numbers? Then try > >

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

2016-01-24 Thread Albert-Jan Roskam
> From: oscar.j.benja...@gmail.com > Date: Thu, 21 Jan 2016 11:02:40 + > To: ben+pyt...@benfinney.id.au > Subject: Re: [Tutor] Why is an OrderedDict not sliceable? > CC: tutor@python.org > > On 21 January 2016 at 09:19, Ben Finney wrote: > > Albert-Jan Roskam writes: > > > >> Why is an Order

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

2016-01-24 Thread Albert-Jan Roskam
> To: tutor@python.org > From: ben+pyt...@benfinney.id.au > Date: Fri, 22 Jan 2016 04:12:08 +1100 > Subject: Re: [Tutor] Why is an OrderedDict not sliceable? > > Ben Finney writes: > > > Oscar Benjamin writes: > > > > > According to a narrow definition of indexed access. I would say that > > >

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

2016-01-24 Thread Albert-Jan Roskam
> Date: Fri, 22 Jan 2016 11:00:00 +1100 > From: st...@pearwood.info > To: tutor@python.org > Subject: Re: [Tutor] Why is an OrderedDict not sliceable? > > Further thoughts on your question... > > > On Wed, Jan 20, 2016 at 01:33:17PM +, Albert-Jan Roskam wrote: > > Hi, > > > > Like the subje

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

2016-01-24 Thread Albert-Jan Roskam
> To: tutor@python.org > From: alan.ga...@btinternet.com > Date: Fri, 22 Jan 2016 00:12:18 + > Subject: Re: [Tutor] Why is an OrderedDict not sliceable? > > On 22/01/16 00:00, Steven D'Aprano wrote: > > > Also, you have a problem -- what happens if the incomplete postcode is > > missing t

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

2016-01-24 Thread Albert-Jan Roskam
> To: tutor@python.org > From: breamore...@yahoo.co.uk > Date: Thu, 21 Jan 2016 21:02:03 + > Subject: Re: [Tutor] Why is an OrderedDict not sliceable? > > On 20/01/2016 13:33, Albert-Jan Roskam wrote: > > Hi, > > > > Like the subject says: Why is an OrderedDict not sliceable? (From the > >

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-24 Thread Alan Gauld
On 24/01/16 14:09, Ek Esawi wrote: > BTW, is it possible to send you what i did off list? That way you see what > i am doing. The list is here so that everyone can benefit. Can you post the code publicly? If so, and its not more than say, 100-200 lines, you can just post it here. But I will repe

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-24 Thread Peter Otten
Ek Esawi wrote: > Thanks for the input. Columns 2 and 3 are strings and i assume that they > don't need to be converted. Because all i need is to compute the mean for > data on column 4 based on each variable in column 1 and each in column 2.. I'm an amateur with numpy, and unfortunately my favou

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-24 Thread Ek Esawi
Thanks for the input. Columns 2 and 3 are strings and i assume that they don't need to be converted. Because all i need is to compute the mean for data on column 4 based on each variable in column 1 and each in column 2.. BTW, is it possible to send you what i did off list? That way you see what i

Re: [Tutor] Value of tracebacks to malicious attackers?

2016-01-24 Thread Devin Jeanpierre
Forgetting to hide tracebacks on a client-side app is not a huge deal (other than being confusing and looking too serious), and definitely doesn't matter for security. So I guess we're assuming that the Python code is not on the user's machine. On Sat, Jan 23, 2016 at 10:43 PM, Danny Yoo wrote: >

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-24 Thread Peter Otten
Ek Esawi wrote: > Hi All--- > > > > Sorry for posting again, but I have a problem that I tried several > different ways to solve w/o success. I approached the problem from one > angle and asked about it here; I got some good input using pandas, and > structured array, but I am new to python and

Re: [Tutor] Value of tracebacks to malicious attackers?

2016-01-24 Thread Alan Gauld
On 24/01/16 04:52, boB Stepp wrote: > How much concern do you give this in designing and implementing your > production code? How far do you go in handling exceptions to ensure > that tracebacks cannot arise for a malicious user? When I was writing commercial code that went into "the wild" we ha

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-24 Thread Alan Gauld
On 24/01/16 03:07, boB Stepp wrote: >> In pure OO objects should only expose methods and the data >> attributes should only be there to support the methods. > > Apparently what OOP knowledge I started out with agrees strongly with > what you say here. But this level of *purity* appears to be > n