It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
avatar
Magnitus: The high level glue that puts all of the optimised components together and solve the requirements for some high level business application? Usually, that has much looser performance requirements.
Totally agree, but I don't think the discussion should be necessarily of Python against other languages, because as you said every language has its application and performance target, but rather of Python against itself. With 3.11 it will be back on the performance level expected of 2.7, which is rather nice to see. As for what comes after that, well... :P.
Post edited October 06, 2022 by WinterSnowfall
avatar
WinterSnowfall: Totally agree, but I don't think the discussion should be necessarily of Python against other languages, because as you said every language has it application and performance target, but rather Python against itself. With 3.11 it will be back on the performance level expected of 2.9, which is rather nice to see. As for what comes after that, well... :P.
Honestly, I think it is an excercise every professional developer should make as a matter of basic hygiene (too many devs get fixated on a tech stack, often the only one they ever mastered, leading to the continued survival of suboptimal solutions for years and years).

For example, given that I have recent knowledge of Node, Python and Golang (and maybe C++, though my knowledge is getting more and more dated as I haven't made use of it in years, to the point where now, I've chosen to learn Rust instead of updating my C++ knowledge as a potentially better return on my time investment), its an analysis I need to make for each problem that I solve.

More often than not, ecosystem factors outside of performance will dictate my choice.

For example, lately as a devops engineer, I've used golang a lot due to its first rate integration with Terraform and Etcd as well as its ability to compile into small self-contained binaries for command line utilities. The fact that golang is faster is a nice added bonus, but the primary factor here has been the quality of its integration with what I'm using and its runtime requirements (ie, none beyond a Linux os and adm64 cpu architecture).

Similarly, if I was working on Openstack integration or AI, I'd be turning to Python due to its better ingration in those domains.
Post edited October 06, 2022 by Magnitus
avatar
dtgreene: High-frequency trading is an example of a networked hard real-time problem. If it takes too long for a stock trade to occur, money could be lost.
avatar
Magnitus: True, the stock market is another animal in itself and something I know remarkable little about. My guess is that they must have strong locality requirements to make it work.

Unless you're paying a fortune, such guarantees are hard to make over the internet.
It's apparently profitable enough for it to be worth that fortune, or at least was back when I saw some job listings asking for C++ programmers paying around $200,000 per year (or something along those lines, but I'm pretty sure it was a lot of money).

avatar
Magnitus: I think people are often overblowing the performance impact of Python or interpreted languages for a lot of application domains, where it doesn't matter that much.

I think it is unsuitable for intensive system stuff, but I think a lot of applications are not doing anything special that would warrant the consideration.

I mean, most of them will leverage a database that is well optimised, leverage load balancers, network meshes, kubernetes and other lower level components that need to be well optimised and those components can't be implemented in Python, but most shops don't implement things like those, they just consume them.

