Live data from Hacker News

Python 3.8.0a1 is now available for testing

pythoninsider.blogspot.com

51–59 of 59 posts

Re: Python 3.8.0a1 is now available for testing

#51

Are assignment expressions the only linguistic change? For years,I've been holding my breath in Python for sum types, totality checking, and an enforced, complete type system -- one where you can say "this should be a list of lists of integers" and it won't let you put any other kind of thing there. (Yes, there are external typing solutions like PyPy, but last I checked they did not offer complete type systems (you c…

> but not that it’s a list of ints Python type annotations do support such use case: List[int].

Just tried it. What's the point of type signatures if the compiler won't hold you to the promises you've made? This is in Python 3.6.4:

  >>> def f (x:int) -> int: return x+1
  ...
  >>> def g (x:str) -> str: return f(x)
  ...
  >>> g(1)
  2
I expected a complaint after the second definition: I specified that g takes and returns a string, and then defined it to take and return an int. Not only did Python not catch the error at compile time (defining g), it didn't even catch it at runtime (calling g).

Re: Python 3.8.0a1 is now available for testing

#52

Earlier quoted context omitted.

> but not that it’s a list of ints Python type annotations do support such use case: List[int].

Just tried it. What's the point of type signatures if the compiler won't hold you to the promises you've made? This is in Python 3.6.4: >>> def f (x:int) -> int: return x+1 ... >>> def g (x:str) -> str: return f(x) ... >>> g(1) 2 I expected a complaint after the second definition: I specified that g takes and returns a string, and then defined it to take and return an int. Not only did Python not catch the error at c…

For some strange reasons Python developers decide to provide the syntax of type annotations but leave the actual checking to third party implementations.

Re: Python 3.8.0a1 is now available for testing

#53

Earlier quoted context omitted.

> but not that it’s a list of ints Python type annotations do support such use case: List[int].

Just tried it. What's the point of type signatures if the compiler won't hold you to the promises you've made? This is in Python 3.6.4: >>> def f (x:int) -> int: return x+1 ... >>> def g (x:str) -> str: return f(x) ... >>> g(1) 2 I expected a complaint after the second definition: I specified that g takes and returns a string, and then defined it to take and return an int. Not only did Python not catch the error at c…

Type annotations are just that: annotations. They currently have no meaning to the CPython interpreter and are purely consumed by external tooling (IDEs, there's a static typechecker called mypy, ...) or code that chooses to use them (e.g. there's web frameworks that convert and validate parameter types according to the signature of the handler function)

Re: Python 3.8.0a1 is now available for testing

#54

Earlier quoted context omitted.

I agree with you. It's very exciting to remove these sorts of redundant lines, but I cannot train my brain to intuitively view that line as it will be interpreted. There is one case where the benefit, IMHO, far outweighs the negatives, and that can be seen in slides 30-31 of Dustin Ingram's slideshow[1]. PEP 572... the day Python jumped the walrus. 1. https://speakerdeck.com/di_codes/pep-572-the-walrus-operator...

I can't take a programming talk seriously if it declares in giant font "Less lines are better" (slide 38). Any C program can be written as a single line, with no linebreaks - that doesn't make it "better" by any metric. Python is built around its readability, and slide 44: > group = match.group(1) if (match := re.match(data)) else None is anything but. 'match' is assigned after its first use, and it took me far to lo…

C is different than python though. Python already forces readability things like forcing indent and newline. In most scenarios making a python program in as few lines as possble will make the program more readible.

Re: Python 3.8.0a1 is now available for testing

#55

Are assignment expressions the only linguistic change? For years,I've been holding my breath in Python for sum types, totality checking, and an enforced, complete type system -- one where you can say "this should be a list of lists of integers" and it won't let you put any other kind of thing there. (Yes, there are external typing solutions like PyPy, but last I checked they did not offer complete type systems (you c…

> an enforced, complete type system

You are looking at the wrong language.

That said, the array module has been around for ages, for performance reasons.

Re: Python 3.8.0a1 is now available for testing

#57

Are assignment expressions the only linguistic change? For years,I've been holding my breath in Python for sum types, totality checking, and an enforced, complete type system -- one where you can say "this should be a list of lists of integers" and it won't let you put any other kind of thing there. (Yes, there are external typing solutions like PyPy, but last I checked they did not offer complete type systems (you c…

> an enforced, complete type system You are looking at the wrong language. That said, the array module has been around for ages, for performance reasons.

I use Haskell outside of work, and absolutely love it. (And in its case, too, I'm holding my breath for dependent types, which I believe are expected around summer of 2020.)

Re: Python 3.8.0a1 is now available for testing

#58
post #26

I am a proponent of LTS for Python 2.7x and existing libraries. This walrus operator is a fine new feature, for those that want it in Python 3.8x and beyond. Sorry, not sorry !

I can't wait for 2020.

Your new valuable key points imply much a person like me and extremely more to my office workers. With thanks; from every one of us. https://www.gangboard.com/app-programming-scripting-training... http://www.traininginannanagar.in/python-training-in-chennai...

Re: Python 3.8.0a1 is now available for testing

#59
I and my friends were going through the nice, helpful tips from the blog then the sudden came up with an awful suspicion I never expressed respect to the website owner for those secrets. https://www.besanttechnologies.com/training-courses/python-t... https://www.besanttechnologies.com/training-courses/cloud-co...
Post reply on HN