Re: Classes

2014-11-03 Thread Gregory Ewing
Jean-Michel Pichavant wrote: Python uses the descriptor protocol which is basically getters and setters. It's is just hidden by a strange decorator syntax. This is about the interface, not the implementation. "Getters and setters" in this context means designing the API of your class to have th

Re: Classes

2014-11-03 Thread Gregory Ewing
Denis McMahon wrote: On Mon, 03 Nov 2014 06:29:39 +, Dan Sommers wrote: What's the difference between a Diamond and a Rhombus? Oops, I was thinking a rhombus was a general parallelogram, my mistake. Some diamonds are neither rhombuses nor parallelograms: http://minecraft.gamepedia.co

Re: Classes

2014-11-03 Thread Denis McMahon
On Mon, 03 Nov 2014 06:29:39 +, Dan Sommers wrote: > On Mon, 03 Nov 2014 03:12:32 +, Denis McMahon wrote: > >> Quadrilateral >> Parallelogram >> Square Rectangle Rhombus Diamond (4 sides eq) >> Trapezoid >> Arrowhead > > What's the difference between a Diamond and

Re: (-1)**1000

2014-11-03 Thread Albert van der Horst
In article , Ned Batchelder wrote: >On 10/22/14 5:27 AM, ast wrote: >> >> "Chris Angelico" a écrit dans le message de >> news:mailman.15058.1413968065.18130.python-l...@python.org... >>> On Wed, Oct 22, 2014 at 7:27 PM, ast wrote: If i am writing (-1)**1000 on a python program, will the >

Re: Classes

2014-11-03 Thread Greg Ewing
Jean-Michel Pichavant wrote: I agree with Steven on that one, while getters/setters are not the preferred way, they are not utterly wrong. I'm not saying that they're wrong in general, only that they're wrong for *Python*. This matters, because the course in question is purportedly teaching P

Re: Installing Parsers/Tree Builders to, and accessing these packages from Python2.7

2014-11-03 Thread Mark Lawrence
On 03/11/2014 21:28, Simon Evans wrote: I input to the cmd console 'pip install html5lib' but again got an error return. I thought one of the participants was unhappy about single line spacing (re: single line paragraphs') Okay I will go back to single line spacing, I don't think it is all th

Re: Installing Parsers/Tree Builders to, and accessing these packages from Python2.7

2014-11-03 Thread Simon Evans
I input to the cmd console 'pip install html5lib' but again got an error return. I thought one of the participants was unhappy about single line spacing (re: single line paragraphs') Okay I will go back to single line spacing, I don't think it is all that important, really. Anyway this is my co

Re: Parsing Python dictionary with multiple objects

2014-11-03 Thread Anurag Patibandla
json_split = {} value = {"Status": "Submitted", "m_Controller": "Python"} a = range(31) del a[0] for i in a: json_split[i] = value keys = json_split.keys() order = list(keys) q1 = int(round(len(keys)*0.2)) q2 = int(round(len(keys)*0.3)) q3 = int(round(len(keys)*0.5)) b = [q1,q2,q3] n=0 threedic

Re: Installing Parsers/Tree Builders to, and accessing these packages from Python2.7

2014-11-03 Thread Chris Angelico
On Tue, Nov 4, 2014 at 3:27 AM, Simon Evans wrote: > I input 'pip install html5lib' to the Python 2.7 console and got : > pip install html5lib > File "", line 1 > pip install html5lib > ^ > SyntaxError: invalid syntax This should be run from your command interpreter

Re: Installing Parsers/Tree Builders to, and accessing these packages from Python2.7

2014-11-03 Thread Simon Evans
I input 'pip install html5lib' to the Python 2.7 console and got : >>> pip install html5lib File "", line 1 pip install html5lib ^ SyntaxError: invalid syntax >>> I am not sure what you mean about 'single line paragraphs'. I put my text into double line spacing in my last mi

Re: Classes

2014-11-03 Thread Chris Angelico
On Tue, Nov 4, 2014 at 12:50 AM, Dennis Lee Bieber wrote: > On Mon, 3 Nov 2014 03:12:32 + (UTC), Denis McMahon > declaimed the following: > >>So: >> >>Quadrilateral >>Parallelogram >>Square >>Rectangle >>Rhombus >>Diamond (4 sides eq) >>Trapezoid >>

Re: support for boost::python for build double object

2014-11-03 Thread Mark Lawrence
On 03/11/2014 13:53, Joseph Shen wrote: In the boost::python library there is a function boost::python::long_ and this function return a boost::python::object variable I'm trying to wrap a double variale but I can't find something just like boost::python::double_ can someone help me to

Re: Classes

2014-11-03 Thread Ian Kelly
On Nov 2, 2014 5:31 AM, "Denis McMahon" wrote: > And perhaps that also addresses the square - rectangle (or circle - > ellipse) issue - square, rectangle and rhombus are all forms of > quadrilateral, and perhaps should all inherit a base class Quadrilateral, > rather than trying (and partially fai

Re: support for boost::python for build double object

2014-11-03 Thread Joseph Shen
On Monday, November 3, 2014 10:11:01 PM UTC+8, Skip Montanaro wrote: > On Mon, Nov 3, 2014 at 7:53 AM, Joseph Shen wrote: > > In the boost::python library there is a function > > > > >>> boost::python::long_ > > > > and this function return a boost::python::object variable > > > > I'm tr

Re: support for boost::python for build double object

2014-11-03 Thread Skip Montanaro
On Mon, Nov 3, 2014 at 7:53 AM, Joseph Shen wrote: > In the boost::python library there is a function > > >>> boost::python::long_ > > and this function return a boost::python::object variable > > I'm trying to wrap a double variable but I can't find > something just like > > >> boost::python::d

support for boost::python for build double object

2014-11-03 Thread Joseph Shen
In the boost::python library there is a function >>> boost::python::long_ and this function return a boost::python::object variable I'm trying to wrap a double variale but I can't find something just like >> boost::python::double_ can someone help me to build a double object PS. I know the

Re: Classes

2014-11-03 Thread Jean-Michel Pichavant
- Original Message - > From: "Gregory Ewing" > Steven D'Aprano wrote: > > Like all good Pythonistas[1], we hate Java and think that > > getter/setter > > methods are pointless. But come on, they're not *wrong*, > > What's wrong is the statement that getters and setters > are necessary to

Re: Dictionaries with variable default.

2014-11-03 Thread Chris Angelico
On Mon, Nov 3, 2014 at 10:04 PM, Antoon Pardon wrote: > Is it possible to have a default dictionary where the default is dependant > on the key? > > I was hoping something like this might work: m = defaultdict(lambda key: key+1) > > But it obviously doesn't: m[3] > > Traceback (most rece

Dictionaries with variable default.

2014-11-03 Thread Antoon Pardon
Is it possible to have a default dictionary where the default is dependant on the key? I was hoping something like this might work: >>> m = defaultdict(lambda key: key+1) But it obviously doesn't: >>> m[3] Traceback (most recent call last): File "", line 1, in TypeError: () takes exactly 1 ar