On Thu, Dec 17, 2020 at 10:47 AM Greg Ewing wrote:
> A feature of Prothon was that a.b() and t = a.b; t() would do
> quite different things (one would pass a self argument and the
> other wouldn't).
>
> I considered that a bad thing. I *like* the fact that in Python
> I can use a.b to get a bound
On 17/12/20 8:16 am, Paul Sokolovsky wrote:
With all the above in mind, Python3.7, in a strange twist of fate, and
without much ado, has acquired a new operator: the method call, ".()".
> CPython3.6 and below didn't have ".()" operator, and compiled it as
> "attr access" + "function call", but
On Wed, 16 Dec 2020 at 20:18, Paul Sokolovsky wrote:
> But still, are there Python implementations which compile "(a.b)()"
> faithfully, with its baseline semantic meaning? Of course there're.
OK, Paul, why don't you propose a PR and a bug report about it?
Hello,
On Wed, 16 Dec 2020 00:50:27 +1300
Greg Ewing wrote:
> On 16/12/20 12:24 am, Paul Sokolovsky wrote:
>
> > That's good answer, thanks. But... it doesn't correspond to the
> > implementation reality.
>
> Why are we talking about implementation? You said you wanted
> to keep to the
In that case:
spam = spam if spam is not None else self.spam
The “or” won’t work with zero.
> On Dec 16, 2020, at 11:00 PM, Marco Sulla
> wrote:
>
> On Wed, 16 Dec 2020 at 19:52, Abdulla Al Kathiri
> wrote:
>>
>> Or more concise
>> def method(self, spam, eggs, cheese, *args):
>>
On Wed, 16 Dec 2020 at 19:52, Abdulla Al Kathiri
wrote:
>
> Or more concise
> def method(self, spam, eggs, cheese, *args):
> spam = spam or self.spam
> eggs = eggs or self.eggs
> #etc., The above is equivelent to the following:
> spam = spam if spam else self.spam
> eggs = eggs if eggs else
Or more concise
def method(self, spam, eggs, cheese, *args):
spam = spam or self.spam
eggs = eggs or self.eggs
#etc., The above is equivelent to the following:
spam = spam if spam else self.spam
eggs = eggs if
On 12/16/20 1:31 AM, Serhiy Storchaka wrote:
Things like abstractclassmethod are legacy. It is more preferable to
combine elemental decorators.
I completely disagree, although I suppose the determining factor is one's point of view. I see it as
"abstractclassmethod" being its own thing, and
Hello,
On Tue, 15 Dec 2020 23:28:53 +1100
Steven D'Aprano wrote:
> On Tue, Dec 15, 2020 at 01:16:21PM +0300, Paul Sokolovsky wrote:
>
> > You're now just a step away from the "right answer". Will you make
> > it? I did.
>
> Sorry Paul, but you didn't.
>
> You fooled yourself by comparing
On Wed, Dec 16, 2020 at 09:11:18AM -, Local-State wrote:
> This seems okay, but when there are more than 10 arguments need to set
> their default values as correlated member variables (with the same
> name at most times), it'll be very painful and the codes turn out to
> be quite ugly.
If I ran into this (never have), my first inclination would be to write a
decorator.
The decorator would capture the relevant arguments (either just all of
them, or perhaps using the argument names supplied to the decorator when it
is called, or perhaps using a custom type hint applied to the
Hello guys,
First time for me to submit a feature request for python.
A lot of time we try to use a member variable as the default value of a member
function argument. So we write the code like this:
```python
class A:
def __init__(self, a: int = 3):
self.a = a
def func(self, a:
On Wed, Dec 16, 2020 at 12:16:46AM -, Paolo Lammens wrote:
> Old thread, pity it didn't get any traction. I second this.
It is a thread from 2011. Do you think people will remember what it is
about, or still have it in their inboxes?
At this point, you should start a new thread (and link
03.01.11 23:09, K. Richard Pixley пише:
> There's a whole matrix of these and I'm wondering why the matrix is
> currently sparse rather than implementing them all. Or rather, why we
> can't stack them as:
>
> class foo(object):
> @classmethod
> @property
> def bar(cls, ...):
>
04.01.11 02:56, Guido van Rossum пише:
> That said, I am sure there are use cases for static property and class
> property -- I've run into them myself.
>
> An example use case for class property: in App Engine, we have a Model
> class (it's similar to Django's Model class). A model has a "kind"
15 matches
Mail list logo