Re: [Python-ideas] Continuation of `__name__` or a builtin function for general name getting

2017-06-18 Thread Alireza Rafiei
Thanks for the explanation! On Sun, Jun 18, 2017 at 4:00 PM, Chris Angelico <ros...@gmail.com> wrote: > On Mon, Jun 19, 2017 at 8:47 AM, Alireza Rafiei > <alireza.rafie...@gmail.com> wrote: > >> Hmm. So... after x = f, f.__name__ would be different from x.__name__? &

Re: [Python-ideas] Continuation of `__name__` or a builtin function for general name getting

2017-06-18 Thread Alireza Rafiei
`quote` or alike that behaves as described previously (name(x) would be 'x' and name(f) would be 'f' and name ("hello") would be "hello" etc.) and still appreciate any input on it. On Sun, Jun 18, 2017 at 3:24 PM, MRAB <pyt...@mrabarnett.plus.com> wrote: > On 2017-06-18

Re: [Python-ideas] Continuation of `__name__` or a builtin function for general name getting

2017-06-18 Thread Alireza Rafiei
"hello" and the value of the name "hello" would be "hello". My proposal is to either change the behavior of `__name__` or have something similar that acts globally for all objects and types to get a quote-like behavior, provided that the operands of quotes a

[Python-ideas] Continuation of `__name__` or a builtin function for general name getting

2017-06-18 Thread Alireza Rafiei
Hi all, I'm not sure whether this idea has been discussed before or not, so I apologize in advanced if that's the case. Consider the behavior: >>> f = lambda: True > >>> f.__name__ > '' > >>> x = f > >>> x.__name__ > '' I'm arguing the behavior above is too brittle/limited and, considering

[Python-ideas] Multiple level sorting in python where the order of some levels may or may not be reversed

2016-10-15 Thread Alireza Rafiei
Hi all, I have a list called count_list which contains tuples like below: [('bridge', 2), ('fair', 1), ('lady', 1), ('is', 2), ('down', 4), > ('london', 2), ('falling', 4), ('my', 1)] I want to sort it based on the second parameter in descending order and the tuples with the same second