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

2016-01-22 Thread Mark Lawrence
On 20/01/2016 13:33, 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] Plenty of answers on this all ready, but... Background: I do not use OrderedDict very often, but

[Tutor] No connection could be made because the target machine actively refused it (despite mongod running) and unable to insert data into MongoDB

2016-01-22 Thread Arjun Srivatsa
Hello everyone, I have been trying to insert data (a 'hello world' string) from PLC into MongoDB using Python API (which pulls the data from PLC and pushes it into MongoDB). I have been getting the error message '*line 222, in meth return getattr(self._sock,name)(*args) error: [Errno 10061] No co

[Tutor] Extract several arrays from a large 2D array

2016-01-22 Thread Ek Esawi
Thank you all for your help. I am a decent programmer in another language but new to Python and I have some issues with a project I am working on. Some suggested using pandas but I am barley starting on Numpy. The suggestions were very helpful, however, I decided to replace the 2D array with severa

Re: [Tutor] No connection could be made because the target machine actively refused it (despite mongod running) and unable to insert data into MongoDB

2016-01-22 Thread Alan Gauld
On 21/01/16 22:06, Arjun Srivatsa wrote: > Hello everyone, > > I have been trying to insert data (a 'hello world' string) from PLC into > MongoDB using Python API (which pulls the data from PLC and pushes it into > MongoDB). I have been getting the error message '*line 222, in meth return > getat

Re: [Tutor] Extract several arrays from a large 2D array

2016-01-22 Thread Peter Otten
Ek Esawi wrote: > Thank you all for your help. I am a decent programmer in another language > but new to Python and I have some issues with a project I am working on. > Some suggested using pandas but I am barley starting on Numpy. The > suggestions were very helpful, however, I decided to replace

Re: [Tutor] No connection could be made because the target machine actively refused it (despite mongod running) and unable to insert data into MongoDB

2016-01-22 Thread Emile van Sebille
On 1/21/2016 2:06 PM, Arjun Srivatsa wrote: Hello everyone, I have been trying to insert data (a 'hello world' string) from PLC into MongoDB using Python API (which pulls the data from PLC and pushes it into MongoDB). I have been getting the error message '*line 222, in meth return getattr(self

Re: [Tutor] Tutor Digest, Vol 143, Issue 77

2016-01-22 Thread samuel kirwin
Semantic errors are when a program acts incorrectly and doesn't give a error, this came up yesterday. Samuel Kirwin Samvelk On Fri, Jan 22, 2016 at 9:02 AM -0800, wrote: Send Tutor mailing list submissions to tutor@python.org To subscribe or unsubscribe via the World Wide Web,

[Tutor] Combine Scripts to Work Together...

2016-01-22 Thread Sam Starfas via Tutor
Hi,I am new to Python, but learning. (Hopefully the layout is readable) I am having trouble getting two scripts to work together. What I want to do is have the combinded script do the following: 1. Read through a directory of xml files, not a single file, but many xml files.2. Read each files

[Tutor] Semantic error (was: Re: Tutor Digest, Vol 143, Issue 77)

2016-01-22 Thread Alan Gauld
On 22/01/16 17:05, samuel kirwin wrote: > Semantic errors are when a program acts incorrectly and doesn't give a error, > this came up yesterday. > > Samuel Kirwin Hi Sam, Thanks for participating. However, it will make your comments more meaningful if you reply with the subject line set to wha

Re: [Tutor] Combine Scripts to Work Together...

2016-01-22 Thread Joel Goldstick
On Fri, Jan 22, 2016 at 1:16 PM, Sam Starfas via Tutor wrote: > > > > Hi,I am new to Python, but learning. (Hopefully the layout is readable) > I am having trouble getting two scripts to work together. What I want to > do is have the combinded script do the following: > 1. Read through a directo

Re: [Tutor] Combine Scripts to Work Together...

2016-01-22 Thread Joel Goldstick
On Fri, Jan 22, 2016 at 1:48 PM, Joel Goldstick wrote: > > > On Fri, Jan 22, 2016 at 1:16 PM, Sam Starfas via Tutor > wrote: > >> >> >> >> Hi,I am new to Python, but learning. (Hopefully the layout is readable) >> I am having trouble getting two scripts to work together. What I want to >> do is

[Tutor] mock

2016-01-22 Thread Alex Kleider
Some weeks (perhaps months) ago, I posted a question about testing and got many responses but had trouble grasping the concepts so I settled on the suggestion that I thought would be the easiest to implement (using unittest.mock.) Here it is- """ from Peter Otten: I find Ben's example instructive

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-22 Thread boB Stepp
On Thu, Jan 21, 2016 at 4:57 AM, Steven D'Aprano wrote: > On Wed, Jan 20, 2016 at 09:54:32PM -0800, Danny Yoo wrote: > >> Just to be explicit: you are pointing out that: >> >> humdrum.sigh_strenght = 'high' >> >> was a typo, and it would have been nice if it could be caught as an error. >> >>

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-22 Thread Cameron Simpson
On 22Jan2016 22:14, boB Stepp wrote: On Thu, Jan 21, 2016 at 4:57 AM, Steven D'Aprano wrote: Danny is correct. And it is a useful feature too. For instance, we can add attributes to functions: def spam(x, y): ... spam.extra_info = "whatever" A new thing that I did not suspect I could d

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

2016-01-22 Thread boB Stepp
On Thu, Jan 21, 2016 at 5:49 AM, Steven D'Aprano wrote: > On Wed, Jan 20, 2016 at 09:42:29PM -0600, boB Stepp wrote: > >> 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 questio

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-22 Thread boB Stepp
On Fri, Jan 22, 2016 at 11:04 PM, Cameron Simpson wrote: > On 22Jan2016 22:14, boB Stepp wrote: [...] > Consider: this is information you want assicated with a specific object. > Therefore it really _is_ an arribute of the object so that it can follow it > around. > >> And what bothered me abou