Re: Distinction between “class” and “type”

2016-05-12 Thread Paul Rubin
Ben Finney writes: > There's a big overlap because most classes are also types -- but not > the other way around! E.g. Any is a type but not a class (you can > neither inherit from Any nor instantiate it), and the same is true > for unions and type variables. […] > As a Bear of Li

Re: Design: Idiom for classes and methods that are customizable by the user?

2016-05-12 Thread Gregory Ewing
Dirk Bächle wrote: What happens now and then is, that users are unhappy with the way this Taskmaster proceeds. One peculiar detail is, that our "default" Taskmaster always deletes the old target file before re-building it...and in special situations this may be seen as unwanted. I'm not conv

Re: Design: Idiom for classes and methods that are customizable by the user?

2016-05-12 Thread Marko Rauhamaa
Dirk Bächle : >> For example, why do you need a key? Couldn't you simply pass the task >> master class as an argument? > > The idea behind this is, to be able to select classes by giving a > parameter on the command-line. So at some point a translation from a > given "key" to its actual class has

Re: Average calculation Program *need help*

2016-05-12 Thread Jake Kobs
Thank you for the help..I think I'm getting closer, but I feel like after they enter an invalid number, it should reset the invalid number(s) somehow. Here's my updated code: -- #this function will get the total scores de

Re: Average calculation Program *need help*

2016-05-12 Thread Michael Torrie
On 05/12/2016 11:03 PM, Jake Kobs wrote: > Im not sure how to move it inside the for loop. I've been working on > this small problem for like 4 hours lol. I'm sorry it's so frustrating. Sounds like you haven't got down some of the most basic fundamentals yet. In Python, things that should happen

Re: Distinction between “class” and “type”

2016-05-12 Thread Rustom Mody
On Friday, May 13, 2016 at 10:37:34 AM UTC+5:30, Ben Finney wrote: > Howdy all, > > Ever since Python's much-celebrated Grand Unification of classes and > types, I have used those terms interchangeably: every class is a type, > and every type is a class. > > That may be an unwise conflation. With

Re: Distinction between “class” and “type”

