In article <mailman.17951.1421906568.18130.python-l...@python.org>, Ethan Furman <et...@stoneleaf.us> wrote: >-=-=-=-=-=- > >On 01/21/2015 08:30 PM, Steven D'Aprano wrote: >> >> So what is this unspeakable, nightmarish, cryptic abomination going to look >> like? Here's an example from PEP 484: >> >> def greeting(name: str) -> str: >> return 'Hello ' + name >> >> >> I don't know about you, but I think anyone who cannot read that and intuit >> that argument `name` is a string and the return result is also a string > >There is nothing inherently intuitive about that syntax. The : makes it >look like a dictionary (but it isn't) and the >-> looks like a pointer to something (but it isn't).
It is too bad `` -> '' as a token is now taken. I wanted to propose to replace the ternary syntax lambda .. : .. by a regular operator .. -> .. then we could have x -> x**2 instead of lambda x : x**2 Moreover the value of a function would be a lambda not def square(x): x**2 but square = x->x**2 or mult = x,y -> result = 0 for i in range(x): result +=y return result doing away with the ternary operator def def .. ( .. ) : .. replacing it by two binary operators, one of them (=) being thoroughly familiar. It is horrifying to see that def is now becoming a quaternary operator def .. ( .. ) --> .. : .. Also name:str is the wrong order. I would propose to use :: to prevent confusion. Then I would allow <type>:: in front of all objects everywhere to trigger a warning if at that point the objects is not of the right type. I think it is quite natural that float: sets the expectation that a float is coming. float:: x = get_some_crap_from_an obscure_windows_box( a, B, c, a_lighter, some_list, REAL_ISB_MASK ) > >> is probably going to have bigger troubles with Python than just type-hinting. > >Yup, true -- I do find writing meta-classes takes extra work. ;) > >-- >~Ethan~ > > > >-=-=-=-=-=- >[Attachment type=application/pgp-signature, name=signature.asc] >-=-=-=-=-=- -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst -- https://mail.python.org/mailman/listinfo/python-list