The high level glue that puts all of the optimised components together and solve the requirements for some high level business application? Usually, that has much looser performance requirements.
Sometimes, for example in data science or high performance computing, a language like Python or R will be used for the main program (or "glue" if you prefer that term), but the actual number crunching will use code written in C, C++, and/or Fortran. (From what I can tell, Rust isn't really used for that (at least not yet), but tooling, in particular Rust crates like pyo3, exist to make it easy to do.)
Post edited October 06, 2022 by dtgreene
avatar
Magnitus: More often than not, ecosystem factors outside of performance will dictate my choice.

For example, lately as a devops engineer, I've used golang a lot due to its first rate integration with Terraform and Etcd as well as its ability to compile into small self-contained binaries for command line utilities. The fact that golang is faster is a nice added bonus, but the primary factor here has been the quality of its integration with what I'm using and its runtime requirements (ie, none beyond a Linux os and adm64 cpu architecture).
My current personal project also is using languages based on ecosystem factors.
* Using the web browser for the GUI dictates the use of JavaScript for that.
* With JavaScript, I get to use MathJax, which is a library that converts embedded LaTeX in a webpage into nice mathematical notation.
* To actually generate the math formulas that appear, on the other hand, I need sympy, which is a Python library.
* Fortunately, there exists a package called pyodide, which is Python (3.10.2 in this case) compiled to WebAssembly; with this I can run Python code in the browser. (Drawback: It takes a while to load, but at least I can display some instructions while waiting.)

Other recent projects I've done include:
* One, written in Python, that runs on the text console, using the curses library. (Any programming language that supports curses could be used here, though Python also has arbitrary precision integers built in, which is what I used.)
* Another uses the Godot engine, and hence all the code for it is written in GDScript and GDSL. GDScript works well for writing game logic, but integers are limited to 64-bit integers (something that has come up), and given that I've been working with the self-imposed restriction of not using any assets, adding audio is going to require another language. (I use GDSL, a shader language, to draw some of the graphics.)

Of these, the only choices that've actually been dictated by performance are the use of GDSL (though also dictated by the choice of engine) and the need to use another language for audio creation.
avatar
dtgreene: It's apparently profitable enough for it to be worth that fortune, or at least was back when I saw some job listings asking for C++ programmers paying around $200,000 per year (or something along those lines, but I'm pretty sure it was a lot of money).
150k-200k seems to be the standard wage for a highly skilled developer in the US right now.

I'm half resentful that my work for the hospital, paid at a "low" 6 figures, is so meaningful, otherwise I'd be hiring myself out for remote work at one of those outlandishly paying US firms in short order.

avatar
dtgreene: Sometimes, for example in data science or high performance computing, a language like Python or R will be used for the main program (or "glue" if you prefer that term), but the actual number crunching will use code written in C, C++, and/or Fortran.
Exactly, a lot of Python stuff is performant because it is bound on some highly optimised C code (or otherwise calling another component implemented in a more performant language).

And unless you want to do some humongous looping logic at the Python layer calling that optimised C code (unlikely), the performance penalty that Python imposes is not a significant consideration.

Same when it is calling a database query (which will do the brunt of the business logic work) which will take milliseconds to respond (who cares if the Python overhead introduce a fraction of a millisecond in extra computing time on top of that).
Post edited October 06, 2022 by Magnitus
Just from the thread topic:

Python is not the best language to LEARN data structures as everything is implicitly typed. Hence my reply was based on the OP and what might be best for him given his experience.

However in this thread everyone has assumed the OP was a spammer and everyone is just flexing given their own programming experience.
avatar
lupineshadow: Just from the thread topic:

Python is not the best language to LEARN data structures as everything is implicitly typed. Hence my reply was based on the OP and what might be best for him given his experience.

However in this thread everyone has assumed the OP was a spammer and everyone is just flexing given their own programming experience.
Based on what I did in data structures as an undergraduate (in C++ at the time), aren't data structures just a bunch of things pointing at each other and algorithms to manipulate them (various types of lists, maps, trees, sorting algorithms, etc)?

If so, any language that supports self-references in custom structures (to my recollection, all the languages I have experience with so far) will do the job.

Of course, unless you got real special needs, most of those languages will natively (or via mature libraries) implement the more common of these structures natively more efficiently than you could reasonably hope to so you might have well use that.

That being said, for learning purposes, nothing prevents you from reinventing the wheel and eschew optimized pre-existing solutions in favor of your own.

PS:

Haven't yet used it myself, but I believe Python now supports optional type annotation: https://docs.python.org/3/library/typing.html

Hopefully, they can move that to native support in Javascript too and make all those Typescript evangelists look mighty silly with their extra layers of cruft :P.
Post edited October 06, 2022 by Magnitus
avatar
Magnitus: aren't data structures just a bunch of things pointing at each other and algorithms to manipulate them (various types of lists, maps, trees, sorting algorithms, etc)?
That would presumably be the Pythonic way of introducing Data Structures. A bunch of things and algorithms to manipulate those things.

I'm not sure that is the best way to teach them though.
Just my 2 cent.

