5 ms·
That's the syntax? Looks to me like another reason to stick with Python2.
by daveguy 11y ago
That's the syntax? Looks to me like another reason to stick with Python2.
- aroberge 11y agoIt's optional typing: you don't have to use it with Python 3.
- fulafel 11y agoThat sounds more like a C++ than Python design sensibility.
- coldtea 11y agoTo me it sounds like addressing a pain point for larger projects, moving the language forward, and adding something many in the community has long wanted (as evident by blog posts and articles, earlier type checking tool attempts, the acceptance of the relevant PEP, etc).
- fulafel 11y agoYes and that sounds unfamiliar from Python cultural POV. Python used to be the language that didn't try to please everyone and kept a coherent design philosophy that resulted in a clean and simple language.
- _yy 11y agoStill is clean and simple. I like the new syntax.
- creshal 11y ago> Yes and that sounds unfamiliar from Python cultural POV. Addressing pain points is unfamiliar to the Python culture? In practice, type intransparency is a serious problem – duck typing is only fun as long as everyone a) knows what a duck is and b) agrees on what it should do. Type hints make it a lot easier to work with opaque libraries and inside large codebases.
- coldtea 11y ago>Python used to be the language that didn't try to please everyone On the contrary. I use Python professionally since 1997, and it has had all kinds of features added on for different needs, from decorators and generators to async and virtual environments, context managers, list comprehensions, dict comprehensions and what have you. Of the languages I know of, only C# has had a similar pace of adding new stuff in to the core language (not just libraries). When did Python shy away from adding new features? It seems that Python didn't try to please only 2 categories of people: those who dislike significant whitespace, and those who want proper closures. >and kept a coherent design philosophy that resulted in a clean and simple language At this point I'd say that Python, with its full feature set, is as complex as a scripting language gets. Maybe Perl 6 trumps it, not sure -- but what you describe is closer to a language like Lua, or tcl or even Go than Python.
- fulafel 11y agoIt's true that the pace of cruft accumulation is worrying lately. Note that I said "used to"! Personally I think it all started to go overboard around the introduction of list comprehensions when we had perfectly good map, filter and lambda.
- mwhite 11y agoFor those curious, list comprehensions were introduced in 2000 with Python 2.0.
- scott_karana 11y ago> Python used to be the language that didn't try to please everyone and kept a coherent design philosophy that resulted in a clean and simple language. Uh, ever seen "Batteries included" referenced in their documentation?
- fulafel 11y agoYes, but it's definitely not the same thing. The vice of trying to please everyone means giving various people the features they ask for instead of weighing against the common good of the user base.
- gipp 11y agoWhat more agreeable syntax could you possibly ask for?
- frik 11y agodef (str) greeting((str) name): Edit: it was just an idea, it would be a bit more C-style syntax; of course backwards compatibility wouldn't be possible. Instead of downvoting would you care to explain?
- rootlocus 11y agoI didn't downvote, but I don't like the syntax for a couple of reasons: 1. Instead of being more like C-style function declarations, they look a lot more like C-style type conversions. 2. However closer it may be to C (type before identifier I guess?) it's pretty far from any other mainstream language. For instance, C++ has support for -> syntax for function types (http://stackoverflow.com/questions/22514855/arrow-operator-in-function-heading http://stackoverflow.com/questions/22514855/arrow-operator-i...) and some other languages (I can think of Scala) use name: Type declarations. As a personal preference, I find the python type hinting more familiar than your example, despite (myself) being most familiar with C-like syntax.
- vive-la-liberte 11y agoPython is not C so why should it suddenly "pretend to be" when doing type hinting? Also, I personally find that the type declaration format of C is one of my least favorite things about C.
- ghshephard 11y agoI'll bite - what would have liked to see in terms of syntax to (optionally as others have noted) provide hints as to what type each data element should be?