Announcement

Collapse
No announcement yet.

Python 3.12 Alpha 4 Released For Testing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • fitzie
    replied
    Originally posted by uid313 View Post

    The this keyword - I am fine with the name self, and don't think it should be possible to rename it anything else, and it is a chore to have to add self as argument to every method, and it also looks weird, because then it looks like an argument that you suppose to supply when calling the method. It is counter-intuitive. I would much prefer that self just magically appears like the this keyword do in Java.
    Maybe you should run:
    Code:
    import this

    Leave a comment:


  • uid313
    replied
    Originally posted by fitzie View Post

    sure, there are lots of things that python doesn't have because it's an older language, but it improving in lots of regards. but going down your list

    * documentation: I rather no standard then 100% rst. i'm sure markdown will win the war eventually.
    * there are types: submit a pull request
    * as of python 3.9 you can use list, and not List, in fact List will be deprecated eventually.
    * walrus is weird, but that's one bit of syntatic sugar, I find python obviously free of weird operators, and would stack it's weird operations against any other language.
    * don't like properties, don't use them.
    * class vs instance. this seems honestly like a learning curve thing (not to slight it) and once you get it it clicks. I don't know how dataclasses changes this in any way.
    * specifying self is perfectly acceptable scheme. better then "this" that just magically appears in java. If you don't like the word "self", feel free to rename it this.
    * okay, this is some serious meat. I certainly say that the design of python has been challenging to people that have created huge code bases, but things like ABC are great. and it's great that I've written tens of thousands of lines of well testing python code without having to use ABC

    No language is perfect my own issues with python:

    * slow. it is killer slow, and not just the GIL. it's nice they are trying to fix it, but wow, it is slow
    * threading. gil of course the gil is a major problem with threading, but again that is not the reason python is so slow.
    * packaging. things are (slowing) improving, but not as quick as possible. there are lots of pitfalls in packaging, and pything packaging is successful, but still has tons of issues
    * typing. I think I don't really care too much about this I use typing and turn it all on, but it's still a work in progress, and not even close to lving up to it's full potential
    * framework wars: honeslty python has been diverted by some false economy frameworks, we had django, zope, twisted, sqlalchemy, which really were too burdened to become what we want. go look at the orm space, or web framework space now, and you see that the improved frameworks don't really have the manpower to sustain themselves. hopefully sqlalchemy turns out good, and the fastapi framework really pulls it together. people should just be able to be productive
    * missing a single binary service mode. golang (and now rust) have created an amazing ecosystem of comprehensive applications with all assets and code in one binary. python needs this, and not just with some appimage/container based package scheme.

    what i like about python:

    * sqlite and json in the core library
    * some really amazing developers creating great packages like black, httpx (and requests before it), arrow, pydantic, attr, sanic. helps me focus on my problem and not all the plumbing.
    * pip and pdm making dealing with packaging tolerable
    * vscode giving python a pretty decent programming experience (vscode having jupyter support is really cool)
    * fairly acceptable libraries for everything, from crypto, AI/ML, graphics, GUIs, etc
    * honestly I like that it's typing optional and 100% public. that really does allow people to code the way they think
    * python programmers don't do CamelCase .
    * asyncio . I was just find programming select loops, but this is a way for the ecosystem to move forward.
    * repl . python does it best.

    I do think python has a pretty big nitch, and there are up and comers like julia coming for it. and golang has taken over lots of the devops spaces. but it's pretty easy to get to write a simple gui or a website and python is not often a language people regret learning.
    Documentation - I am not a fan of reStructuredText either, and also prefer Markdown, but I would rather have a documentation standard, whatever that might be, I would be fine with either Markdown or reStructuredText, because with a standard at least the documentation would be consistent and me and everybody else would know how to write documentation and there would be no need to have discussions on how to document the code.

    Typing - I like that in Python 3.9 you can use list instead of List for type hinting, but this is what I mean, the type hinting in Python has been poorly implemented, before you had to do Union[Foo, Bar] now you can do Foo | Bar which is nicer, but it should have been like this in the first place. It is getting better, but it is a terrible journey, in TypeScript it has always been good from the start.

    The class vs instance variables is not much of a learning curve, its a small learning curve, you learn it quickly, but its confusing and after a few months break from Python you get confused about it again.

    The this keyword - I am fine with the name self, and don't think it should be possible to rename it anything else, and it is a chore to have to add self as argument to every method, and it also looks weird, because then it looks like an argument that you suppose to supply when calling the method. It is counter-intuitive. I would much prefer that self just magically appears like the this keyword do in Java.

    Slow - I don't mind that Python is slow, for me I think it is mostly fast enough for most of my use cases. Python 3.11 is much faster, and hopefully Python will be even faster in the future.
    GIL - Personally, I don't really mind the GIL, it has not been much of a problem for me yet.

    I think the JSON library in Python is really shitty, you can't even deserialize a JSON string into a class without having to resort to third-party libraries.
    I agree, I really love Black.
    I agree, like VS Code too.
    I agree, I like that the typing is optional too.
    As for asyncio, I don't think it is so good, it is not as easy as I think it should be, and you can't do top-level awaits, you have to await inside a function and you need to call the asyncio.run() which I think is boilerplate code.

    Another shitty thing about Python is the def keyword which makes no sense, def as in what? as in define? Oh define class, define variable, define variable? For some reason it is used for functions. Why couldn't they just call it fn, fun, or func instead?

    Leave a comment:


  • fitzie
    replied
    Originally posted by uid313 View Post
    I think Python is a great language to someone who wants to learn programming, and a great language for tinkerers, scientists, mathematicians, biologists, chemists, statisticians, engineers, and other people who are not developers. I think Python is a terrible language for developers.

    It is great because it is so simple and non-developers can just focus on what they want to do, and its easy to learn, because it is simple and it doesn't have advanced stuff in it. You import some module, write your functions and call it. Simple and easy!

    But for developers Python sucks.
    • Documentation - Unlike other languages such as Rust which standardized comments on Markdown, or C# which standardized on XML documentation, or Java which standardized on Javadoc, the situation in Python is worse, there is no real standard for documentation. Some use Markdown, some use reStructuredText, others use something else. Even internally Python itself is very inconsistent in its documentation.
    • Example code - Without types it is difficult to follow what is happening, or what you can expect or how a function is used. You have no idea what a function or algorithm expects or returns without type hints.
    • Type hints - Type hints are great in other languages such as TypeScript, but in Python they are difficult to write because you have to use List or Sequence or other stuff depending if its input or return type, and you have to use Map or something else, it is very awkward. Up until recently doing union types was very awkward, but it is better now. Type hints are so shitty, awkward and immature that they have not been embraced by the Python community. Even Python itself is not properly type hinted.
    • Weird operators - Python has weird confusing stuff like the Walrus operator := which not used by any other language. So nobody is familiar with it, its and extra thing to learn and people get confused and don't know what it is.
    • Properties - Python has this weird, awkward, way to write properties that require lots of boilerplate code and the use of decorators. Compare this to other languages like C# where it is dead simple, or even TypeScript.
    • Class variables and instance variables - Are confusing, it is not obvious if it is a class variable or a instance variable, there is no syntactic difference, you have to check if its assigned using self or not. This gets even more confusing with @dataclass that changes this behavior.
    • Self - You have to pass self as argument to every method in a class.
    Python tricks you that it is a simple language, because it doesn't have interfaces, abstract classes, properties, etc. The truth is, it doesn't have native first-class support for these stuff in the syntax of the language itself, but you can still do these things with the Abstract Base Classes (ABC) module that provides decorators, the @property decorator, etc, so when you do it it gets all awkward because you use things that shoehorned on instead of natively supported.
    sure, there are lots of things that python doesn't have because it's an older language, but it improving in lots of regards. but going down your list

    * documentation: I rather no standard then 100% rst. i'm sure markdown will win the war eventually.
    * there are types: submit a pull request
    * as of python 3.9 you can use list, and not List, in fact List will be deprecated eventually.
    * walrus is weird, but that's one bit of syntatic sugar, I find python obviously free of weird operators, and would stack it's weird operations against any other language.
    * don't like properties, don't use them.
    * class vs instance. this seems honestly like a learning curve thing (not to slight it) and once you get it it clicks. I don't know how dataclasses changes this in any way.
    * specifying self is perfectly acceptable scheme. better then "this" that just magically appears in java. If you don't like the word "self", feel free to rename it this.
    * okay, this is some serious meat. I certainly say that the design of python has been challenging to people that have created huge code bases, but things like ABC are great. and it's great that I've written tens of thousands of lines of well testing python code without having to use ABC

    No language is perfect my own issues with python:

    * slow. it is killer slow, and not just the GIL. it's nice they are trying to fix it, but wow, it is slow
    * threading. gil of course the gil is a major problem with threading, but again that is not the reason python is so slow.
    * packaging. things are (slowing) improving, but not as quick as possible. there are lots of pitfalls in packaging, and pything packaging is successful, but still has tons of issues
    * typing. I think I don't really care too much about this I use typing and turn it all on, but it's still a work in progress, and not even close to lving up to it's full potential
    * framework wars: honeslty python has been diverted by some false economy frameworks, we had django, zope, twisted, sqlalchemy, which really were too burdened to become what we want. go look at the orm space, or web framework space now, and you see that the improved frameworks don't really have the manpower to sustain themselves. hopefully sqlalchemy turns out good, and the fastapi framework really pulls it together. people should just be able to be productive
    * missing a single binary service mode. golang (and now rust) have created an amazing ecosystem of comprehensive applications with all assets and code in one binary. python needs this, and not just with some appimage/container based package scheme.

    what i like about python:

    * sqlite and json in the core library
    * some really amazing developers creating great packages like black, httpx (and requests before it), arrow, pydantic, attr, sanic. helps me focus on my problem and not all the plumbing.
    * pip and pdm making dealing with packaging tolerable
    * vscode giving python a pretty decent programming experience (vscode having jupyter support is really cool)
    * fairly acceptable libraries for everything, from crypto, AI/ML, graphics, GUIs, etc
    * honestly I like that it's typing optional and 100% public. that really does allow people to code the way they think
    * python programmers don't do CamelCase .
    * asyncio . I was just find programming select loops, but this is a way for the ecosystem to move forward.
    * repl . python does it best.

    I do think python has a pretty big nitch, and there are up and comers like julia coming for it. and golang has taken over lots of the devops spaces. but it's pretty easy to get to write a simple gui or a website and python is not often a language people regret learning.

    Leave a comment:


  • uid313
    replied
    Originally posted by Dr_ST View Post

    Well my point is not that rust is not good nor does not bring anything, rather that if the developpers had kept the focus on providing a strong web browser, Firefox MAY have stayed much preferred. That reminds me the same story with Perl 5 when they wanted to go to Perl 6. Long story short, Perl5 slowly dies, Raku, the "real Perl 6" is anywhere to nothing, and Python is now strong. I hope mozilla will not suffer the same with firefox, but they have already nearly abandonned thunderbird for instance.... To see last "tendencies" about these langages, see the google Trends results https://trends.google.com/trends/exp...aku,javascript, or Tiobe Index or surveys from StackOverflow.
    I think Mozilla's bet on Rust was a good one, it turned out to be very successful and adopted outside of Mozilla and now even by Google for Chrome. Firefox demise wasn't because of Rust, it was despite Rust, it had other reasons such as the CEO increasing her salary ever year even though the market share went down every year, Mozilla firing engineers and developers and hiring and keeping social justice warrior bloggers.

    Sometimes you have to be brave and do a bit of refresh like when Python 2 became Python 3, sure there were some people who complained but ultimately it was good, or when PHP skipped version 6 and 7 and went straight from 5 to 8.

    As for TIOBE, I don't find it interesting, they list SQL as one of the top language, but SQL isn't really a programming language in the classical sense. It ranks Python at the top, because lots of newbies Google for Python and post questions about Python on StackOverflow because Python is what they get taught at school, not because Python is a good language.

    Leave a comment:


  • Dr_ST
    replied
    Originally posted by uid313 View Post
    TypeScript is not forced on anyone, it is offered as an optional transpiler that you can chose to use in your build toolchain, and it compiles down to good old plain JavaScript.
    Rust is not bullshit, it is introduces novel concepts like lifetimes to handle references instead of garbage collection or manually freeing memory. It is adopted by Google, Microsoft, the Linux kernel, etc because it brings value.


    No, I don't have dynamic typing phobia, but I prefer strong typing because it reduces bugs.
    Compare Python with TypeScript, both have optional typing but the type system in TypeScript is much more intuitive than the one Python.
    As for "class OOP" in my mind, no I also code in Rust which does not have classes, and JavaScript which is prototype-based, unlike Python which does have classes.


    You should write tests the business logic of your application, you shouldn't have to write tests for what the type system can do. A strong type system is great because it gives you compile-time guarantees which allows you to write less tests.
    Well my point is not that rust is not good nor does not bring anything, rather that if the developpers had kept the focus on providing a strong web browser, Firefox MAY have stayed much preferred. That reminds me the same story with Perl 5 when they wanted to go to Perl 6. Long story short, Perl5 slowly dies, Raku, the "real Perl 6" is anywhere to nothing, and Python is now strong. I hope mozilla will not suffer the same with firefox, but they have already nearly abandonned thunderbird for instance.... To see last "tendencies" about these langages, see the google Trends results https://trends.google.com/trends/exp...aku,javascript, or Tiobe Index or surveys from StackOverflow.

    Leave a comment:


  • uid313
    replied
    Originally posted by Dr_ST View Post
    TypeScript is bullshit forced by Microsoft to kill Java, Rust is bullshit invented by mozilla instead of producing next-generation web browser (and I support Mozilla since its begining). Python just works, allows to program efficiently and fast. If you need performance use assembler, C, C++, otherwise Python is perfect. Not counting python's ecosystem.
    TypeScript is not forced on anyone, it is offered as an optional transpiler that you can chose to use in your build toolchain, and it compiles down to good old plain JavaScript.
    Rust is not bullshit, it is introduces novel concepts like lifetimes to handle references instead of garbage collection or manually freeing memory. It is adopted by Google, Microsoft, the Linux kernel, etc because it brings value.

    Originally posted by stalkerg View Post
    Python is the best for developers! uid313, you have dynamic typing phobia and "class OOP" in mind.
    No, I don't have dynamic typing phobia, but I prefer strong typing because it reduces bugs.
    Compare Python with TypeScript, both have optional typing but the type system in TypeScript is much more intuitive than the one Python.
    As for "class OOP" in my mind, no I also code in Rust which does not have classes, and JavaScript which is prototype-based, unlike Python which does have classes.

    Originally posted by partcyborg View Post

    You can't blame the language for crappy untested code. Bad code is bad in any language. Your silent data corruption wasn't python's fault, it was the developers fault for not writing tests to ensure no bugs creep into the system. All production code should be fully tested. Production Python code MUST have even more comprehensive tests if you aren't using mypy as it isn't type safe.
    You should write tests the business logic of your application, you shouldn't have to write tests for what the type system can do. A strong type system is great because it gives you compile-time guarantees which allows you to write less tests.

    Leave a comment:


  • cynic
    replied
    Originally posted by brucethemoose View Post
    Whoa, lots of Python extremism here!

    My take is that its a fabulous orchestration language for stuff like Blender, PyTorch, VapourSynth, and so on. But it is a shame when the orchestration grows into an architecture, which is when the runtime starts eating CPU and deeper bugs make you wish the project was strictly typed.
    I'm not an extremist, on the contrary I like using different languages for different tasks.
    What I don't like is the Python/JS market polarization pretending that those two languages are fit for whatever task you have to do.

    In my company now we are in a "let's rewrite everything to python" phase and since we process sensitive data I see this as an announced disaster.

    I appreciate python for data analysis, but rewrite the entire backend with this language is completely insane.

    Leave a comment:


  • brucethemoose
    replied
    Whoa, lots of Python extremism here!

    My take is that its a fabulous orchestration language for stuff like Blender, PyTorch, VapourSynth, and so on. But it is a shame when the orchestration grows into an architecture, which is when the runtime starts eating CPU and deeper bugs make you wish the project was strictly typed.
    Last edited by brucethemoose; 12 January 2023, 05:20 AM.

    Leave a comment:


  • cynic
    replied
    Originally posted by partcyborg View Post

    You can't blame the language for crappy untested code. Bad code is bad in any language. Your silent data corruption wasn't python's fault, it was the developers fault for not writing tests to ensure no bugs creep into the system. All production code should be fully tested. Production Python code MUST have even more comprehensive tests if you aren't using mypy as it isn't type safe.
    when the selling point of a language is "fast and easy to write" it implies that:

    1. the developer doesn't have to be too qualified;
    2. you are in a hurry;

    so, you won't write tests in either case,

    if your plan is to write fully tested code (as it should always be) then you don't have to program in Python, and Python won't be an useful tool for you.

    Also, programming languages are tools: unsafe tools have higher risks. If you deliberately choose them, after evaluating the risks, then it'is fine. If you choose them because "everybody programs in python" or "because it's easy and fast to write" then you're looking for troubles.

    Leave a comment:


  • partcyborg
    replied
    Originally posted by cynic View Post

    thanks but no, thanks.

    In my career I've seen too many time Perl and Python script silently corrupting data for years before anyone noticed, because the scripts never cared to check if an input value was actually a double or a string or whatever.

    And it happens all the times.

    I've seen failing perl script rewritten in python and failing again for the same exact reason, and everytime this happened, the cost to fix the situation was much higher than the cost it would have had to develop the software with a proper programming language at the beginning.

    I prefer having a compiler complaining all the time when I do dumb things and spend 2x the time to write software than having to fix the mess later for a too permissive language.








    You can't blame the language for crappy untested code. Bad code is bad in any language. Your silent data corruption wasn't python's fault, it was the developers fault for not writing tests to ensure no bugs creep into the system. All production code should be fully tested. Production Python code MUST have even more comprehensive tests if you aren't using mypy as it isn't type safe.

    Leave a comment:

Working...
X