On Mon, Oct 07, 2019 at 05:18:39PM +0200, Anders Hovmöller wrote:
On 7 Oct 2019, at 16:36, Batuhan Taskaya <isidentical@gmail.com> wrote:
In fact, that would be a cool feature for ORMs. IMHO instead of ugly call chain with filters, slicing is a better option (on `__class_getattr__`). As said there are some disadvantages but i think this proposal deserves a PEP.
I really don't see why. Is () so much different than [] to you? Because that seems like the only difference here.
To me, "()" says "arbitrary function call potentially with side- effects". "[]" says "lookup". We use list[idx] and dict[key], not list(idx) and dict(key). It is big enough that the distinction between () and [] calling conventions has been built into the language since before Python 1.0. And it is big enough that when we were looking for syntax to use for type annotations, we settled on Union[Spam, Eggs] rather than round brackets Union(Spam, Eggs). So yes, the difference between [] and () is a big difference. -- Steven