I work as a web developer because here there are lot's of request for web developers... I don't really love it (I prefer to program games in Unity or something like that or make some desktop application in C#) but there are no request here for the kind of programming that I love so I go for the next best thing, web development.

Since I need to develop web application I need to know the most used programming language in that field that here are: Java and C# for the backend and Javascript for the frontend (I also need to know the major framework for both: Spring, Hibernate, React, Angular etc...).

That's all.

The truth is if you just want to work in the IT field you don't really need to learn a lot basically most workplace only require basic knowledge, like read some data from a db, do some rest call to show it on screen, create a form and send data to a server that will write them on a db... that's the basic... sometimes you will need to create some filter for a search in a table option maybe even try to page the result... but even if they try to make you do something more difficult usually you are not alone and you get access to previous created code where you copy&paste.
If you know something more advanced that's good since you can create better solution and have fun, but usually you don't really need to do really fancy stuff... (they usually don't even care about performance).
There are workplace where they actually will require you to do more, but they are rare and they will usually have experiece senior developers that will teach you a lot. And if you are in that lucky place I suggest to try to get the most out of it by actually learning more for example trying to solve some stackoverflow questions.

Basically what programming language you will decide to learn doesn't matter like clarry said (usually you will be able to do everything with any of them) but I suggest you to avoid obscure programming languages that nobody request if you want to work with them.
C++ is not really a thing here, Python is a lot more used but it's still not requested... If you want to go for a sure thing Javascript (since it's the only programming language used in a browser) is always a good choise, and both Java and C# are really good for backend in a web application environment.

Nervensaegen answer is like things you hear at school... I think programming with a pencil is a waste of time. Nobody actually create an application with a pencil, you can create a concept, you can sort of decide what it should do, but I suggest to use real code to prototipe any algorithm, it's easier and faster and you can actually avoid to abstract it too much (the problem with pseudo code, expecially with pencil, is that you are not forced to think as your PC). Also in 2022 pencil are the past, if you really need to take notes always use your pc, and the best way to do it (at least for me) it's to comment code that you write.
Don't even waste time to use a pencil if they don't require it at your workplace.

My advice is to try to create the bare minimum to make it work first (if you are really good create a test for it even before starting), by that I mean create the base scenario, abstract it to N+1 (so that it will work for any case) and refine the code with error handling.
If the application is too big focus on a basic task, usually someone will do it for you if you are a junior developer and once you are a senior you should be able to do it.

But always try to do things for real, the best way to learn it is to try to actually do it (nobody learn to develop application by reading a book about programming).
If you don't know a thing don't be shy to copy&paste other people code... You will understand it eventually debbugging the code and trying to reimplement it in another application or modify that code for your application (that's how you learn how to thing as your PC).

Just don't say any of this in any school or interview... say what Nervensaegen said, that's the sort of bla bla they like in interview or school.

But like I said in the beginning this are just my 2 cent... I was never really good in study from books or theoretical mathematics (I have a bad memory expecially for theorems), but I think I'm really good at problem solving and actually learn from doing (example: I didn't understand the induction principle until I practically learned the recosive algorithm of binary trees in Java). There are people that are really good at things where I'm really bad that will tell you quite the opposite of what I wrote, you can be good at both... just try it and see.
avatar
lupineshadow: That would presumably be the Pythonic way of introducing Data Structures.
To be honest, I never really invested the time to really understand what it meant to be Pythonic.

I've always been fond of Python, but I don't get married to technology as a rule of thumb

avatar
lupineshadow: A bunch of things and algorithms to manipulate those things.
I think mentioning something about the references here is important (otherwise, the structure part is hard to come by), but otherwise, sure.

avatar
lupineshadow: I'm not sure that is the best way to teach them though.
I think without brushing up on the topic a little for a week or two (especially when it comes to things like the more complex data structures, the big o notation of access/manipulation on various structures and sorting algorithms and why some algorithms are n*logn as opposed to n^2), I'd be unqualified to teach about it anyways, even at the undergraduate level. It's too far behind and you just don't use it that much in the industry.
Post edited October 07, 2022 by Magnitus