Spreading a class over multiple files

2016-06-05 Thread Mark Summerfield
Sometimes I want to spread a class over multiple files. My primary use case is when I create a "Model" class to reflect an entire SQL database. I want a model instance to provide a single point of access to the database, but the database has many tables each requiring its own methods since they

Re: Spreading a class over multiple files

2016-06-05 Thread Gary Herron
On 06/04/2016 11:55 PM, Mark Summerfield wrote: Sometimes I want to spread a class over multiple files. There’s and easy way to do this in Python using what's called a Mixin class and (multiple) inheritance: (See https://en.wikipedia.org/wiki/Mixin for more information.) In one file, say e

Re: Lineendings (was Everything good about Python except GUI IDE?)

2016-06-05 Thread Rustom Mody
Just came across this new data (for me) to this old question: On Monday, February 29, 2016 at 8:05:33 AM UTC+5:30, Ben Finney wrote: > Rustom Mody writes: > > > On Monday, February 29, 2016 at 7:33:18 AM UTC+5:30, Chris Angelico wrote: > > > Never has for any of my projects. Examples please? Actu

Re: Operator precedence problem

2016-06-05 Thread Peter Otten
ICT Ezy wrote: 2 ** 3 ** 2 > Answer is 512 > Why not 64? > Order is right-left or left-right? ** is a special case: """ The power operator ** binds less tightly than an arithmetic or bitwise unary operator on its right, that is, 2**-1 is 0.5. """ https://docs.python.org/3.5/reference/expre

Re: Spreading a class over multiple files

2016-06-05 Thread Peter Otten
Mark Summerfield wrote: > Sometimes I want to spread a class over multiple files. > > My primary use case is when I create a "Model" class to reflect an entire > SQL database. I want a model instance to provide a single point of access > to > the database, but the database has many tables each r

Re: I'm wrong or Will we fix the ducks limp?

2016-06-05 Thread Marko Rauhamaa
Steven D'Aprano : > On Sun, 5 Jun 2016 01:17 pm, Lawrence D’Oliveiro wrote: >> Are variables like little boxes? Yes they are. > > That's *exactly* what variables in Python are not like. Of course they are. Or, rather, the little-box mental model is no worse than any other. You could also think

Re: Spreading a class over multiple files

2016-06-05 Thread Mark Summerfield
You're quite right! For some reason I have a blind-spot about mixins, but they are the perfect solution. Thanks:-) -- https://mail.python.org/mailman/listinfo/python-list

EuroPython 2016: Hot Topics Call for Proposals is Open !

2016-06-05 Thread M.-A. Lemburg
We are happy to announce that we’ve opened our second Call for Proposals. This call is limited to hot topics and most recent developments in software and technology and will run until June 12. *** Proposal Submission Page *** https://ep2016.europython.eu/en/speakers/hot

Taking two and more data frames and extracting data on unique keys in python

2016-06-05 Thread Danish Hussain
1 down vote favorite Its a bit long question have patience. firstly I have 2 data frames one in which i have name of a guy and pages liked by him in columns. So no. of columns will be different for different person here is the example. 1st column is the name of user.Then pages liked by him is s

Re: Spreading a class over multiple files

2016-06-05 Thread Steven D'Aprano
On Sun, 5 Jun 2016 06:14 pm, Mark Summerfield wrote: > You're quite right! For some reason I have a blind-spot about mixins, but > they are the perfect solution. Thanks:-) They really aren't :-) Just yesterday on an unrelated thread I linked to a long discussion about multiple inheritance, mixin

Re: for / while else doesn't make sense

2016-06-05 Thread Ned Batchelder
On Saturday, June 4, 2016 at 11:29:30 PM UTC-4, Lawrence D’Oliveiro wrote: > On Saturday, June 4, 2016 at 11:37:18 PM UTC+12, Ned Batchelder wrote: > > On Friday, June 3, 2016 at 11:43:33 PM UTC-4, Lawrence D’Oliveiro wrote: > > > On Saturday, June 4, 2016 at 3:00:36 PM UTC+12, Steven D'Aprano wrot

Re: for / while else doesn't make sense

