Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

Which programming language did you choose and why?

Rincewind

Magister
Patron
Joined
Feb 8, 2020
Messages
2,427
Location
down under
Codex+ Now Streaming!
I am going to present some lambda examples next week, once I recover from jet lag after returning from my holidays.
Ah, and don't even get me started... Without the below features I can't take Python seriously as a pleasant to use *high-level* languauge:
  • no sane immutable-by-default behaviour
  • mutation everywhere in the standard libraries
  • standard library is a bit shit, almost as bad as the NodeJS stdlib abomination (the Kotlin stdlib is the absolute best stdlib I've ever used, Scala is second best, and the Java SDK is also very comprehensive and respectable)
  • lack of tail recursion optimisation
  • lack of basic functional stuff (map, filter, option, etc.) — because Guido doesn't like it, so we got the shitty and very limited generator syntax instead... be prepared to write *lots* of for loops!
  • lack of pattern matching (this is the least of my problems given the above, actually)
I could even live with the single-threaded nature of it and the slowness, but not the lack of the above.

Also here, I'm not the only one who finds this a joke:

https://9to5answer.com/why-isn-39-t-python-very-good-for-functional-programming

https://intellipaat.com/community/12542/why-isnt-python-very-good-for-functional-programming

Basically, the guys are saying it's fine if you're happy using imperative style almost exclusively. Well, I'm *not* happy with that at all, when it comes to high-level programming it's at least light functional style for me or go home. I just don't see the use case here, if I want to write low-level imperative code I can do it in C just fine.
 
Last edited:
Joined
Dec 17, 2013
Messages
5,103
Pattern matching as in regular expressions? Python has a great re library that will do anything you need.
 

Viata

Arcane
Joined
Nov 11, 2014
Messages
9,885
Location
Water Play Catarinense

Rincewind

Magister
Patron
Joined
Feb 8, 2020
Messages
2,427
Location
down under
Codex+ Now Streaming!
Pattern matching as in regular expressions? Python has a great re library that will do anything you need.

No, FP-style pattern matching. But the thing is, you really need to have immutable data classes (case classes), or ADTs (algebraic data-types) for it to be really useful, which Python also lacks. Incidentally, you can also pattern-match on regular expressions inside pattern-matching blocks.

https://docs.scala-lang.org/tour/pattern-matching.html

This tutorial has more interesting examples:
https://www.baeldung.com/scala/pattern-matching

One of the many benefits of this feature is that the compiler can do exhaustiveness checks for you, e.g. raise an error or warning if you haven't covered all possible cases. Super useful in big projects: e.g. someone adds a few new elements to an enum, they you'll get warnings/errors for all pattern matching blocks in the codebase where those new enum values are unhandled.

But it can do a lot more than that, and you can nest patterns, etc.
 

Mexi

Dumbfuck!
Dumbfuck
Joined
Jan 6, 2015
Messages
6,811
I didn't really choose it. Turns out a lot of medical research uses Python. I started in R then went to Python. I've had to learn Java now since I'm managing a website.

Every algorithm I've built so far has been done in Python. As someone that started in R, it's really the easiest language I've had to learn. I find it hard to write in R now. I love Python.

The only thing R beats it out in is the graphical charts. R makes ridiculously beautiful charts.

I'm not too crazy about Java, though. I still scratch my head when I make my web programs. Those fucking ";" just make me go cross eyed.
 

Arbiter

Scholar
Joined
Apr 22, 2020
Messages
2,460
Location
Poland
Pattern matching as in regular expressions? Python has a great re library that will do anything you need.

This is amusing. You insulted many people in this thread claiming that Java and C# are only suitable for cheap outsourced developers while Python is designed for 1ee7 haxx0rz. Yet I and Rincewind have proven that you understand neither simple concepts like default function arguments nor advanced ones like pattern matching. Is this thread a bad joke?
 

NJClaw

OoOoOoOoOoh
Patron
Joined
Aug 30, 2016
Messages
7,513
Location
Pronouns: rusts/rusty
Pathfinder: Wrath I'm very into cock and ball torture
I love Python and how easy it is to do stuff with it even for inexperienced people, but my last experience with it went something like:

"Boohoo, our beautiful program is perfect but it runs for hours what can we do"

"Here, I rewrote everything in C++"

"NO WHAT ARE YOU DOING THIS IS HORRIBLE... wait, why does it run for just a couple of seconds now?"


Granted, it was a very fringe case of a custom, complex algorithm to solve unreasonably large linear problems and one can't draw general conclusions from it, but it's still painful to have to deal with self-made programmers who think Python is literally our lord and savior.
 

Rincewind

Magister
Patron
Joined
Feb 8, 2020
Messages
2,427
Location
down under
Codex+ Now Streaming!
Granted, it was a very fringe case of a custom, complex algorithm to solve unreasonably large linear problems and one can't draw general conclusions from it, but it's still painful to have to deal with self-made programmers who think Python is literally our lord and savior.

Actually, you can.

Self-made is not the problem, not realising what you don't know is.
 

Arbiter

Scholar
Joined
Apr 22, 2020
Messages
2,460
Location
Poland
My point is if you look at any language closely enough, you can find a ton of stuff to complain about. All the stuff you mentioned is fairly minor.
It is not minor, it shows the fact that Python designers confuse local variables (function arguments) with global variables (default values of function arguments are implemented as global variables and in Python those values may be mutable).

The first example if it's true, ok so you get used to that, and adjust your code. If you are testing your code as you should, it won't ever cause any real issues.
By this logic assembly is a viable language because programs written in it work correctly as long as developers test them thoroughly.

And if migrating from Python 2 from Python 3 was such a big deal, why has the language become even more popular since then?

Python is popular for the same reason PHP was popular in 2000s: it is easy to learn and therefore there is abundance of cheap developers. Are you claiming that PHP is a great language?

Migration from Python 2 to 3 was bad because for years some libraries only supported Python 2 while others only supported Python 3, making it impossible to combine them in a single Python program. Even Guido admitted that the transition was poorly handled: https://medium.com/codex/python-4-0-will-never-arrive-3d994dce54f1

I’m not excited about the idea of Python 4 and no one on the core development team really is, so there will probably never be a 4.0 and we’ll continue until 3.33, at least. We’ve learned our lesson from Python 3 vs. 2, so it’s almost taboo to talk about Python 4 seriously.”


Finally, Perl developers made the same mistake of releasing at least 2 breaking versions of the language. Perl was the most popular language for building website backends in the 90s, where is it today?

And multi line lambdas? Lol.
As I said, I will prepare some code examples later this week.

Edit: replaced "the is abundance" with "there is abundance".
 
Last edited:

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,289
I wonder is there a single program written in Python that's useful for something. I'm not against Python in any way, just asking. We can keep talking about language features, but they don't really matter in the end. Only what you can produce with that language.
 

Mexi

Dumbfuck!
Dumbfuck
Joined
Jan 6, 2015
Messages
6,811
Those fucking ";" just make me go cross eyed.
You have been spolied by Python where ; is not mandatory, but better get used to is and make a habit of using it.
Well, if I want to stay doing my job, I better at least. I will say that it's my least favorite language thus far, though. Do you also use Java?

Java has been far harder, and I cringe when I have to program web functionality for my code.
 

Immortal

Arcane
In My Safe Space
Joined
Sep 13, 2014
Messages
5,062
Location
Safe Space - Don't Bulli
nobody hires C programmers to do anything beyond post on forums about how C programmers are still employed

I think C is still quite popular in the embedded world.

Partly because it translates so well to native opcodes without much work from the compiler, or just for legacy support.
Example is Tesla, where their entire low level stack is C (native) or C++ IIRC - depending what components.
 

Arbiter

Scholar
Joined
Apr 22, 2020
Messages
2,460
Location
Poland
nobody hires C programmers to do anything beyond post on forums about how C programmers are still employed

I think C is still quite popular in the embedded world.

Partly because it translates so well to native opcodes without much work from the compiler, or just for legacy support.
Example is Tesla, where their entire low level stack is C (native) or C++ IIRC - depending what components.

I believe the primary reason for using C/C++ is that automotive software needs to be real time, hence you cannot use garbage collected languages.
 

Immortal

Arcane
In My Safe Space
Joined
Sep 13, 2014
Messages
5,062
Location
Safe Space - Don't Bulli
nobody hires C programmers to do anything beyond post on forums about how C programmers are still employed

I think C is still quite popular in the embedded world.

Partly because it translates so well to native opcodes without much work from the compiler, or just for legacy support.
Example is Tesla, where their entire low level stack is C (native) or C++ IIRC - depending what components.

I believe the primary reason for using C/C++ is that automotive software needs to be real time, hence you cannot use garbage collected languages.

You probably know all this but

It's way more than that. GC aside, Managed languages are just slow and it's not just because of GC but having the intermediary JIT compilation of Bytecode / MSIL. It's totally inadequate for any kind of real time rendering / physics.. Look at Unity's approach to IL2CPP for example.

You could also make the argument that it's more easy to interface with hardware through unmanaged languages - that don't have that abstraction sitting between you and direct offsets in memory and don't need 40gigs of libraries to compile for a small embedded microprocessor, in Tesla's case though, it's mainly the execution time.

Tesla needs real time processing of pixel images to do "collision detection" / data interpolation and are heavily hardware integration focused.
Elon actually discusses this exact use case around their decision to use C / C++ - I forgot the link to the video though and could be misrepresenting - my memory is shit.

Tesla is hardly unique though, anything performance intensive, gaming, RDB optimization engines, etc follow this logic.
 

J_C

One Bit Studio
Patron
Developer
Joined
Dec 28, 2010
Messages
16,947
Location
Pannonia
Project: Eternity Wasteland 2 Shadorwun: Hong Kong Divinity: Original Sin 2 Steve gets a Kidney but I don't even get a tag. Pathfinder: Wrath
Those fucking ";" just make me go cross eyed.
You have been spolied by Python where ; is not mandatory, but better get used to is and make a habit of using it.
Well, if I want to stay doing my job, I better at least. I will say that it's my least favorite language thus far, though. Do you also use Java?

Java has been far harder, and I cringe when I have to program web functionality for my code.
I learned a bit of Python to get the basics of programming, now I'm just finishing my Java Backend bootcamp. I can't really compare it to other languages since I haven't use others, but for now I enjoy Java.
 

J_C

One Bit Studio
Patron
Developer
Joined
Dec 28, 2010
Messages
16,947
Location
Pannonia
Project: Eternity Wasteland 2 Shadorwun: Hong Kong Divinity: Original Sin 2 Steve gets a Kidney but I don't even get a tag. Pathfinder: Wrath
I wonder is there a single program written in Python that's useful for something. I'm not against Python in any way, just asking. We can keep talking about language features, but they don't really matter in the end. Only what you can produce with that language.
Python can be very powerful in data analyst tasks and machine learning if you are into those fields.
 

Arbiter

Scholar
Joined
Apr 22, 2020
Messages
2,460
Location
Poland
nobody hires C programmers to do anything beyond post on forums about how C programmers are still employed

I think C is still quite popular in the embedded world.

Partly because it translates so well to native opcodes without much work from the compiler, or just for legacy support.
Example is Tesla, where their entire low level stack is C (native) or C++ IIRC - depending what components.

I believe the primary reason for using C/C++ is that automotive software needs to be real time, hence you cannot use garbage collected languages.

You probably know all this but

It's way more than that. GC aside, Managed languages are just slow and it's not just because of GC but having the intermediary JIT compilation of Bytecode / MSIL. It's totally inadequate for any kind of real time rendering / physics.. Look at Unity's approach to IL2CPP for example.

You could also make the argument that it's more easy to interface with hardware through unmanaged languages - that don't have that abstraction sitting between you and direct offsets in memory and don't need 40gigs of libraries to compile for a small embedded microprocessor, in Tesla's case though, it's mainly the execution time.

Tesla needs real time processing of pixel images to do "collision detection" / data interpolation and are heavily hardware integration focused.
Elon actually discusses this exact use case around their decision to use C / C++ - I forgot the link to the video though and could be misrepresenting - my memory is shit.

Tesla is hardly unique though, anything performance intensive, gaming, RDB optimization engines, etc follow this logic.

Generally you are right, but GC does not imply a managed language. For example, Go has a GC but it is compiled to native binaries.
 

Arbiter

Scholar
Joined
Apr 22, 2020
Messages
2,460
Location
Poland
I wonder is there a single program written in Python that's useful for something. I'm not against Python in any way, just asking. We can keep talking about language features, but they don't really matter in the end. Only what you can produce with that language.
Python can be very powerful in data analyst tasks and machine learning if you are into those fields.

Yes, as an interface for C/C++ libraries. Python itself is not suitable for number crunching.
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom