[issue39834] + vs. % operator precedence not correct

2020-03-03 Thread E
Change by E : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bugs-list

[issue39834] + vs. % operator precedence not correct

2020-03-03 Thread E
E added the comment: Actually, the operator precedence is read upside down: https://docs.python.org/3/reference/expressions.html Thus, % has operator precedence and this might be causing the incorrect values. -- ___ Python tracker

[issue39834] + vs. % operator precedence not correct

2020-03-03 Thread E
rpreter Core messages: 363241 nosy: ergun priority: normal severity: normal status: open title: + vs. % operator precedence not correct type: behavior versions: Python 3.7 ___ Python tracker <https://bugs.python

() vs. [] operator

2009-10-15 Thread Ole Streicher
Hi, I am curious when one should implement a __call__() and when a __getitem__() method. For example, I want to display functions and data in the same plot. For a function, the natural interface would to be called as f(x), while the natural interface for data would be f[x]. On the other hand,

Re: () vs. [] operator

2009-10-15 Thread Steven D'Aprano
On Thu, 15 Oct 2009 09:14:35 +0200, Ole Streicher wrote: So what is the reason that Python has separate __call__()/() and __getitem__()/[] interfaces and what is the rule to choose between them? They are separate so you can implement both, or just one, or neither, whichever makes the most

Re: () vs. [] operator

2009-10-15 Thread Xavier Ho
On Thu, Oct 15, 2009 at 5:14 PM, Ole Streicher ole-usenet-s...@gmx.netwrote: snip So what is the reason that Python has separate __call__()/() and __getitem__()/[] interfaces and what is the rule to choose between them? Hi, This is very interesting, a thought that never occured to me before.

Re: () vs. [] operator

2009-10-15 Thread Chris Rebert
On Thu, Oct 15, 2009 at 12:14 AM, Ole Streicher ole-usenet-s...@gmx.net wrote: Hi, I am curious when one should implement a __call__() and when a __getitem__() method. For example, I want to display functions and data in the same plot. For a function, the natural interface would to be

Re: () vs. [] operator

2009-10-15 Thread Carl Banks
On Oct 15, 12:14 am, Ole Streicher ole-usenet-s...@gmx.net wrote: Hi, I am curious when one should implement a __call__() and when a __getitem__() method. For example, I want to display functions and data in the same plot. For a function, the natural interface would to be called as f(x),