2016-06-05 Thread Marko Rauhamaa
Ned Batchelder : > On Saturday, June 4, 2016 at 11:29:30 PM UTC-4, Lawrence D’Oliveiro wrote: >> > > item_iter = iter(items) >> > > while True : >> > > item = next(item_iter, None) >> > > if item == None : >> > > break >> > > if is_what_i_want(item) : >>

Re: Anyone know a donation app codebase?

2016-06-05 Thread Albert
Thank you for your answer Ben, That is not exactly what I am looking for. I am interested in knowing if there are any python (django, flask, etc) opensource projects for managing donations, similar to catarse [1] (ruby) and [2] (ruby). [1]: https://github.com/catarse/catarse [2]: https://github

Re: Lineendings (was Everything good about Python except GUI IDE?)

2016-06-05 Thread MRAB
On 2016-06-05 08:34, Rustom Mody wrote: Just came across this new data (for me) to this old question: On Monday, February 29, 2016 at 8:05:33 AM UTC+5:30, Ben Finney wrote: Rustom Mody writes: > On Monday, February 29, 2016 at 7:33:18 AM UTC+5:30, Chris Angelico wrote: > > Never has for any of

Re: Operator precedence problem

2016-06-05 Thread ICT Ezy
On Sunday, June 5, 2016 at 1:06:21 PM UTC+5:30, Peter Otten wrote: > ICT Ezy wrote: > > 2 ** 3 ** 2 > > Answer is 512 > > Why not 64? > > Order is right-left or left-right? > > ** is a special case: > > """ > The power operator ** binds less tightly than an arithmetic or bitwise unary > op

how to work await x operator?

2016-06-05 Thread ICT Ezy
how to work await x Await expression operator? pl explain any one ... -- https://mail.python.org/mailman/listinfo/python-list

Re: how to work await x operator?

2016-06-05 Thread Marko Rauhamaa
ICT Ezy : > how to work await x Await expression operator? > pl explain any one ... A coroutine can't be called directly. A call to a coroutine must be prefixed with the "async" keyword. That allows Python to perform a context switch between coroutines in case the coroutine needs to wait for the

Re: Operator precedence problem

2016-06-05 Thread Uri Even-Chen
My suggestion: Never write expressions, such as 2 ** 3 ** 2 or even 2 * 4 + 5, without parentheses. Always add parentheses - 2 ** (3 ** 2) (or (2 ** 3) **2) or (2 * 4) + 5 (or 2 * (4 + 5)). *Uri Even-Chen* [image: photo] Phone: +972-54-3995700 Email: u...@speedy.net Website: http://www.speedysof

Re: Operator precedence problem

2016-06-05 Thread Chris Angelico
On Sun, Jun 5, 2016 at 4:53 PM, ICT Ezy wrote: 2 ** 3 ** 2 > Answer is 512 > Why not 64? > Order is right-left or left-right? This example follows the mathematical standard; you start from the "top" (the right hand side), and work your way down. >>> (3**3) % 10 7 >>> (3**3**3) % 10 7 >>> (3

Re: Operator precedence problem

2016-06-05 Thread Random832
On Sun, Jun 5, 2016, at 02:53, ICT Ezy wrote: > >>> 2 ** 3 ** 2 > Answer is 512 > Why not 64? > Order is right-left or left-right? You're mixing up order of evaluation with operator associativity. The ** operator is right-to-left associative, this means x ** y ** z == x ** (y ** z). Evaluation is

Re: I'm wrong or Will we fix the ducks limp?

2016-06-05 Thread Random832
On Sun, Jun 5, 2016, at 02:37, Steven D'Aprano wrote: > No they don't. You are confusing the implementation with the programming > model. > > Following the assignment: > > x = 99 > > if you print(x), do you see something like "reference 0x12345"? No. > > Do you have to dereference that referenc

Re: I'm wrong or Will we fix the ducks limp?

2016-06-05 Thread Random832
On Sun, Jun 5, 2016, at 04:01, Marko Rauhamaa wrote: > You could also think of variables as pegs, references as leashes, and > objects as cute puppies. One puppy could be held with multiple leashes > hung on separate pegs. Some puppies hold leashes in their mouths. Every > leash is tied to a puppy

Re: Spreading a class over multiple files

2016-06-05 Thread Terry Reedy
On 6/5/2016 2:55 AM, Mark Summerfield wrote: Sometimes I want to spread a class over multiple files. My experience with trying to work with two do-all classes in idlelib has engendered a dislike for such. It is hard to find things in a kitchen-sink class. To switch IDLE from being a multi-w

Re: Anyone know a donation app codebase?

2016-06-05 Thread Ben Finney
Albert writes: > Thank you for your answer Ben, You're welcome. Please note that top-posting is poor etiquette for discussions; instead, interleave your response like a written dialogue. See https://en.wikipedia.org/wiki/Posting_style#Interleaved_style>. > That is not exactly what I am looking

Re: I'm wrong or Will we fix the ducks limp?

2016-06-05 Thread Marko Rauhamaa
Random832 : > On Sun, Jun 5, 2016, at 04:01, Marko Rauhamaa wrote: >> You could also think of variables as pegs, references as leashes, and >> objects as cute puppies. One puppy could be held with multiple >> leashes hung on separate pegs. Some puppies hold leashes in their >> mouths. Every leash

Re: I'm wrong or Will we fix the ducks limp?

2016-06-05 Thread Marko Rauhamaa
Random832 : > On Sun, Jun 5, 2016, at 02:37, Steven D'Aprano wrote: >> You bind values (that is, objects) > > Values are not objects. x and z have the same value, and their objects > are identical but distinct, but they are different because they point > (or refer, or by your weird terminology "bi

Re: I'm wrong or Will we fix the ducks limp?

2016-06-05 Thread Random832
On Sun, Jun 5, 2016, at 15:20, Marko Rauhamaa wrote: > I say None is a wooden post, you say None is a puppy. > > What piece of Python code could put our dispute to rest? isinstance(None, object) Anyway, I read the "wooden post" claim as suggesting that a reference to None is somehow different fr

Re: I'm wrong or Will we fix the ducks limp?

2016-06-05 Thread cs
On 03Jun2016 16:09, Sayth Renshaw wrote: (By the way, the "pf = pf.append(thing)" construction is weird. All you need is pf.append(thing).) I got the pf = pf.append(thing) from doing pandas because in pandas its not an inplace function. In Python this doesn't do what you think. The conventi

Re: Operator precedence problem

2016-06-05 Thread Michael Torrie
On 06/05/2016 10:05 AM, Uri Even-Chen wrote: > My suggestion: Never write expressions, such as 2 ** 3 ** 2 or even 2 * 4 > + 5, without parentheses. Always add parentheses - 2 ** (3 ** 2) (or (2 ** > 3) **2) or (2 * 4) + 5 (or 2 * (4 + 5)). I can understand using parenthesis when operator precede

Re: Yet Another Cairo API Binding

2016-06-05 Thread Lawrence D’Oliveiro
On Thursday, June 2, 2016 at 9:16:25 AM UTC+12, I wrote: > Thought I would mention Qahirah , which is > yet another binding for the Cairo graphics > library. To add to this, I have bindings for Pixman

Re: I'm wrong or Will we fix the ducks limp?

2016-06-05 Thread Gregory Ewing
Random832 wrote: There *is* a variable called None [getattr(__builtins__, 'None')] which holds a leash tied to that puppy ... But nothing's special about the object itself, no more than any other object. The only special-ish thing about it is that it's unique -- there will never be another one

Re: I'm wrong or Will we fix the ducks limp?

2016-06-05 Thread Lawrence D’Oliveiro
On Sunday, June 5, 2016 at 3:18:05 PM UTC+12, I wrote: > (This makes no difference for immutable objects, only mutable ones.) I retract this part. Thanks, Marko, for showing me where I was wrong. :) -- https://mail.python.org/mailman/listinfo/python-list

Re: I'm wrong or Will we fix the ducks limp?

2016-06-05 Thread Lawrence D’Oliveiro
On Monday, June 6, 2016 at 1:08:21 PM UTC+12, Gregory Ewing wrote: > The only special-ish thing about [None] is that it's unique -- > there will never be another one like it, no matter how > much dog breeding you do. Fortunately, it's also immortal. Maybe not immortal, but it seems to have 533 liv

Re: Operator precedence problem

2016-06-05 Thread ICT Ezy
On Monday, June 6, 2016 at 5:18:21 AM UTC+5:30, Michael Torrie wrote: > On 06/05/2016 10:05 AM, Uri Even-Chen wrote: > > My suggestion: Never write expressions, such as 2 ** 3 ** 2 or even 2 * 4 > > + 5, without parentheses. Always add parentheses - 2 ** (3 ** 2) (or (2 ** > > 3) **2) or (2 * 4) +

Re: Operator precedence problem

2016-06-05 Thread ICT Ezy
On Sunday, June 5, 2016 at 9:36:20 PM UTC+5:30, Uri Even-Chen wrote: > My suggestion: Never write expressions, such as 2 ** 3 ** 2 or even 2 * 4 > + 5, without parentheses. Always add parentheses - 2 ** (3 ** 2) (or (2 ** > 3) **2) or (2 * 4) + 5 (or 2 * (4 + 5)). > > > *Uri Even-Chen* > [image:

Re: Operator precedence problem

2016-06-05 Thread ICT Ezy
On Sunday, June 5, 2016 at 10:49:49 PM UTC+5:30, Random832 wrote: > On Sun, Jun 5, 2016, at 02:53, ICT Ezy wrote: > > >>> 2 ** 3 ** 2 > > Answer is 512 > > Why not 64? > > Order is right-left or left-right? > > You're mixing up order of evaluation with operator associativity. The ** > operator is

Re: I'm wrong or Will we fix the ducks limp?

2016-06-05 Thread Steven D'Aprano
On Mon, 6 Jun 2016 03:42 am, Random832 wrote: > On Sun, Jun 5, 2016, at 02:37, Steven D'Aprano wrote: >> No they don't. You are confusing the implementation with the programming >> model. >> >> Following the assignment: >> >> x = 99 >> >> if you print(x), do you see something like "reference 0x

Re: Everything good about Python except GUI IDE?

2016-06-05 Thread Michael Torrie
On 03/02/2016 03:36 PM, Marko Rauhamaa wrote: > Requirements for what I have in mind: > > 1. It would have to be and feel like real Python. > > 2. External commands should be available as callable Python functions. > > 3. Functions/commands should return streams. (Generators, maybe?) > > 4.

Re: I'm wrong or Will we fix the ducks limp?

2016-06-05 Thread Random832
On Sun, Jun 5, 2016, at 23:52, Steven D'Aprano wrote: > Certainly not. x = y = 999 is required to bind the same object to x and > y. My statement was that if two variables can be bound to the same object, then variables *cannot* contain objects. The object has to exist somewhere, and this requirem

Re: Everything good about Python except GUI IDE?

2016-06-05 Thread Michael Torrie
On 06/05/2016 10:01 PM, Michael Torrie wrote: > I've thought about this before and even tried my hand at creating a nice > library for doing this sort of thing with Python. Generators seem like > a natural analog for the shell pipes. However there is one big problem > with them and that is they ca

Re: Operator precedence problem

2016-06-05 Thread Lawrence D’Oliveiro
On Monday, June 6, 2016 at 4:06:20 AM UTC+12, Uri Even-Chen wrote: > Never write expressions, such as 2 ** 3 ** 2 or even 2 * 4 > + 5, without parentheses. That leads to the code equivalent of . -- https

Re: Don't put your software in the public domain

2016-06-05 Thread Nobody
On Sat, 04 Jun 2016 12:28:33 +1000, Steven D'Aprano wrote: >> OTOH, a Free software licence is unilateral; the author grants the user >> certain rights, with the user providing nothing in return. > > That's not the case with the GPL. > > The GPL requires the user (not the end-user, who merely av

Re: I'm wrong or Will we fix the ducks limp?

2016-06-05 Thread Gregory Ewing
Steven D'Aprano wrote: The *name* "x" is an entity which is bound to (i.e. a reference to) the object 99, in some specific namespace, at some specific time. The name itself is an English word consisting of a single letter, "x". This is one reason why the term "name" is not good subsitute for th

Would like to see output of each block of python

2016-06-05 Thread archana . sonavane
Hi Team, I would like to see output of each block of python. Don't have any idea about python. What is command to see the output of each code block. #!/usr/bin/env python # # ganglia-api.py - Ganglia Metric API #