2016-05-12 Thread Chris Angelico
On Fri, May 13, 2016 at 3:07 PM, Ben Finney wrote: > This recent message from GvR, discussing a relevant PEP, advocates > keeping them separate: > > PEP 484 […] tries to make a clear terminological between classes > (the things you have at runtime) and types (the things that type > che

Distinction between “class” and “type”

2016-05-12 Thread Ben Finney
Howdy all, Ever since Python's much-celebrated Grand Unification of classes and types, I have used those terms interchangeably: every class is a type, and every type is a class. That may be an unwise conflation. With the recent rise of optional type annotation in Python 3, more people are speakin

Re: Design: Idiom for classes and methods that are customizable by the user?

2016-05-12 Thread Dirk Bächle
Hi Marko, thank you very much for your quick reply. On 13.05.2016 00:01, Marko Rauhamaa wrote: [...] - Is this a good approach As an approach, that looks ok. The code looks a bit too lenient, though, which can easily surprise and baffle the user. I think it would be better to fail: ===

Re: Average calculation Program *need help*

2016-05-12 Thread Jake Kobs
On Thursday, May 12, 2016 at 11:57:28 PM UTC-5, Michael Torrie wrote: > On 05/12/2016 10:22 PM, Jake Kobs wrote: > > On Thursday, May 12, 2016 at 10:48:08 AM UTC-5, Jake Kobs wrote: > >> Hello all, I have been struggling with this code for 3 hours now and I'm > >> still stumped. My problem is that

Re: Average calculation Program *need help*

2016-05-12 Thread Michael Torrie
On 05/12/2016 10:22 PM, Jake Kobs wrote: > On Thursday, May 12, 2016 at 10:48:08 AM UTC-5, Jake Kobs wrote: >> Hello all, I have been struggling with this code for 3 hours now and I'm >> still stumped. My problem is that when I run the following code: >> ---

Re: Average calculation Program *need help*

2016-05-12 Thread Ben Finney
Jake Kobs writes: > I still can't get it. Someone please tell me lol. I have done > everything I can and still I get bad answers. You may want to join our dedicated beginner tutoring forum https://mail.python.org/mailman/listinfo/tutor>, which specialises in collaborative teaching of the fundame

Re: Average calculation Program *need help*

2016-05-12 Thread Jake Kobs
On Thursday, May 12, 2016 at 10:48:08 AM UTC-5, Jake Kobs wrote: > Hello all, I have been struggling with this code for 3 hours now and I'm > still stumped. My problem is that when I run the following code: > -- > #this fu

Re: Why online forums have bad behaviour (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?)

2016-05-12 Thread Jason Friedman
> TL;DR: because we're all human, and human behaviour needs either > immediate face-to-face feedback or social enforcement to correct > selfishness and abrasiveness. Where face-to-face feedback is lacking, > social enforcement needs to take more of the load. > > > Many people have a false sense of

Re: Calling python from C with OpenMP

2016-05-12 Thread Sturla Molden
wrote: > Second and most important question: When I run this code it sometimes > segementation faults, and sometimes some threads run normal and some > other threads says "Cannot call 'do_multiply'". Sometimes I get the > message: Fatal Python error: GC object already tracked. And some times it >

Re: Design: Idiom for classes and methods that are customizable by the user?

2016-05-12 Thread Marko Rauhamaa
Dirk Bächle : > I'm one of the SCons (http://www.scons.org) developers I take the opportunity to thank you and your colleagues for the wonderful building tool that I have used professionally to great success since 2003. > We're a build system and all the code is written in Python. Even more > so

Design: Idiom for classes and methods that are customizable by the user?

2016-05-12 Thread Dirk Bächle
Hi there, I'm one of the SCons (http://www.scons.org) developers and am working on a partial redesign of our architecture. I'd like to come up with a decent proposal about how to extend and rewrite our code base, such that it's easier for a user to overload and replace some parts of the functio

Why online forums have bad behaviour (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?)

2016-05-12 Thread Ben Finney
Michael Torrie writes: > It's really sad to see folks like DFS hop on the list with apparent > enthusiasm for Python and an excitement to learn, only to resort to > name calling and walk away in a huff when folks ask them not to speak > that way around here. I'm not sure why this is. TL;DR: beca

Calling python from C with OpenMP

2016-05-12 Thread oysteijo
Hi, I have a framework written in C and I need to call Python from that framework. I have written the code, and it runs fine, however when I recompile with OpenMP enabled, I get segmentation faults and some times an error message: Fatal Python error: GC object already tracked I'm able to reco

Re: Average calculation Program *need help*

2016-05-12 Thread Martin A. Brown
Greetings kobsx4, >Hello all, I have been struggling with this code for 3 hours now >and I'm still stumped. My problem is that when I run the following >code: >-- >#this function will get the total scores >def getScore

Re: Average calculation Program *need help*

2016-05-12 Thread MRAB
On 2016-05-12 16:47, kob...@gmail.com wrote: Hello all, I have been struggling with this code for 3 hours now and I'm still stumped. My problem is that when I run the following code: -- #this function will get the total

Re: Average calculation Program *need help*

2016-05-12 Thread Rustom Mody
On Thursday, May 12, 2016 at 9:18:08 PM UTC+5:30, Jake Kobs wrote: > Hello all, I have been struggling with this code for 3 hours now and I'm > still stumped. My problem is that when I run the following code: > -- > #this

Re: Average calculation Program *need help*

2016-05-12 Thread Igor Korot
Hi, On Thu, May 12, 2016 at 11:47 AM, wrote: > Hello all, I have been struggling with this code for 3 hours now and I'm > still stumped. My problem is that when I run the following code: > -- > #this function will get t

Average calculation Program *need help*

2016-05-12 Thread kobsx4
Hello all, I have been struggling with this code for 3 hours now and I'm still stumped. My problem is that when I run the following code: -- #this function will get the total scores def getScores(totalScores, number):

Re: Finding .so files without setting LD_LIBRARY_PATH

2016-05-12 Thread Paul Smith
On Thu, 2016-05-12 at 07:55 +0300, Jussi Piitulainen wrote: > eryk sun writes: > > > On Wed, May 11, 2016 at 10:39 PM, Paul Smith wrote: > > > Hi all. I have a locally-built version of Python (2.7.11) that I'm > > > copying around to different systems, running all different versions of > > > GNU/

Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

2016-05-12 Thread Steven D'Aprano
On Thu, 12 May 2016 07:36 pm, Ned Batchelder wrote: > The CPython optimization depends on the string having only a single > reference. A seemingly unrelated change to the code can change the > performance significantly: > > In [1]: %%timeit >...: s = "" >...: for x in xrange(

Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

2016-05-12 Thread Michael Torrie
On 05/12/2016 03:12 AM, alister wrote: > On Tue, 10 May 2016 19:40:02 -0400, DFS wrote: > >> Sometimes I try to be a funny smart-aleck and it doesn't work. > > this is the problem everyone is having with your post, you acknowledge > that it doesn't work so why keep trying. > > I too can fall gu

Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

2016-05-12 Thread Chris Angelico
On Thu, May 12, 2016 at 11:39 PM, Jon Ribbens wrote: > On 2016-05-10, DFS wrote: >> This isn't a moderated group. > > That doesn't represent the whole truth. The Usenet group is > unmoderated but is gatewayed to a mailing list, which of course can be > moderated. So while you can't be moderated o

Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

2016-05-12 Thread Jon Ribbens
On 2016-05-10, DFS wrote: > This isn't a moderated group. That doesn't represent the whole truth. The Usenet group is unmoderated but is gatewayed to a mailing list, which of course can be moderated. So while you can't be moderated on the Usenet group, much of the potential audience for posts her

Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

2016-05-12 Thread Ned Batchelder
On Thursday, May 12, 2016 at 4:24:55 AM UTC-4, srinivas devaki wrote: > On May 9, 2016 5:31 AM, "Tim Chase" wrote: > > > > then that's a bad code-smell (you get quadratic behavior as the > > strings are constantly resized), usually better replaced with > > > > I just want to point out that in Pyt

Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

2016-05-12 Thread Chris Angelico
On Thu, May 12, 2016 at 7:12 PM, alister wrote: > [presumably DFS wrote, but I didn't see] >> Note: Angelico is about the coolest last name I've heard in a long time. >>Is it real? It is, actually! It's a precious heirloom. It belonged to my father, the great Talldad; and it belonged to his f

Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

2016-05-12 Thread alister
On Tue, 10 May 2016 19:40:02 -0400, DFS wrote: > Sometimes I try to be a funny smart-aleck and it doesn't work. this is the problem everyone is having with your post, you acknowledge that it doesn't work so why keep trying. I too can fall guilty of this behavior (I can be a bit condescending of

Re: More list building

2016-05-12 Thread Peter Otten
louis.a.r...@gmail.com wrote: > On Wednesday, May 11, 2016 at 1:22:09 PM UTC-4, DFS wrote: >> Have: >> p1 = ['Now', 'the', 'for', 'good'] >> p2 = ['is', 'time', 'all', 'men'] >> >> want >> [('Now','is','the','time'), ('for','all','good','men')] >> >> This works: >> >> p = [] >> for i in xrange(

Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

2016-05-12 Thread Chris Angelico
On Thu, May 12, 2016 at 6:23 PM, srinivas devaki wrote: > On May 9, 2016 5:31 AM, "Tim Chase" wrote: >> >> then that's a bad code-smell (you get quadratic behavior as the >> strings are constantly resized), usually better replaced with >> > > I just want to point out that in Python s += str in lo

Re: More list building

2016-05-12 Thread marco . nawijn
On Wednesday, May 11, 2016 at 7:22:09 PM UTC+2, DFS wrote: > Have: > p1 = ['Now', 'the', 'for', 'good'] > p2 = ['is', 'time', 'all', 'men'] > > want > [('Now','is','the','time'), ('for','all','good','men')] > > This works: > > p = [] > for i in xrange(0,len(p1),2): > p.insert(i,(p1[i],p2[i

Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

2016-05-12 Thread srinivas devaki
On May 9, 2016 5:31 AM, "Tim Chase" wrote: > > then that's a bad code-smell (you get quadratic behavior as the > strings are constantly resized), usually better replaced with > I just want to point out that in Python s += str in loop is not giving quadratic behavior. I don't know why but it runs

Re: String concatenation

2016-05-12 Thread Steven D'Aprano
On Tuesday 10 May 2016 12:42, Chris Angelico wrote: > On Tue, May 10, 2016 at 12:32 PM, Steven D'Aprano > wrote: >> Floats are old (they go back to the first release of Python), they have >> many quirks (x + y - x is not necessarily equal to y), and people make >> many errors with floats. Does th

Re: Analytical Geometry in Python with GeoMath

2016-05-12 Thread Steven D'Aprano
Hi Vinicius, On Thursday 05 May 2016 04:16, Vinicius wrote: > To add a point, you do: > From geomath import point > A = point.Point(x,y) > A.distance(PointB) > A.mispoint(PointB) > A.quadrant() How does your library compare with Eukleides? http://www.eukleides.org/quickstart.html -- Steve

Re: String concatenation

2016-05-12 Thread Steven D'Aprano
On Tuesday 10 May 2016 18:15, David Palao wrote: > 2016-05-10 9:54 GMT+02:00 Steven D'Aprano > : >> I'm surprised that Spanish names are not affected. Consider a woman who goes >> by the personal name of Maria Teresa, whose father's first surname was >> García and mother's first surname was Ramír

Re: Finding .so files without setting LD_LIBRARY_PATH

2016-05-12 Thread dieter
Paul Smith writes: > ... > That works fine, but here's the problem: because LD_LIBRARY_PATH is in > Python's environment it is also passed down to programs invoked by > Python. That means if I (for example) invoke subprocess.call(['ssh', > ...]) then it fails because the system ssh is looking for