News for hackers. Stuff that matters.
Re:Why Perl? by jefftk on Thursday April 20, 2023 @05:54PM (#35646939)
I'm confused about the compatibility X for Python. A few years ago, sure, but for an article published a month from now? You write python3 and it's installed everywhere.
Re:Why Perl? by superkuh on Thursday April 20, 2023 @06:12PM (#35647195)
Python's dependency hell due to changes between versions in both modules and core is so bad there's even a python dependency manager hell of chosing which env wrapper or containerization you're going to use because the system python sure as hell won't work. And if you do have the gall to update a system python package system stuff will break. Whereas with perl the system libraries will work, no need for containers.

Python's popularity hurts it for use when you want compatibility. Containerizations can only mitigate this so much.

Re:Why Perl? by jefftk on Thursday April 20, 2023 @07:49PM (#35648106)
If you write to the (very extensive) standard library, though, none of this is an issue.
Re:Why Perl? by TeddyDD on Friday April 21, 2023 @04:08AM (#35650994)
Bullshit, Python breaks compatibility between minor releases all the time. The script you wrote for 3.8 has high chance of being broken on 3.11.
Re:Why Perl? by jefftk on Friday April 21, 2023 @08:25AM (#35652667)
Really? I've written a lot of python, though less recently, and this doesn't sound familiar at all. What's in 3.8 but not 3.11?
Re:Why Perl? by DonHopkins on Friday April 21, 2023 @06:33AM (#35651873)
Just forget all about all that virtual environment crap, globally install a modern version of Python in a Docker container, and take full advantage of its latest features.

I couldn't remember the title of this memorable talk, but ChatGPT could:

Q: In which talk by David Beazley does he recommend writing new Python code that takes full advantage of the language's new feature, without worrying about making it backwards compatible?

A:

David Beazley is a well-known Python expert who has given several talks on various aspects of the language. However, one of his talks that emphasizes the importance of taking advantage of new features in Python, without worrying about backwards compatibility, is "Python 3 Metaprogramming".

In this talk, which was delivered at PyCon 2016, Beazley highlights the benefits of using Python 3's new metaprogramming features, such as type annotations, function annotations, and asynchronous programming. He argues that these features can make code more concise, readable, and maintainable, and that developers should not be afraid to use them, even if it means breaking backwards compatibility with older versions of Python.

Beazley's message is clear: by taking advantage of new language features, developers can write more efficient, expressive, and scalable code, without worrying about the limitations of older versions of Python.

Q: Give me a link to that video.

A:

Sure! Here's the link to David Beazley's talk "Python 3 Metaprogramming" at PyCon 2016:

https://www.youtube.com/watch?v=sPiWg5jSoZI

I hope you find it informative and helpful!

Q: What are his arguments for not worrying about backwards compatibility?

A:

David Beazley's main arguments for not worrying about backwards compatibility in his talk "Python 3 Metaprogramming" are:

1. New language features can make code more expressive and efficient: Python 3 introduced several new language features, such as function annotations, type annotations, and asyncio, that can make code more concise, expressive, and efficient. By using these features, developers can write cleaner, more readable code that is easier to maintain and debug.

2. Older versions of Python can be managed through virtual environments and package managers: Developers can use tools such as virtual environments and package managers to manage different versions of Python and dependencies. By isolating different versions of Python and packages, developers can ensure that their code works correctly on different platforms and environments.

3. The community will eventually move to newer versions of Python: As more developers adopt newer versions of Python and start using the latest language features, the community will gradually move away from older versions of Python. This means that eventually, the majority of users will be using newer versions of Python, making backwards compatibility less of an issue.

4. Code refactoring tools can help with compatibility issues: There are several tools available that can help with code refactoring and modernization, such as 2to3, which can automatically convert code from Python 2 to Python 3. By using these tools, developers can make their code compatible with multiple versions of Python without having to sacrifice the benefits of newer language features.

Overall, Beazley's argument is that developers should not be afraid to use the latest language features in Python 3, even if it means sacrificing backwards compatibility with older versions of Python. By doing so, developers can write cleaner, more efficient code that is better suited to modern software development practices.

Re:Why Perl? by bmj on Friday April 21, 2023 @06:49AM (#35651968)
globally install a modern version of Python in a Docker container

You lost a bunch of people right there. There's a significant difference between "open a terminal" and "install Docker, create a container, configure the latest version of Python."

Re:Why Perl? by dbalatero on Friday April 21, 2023 @07:21AM (#35652192)
They certainly lost me. I'd rather write Bash than fool around with Docker. IMO "just Dockerize it!" is a smell.
Re:Why Perl? by pavon on Thursday April 20, 2023 @06:12PM (#35647192)
Perl is mostly forwards and backwards compatible (or less generously it has frozen). Python is backwards compatible, but continues to add new features, and some packages are rather enthusiastic about adopting these features quickly, and ending support for older versions of Python. It isn't as bad as other language communities (I'm looking at you Rust), and I would have at least given it an asterisk, but it certainly isn't as stable as Perl.
Re:Why Perl? by gpvos on Friday April 21, 2023 @04:41AM (#35651203)
Perl does add new features, but if your program has use v5.30; at the top, and a library has use v5.22;, it will work.
Re:Why Perl? by t-3 on Thursday April 20, 2023 @06:11PM (#35647175)
Python isn't actually everywhere by default, but neither is perl (but perl at least is usually named perl, while python may commonly be python or python3). Neither is consistently in the same location and shebang issues are pretty common. If script portability is actually a concern, /bin/sh is still the best way to go.
Re:Why Perl? by tankenmate on Friday April 21, 2023 @05:39AM (#35651554)
#!/usr/bin/env perl

is the usual way to fix this. Far more common is running into UTF-8 problems, but using the usual -CSDL and the UTF-8 open default handles the issues.

Re:Why Perl? by culopatin on Thursday April 20, 2023 @05:56PM (#35646968)
Is it available in windows by default?
Re:Why Perl? by OJFord on Thursday April 20, 2023 @06:06PM (#35647113)
Is perl? That's an honest question/honestly surprises me.

But honestly installing anything like that (without WSL probably - haven't used it recently) on Windows is painful, it's not python's fault, it's just a different paradigm. Run with a different environment variable for example.

Re:Why Perl? by worik on Thursday April 20, 2023 @06:09PM (#35647150)
Last install of Windows 11 I did (triggering) Perl was installed by default
Re:Why Perl? by xupybd on Thursday April 20, 2023 @06:49PM (#35647575)
It is not installed by default on any of the systems I work with. We have around 10 office staff that all use windows, and 2 windows servers. No Perl by default on any of them.

To the best of my knowledge you must install one of two main distributions of Perl for Windows. https://www.perl.com/article/downloading-and-installing-perl...

You can also use WSL.

Edit: It sounds like, from other comments, that Perl comes with Git Bash as well.

Re:Why Perl? by ElectricalUnion on Thursday April 20, 2023 @06:54PM (#35647638)
Are you sure it is "installed by default" or it happens to be inside WSL? Because WSL is not the default.
Re:Why Perl? by roblabla on Thursday April 20, 2023 @06:01PM (#35647034)
No, but then neither is perl. On windows you've got powershell, batch, VBScript and JScript pre-installed.
Re:Why Perl? by recycledman on Thursday April 20, 2023 @05:59PM (#35647023)
I'm sorry but my windows doesn't have Perl by default either perhaps I misunderstood your comment :)
Re:Why Perl? by gkbrk on Thursday April 20, 2023 @06:02PM (#35647065)
You probably have it if you have Git Bash installed. Perl is a dependency of Git IIRC.
Re:Why Perl? by recycledman on Thursday April 20, 2023 @06:05PM (#35647096)
Then it's not by default right? I must have git installed !
Re:Why Perl? by tankenmate on Friday April 21, 2023 @05:40AM (#35651564)
The first versions of git were written in Perl (with some small speed sensitive parts written in C).
Re:Why Perl? by culopatin on Friday April 21, 2023 @01:05PM (#35656794)
It was a simple question. Author claimed it’s found everywhere, but if it’s not installed by default im not going to find it in enterprise environments
Re:Why Perl? by midasuni on Thursday April 20, 2023 @06:01PM (#35647046)
Is Perl?
Re:Why Perl? by koito17 on Thursday April 20, 2023 @06:03PM (#35647073)
No, but Perl at the very least is available on the latest versions of Mac OS. Python is not. So as far as "being bundled with the latest OSes" goes, Perl beats Python.

NOTE: I am (probably mistakenly) assuming that Perl is still bundled in most Linux distros by default.

Re:Why Perl? by OJFord on Thursday April 20, 2023 @06:08PM (#35647132)
Python is available by default in macOS. Not latest version python, but available. (Both 2 & 3 I think, or maybe they've dropped 2 now.)
Re:Why Perl? by koito17 on Thursday April 20, 2023 @06:12PM (#35647196)
A minor update of macOS Monterey[1] removed /usr/bin/python, but /usr/bin/perl still exists. Xcode's Command Line Tools will install Python 3, but I do not count as being bundled by default with macOS. Unfortunately, I can't find any Apple documentation to prove this. You'll just have to check with a fresh install of macOS Ventura yourself (or, at your own risk, uninstall Xcode and/or the Command Line Tools)

[1] https://developer.apple.com/documentation/macos-release-note...

Re:Why Perl? by OJFord on Thursday April 20, 2023 @07:06PM (#35647736)
(Ouch, a minor update!) Oh ok, I stand corrected. I don't currently have any macOS machines.
Re:Why Perl? by prosaic-hacker on Thursday April 20, 2023 @06:54PM (#35647637)
I believe not now but Perl 5.004 was installed on Window NT (3.5 or 4) by default. That made the case for its use on project that could not afford the IBM AIX or Silicon Graphics systems we were using at the time.

We used Netscape Fasttrack as the server.

Re:Why Perl? by actionfromafar on Friday April 21, 2023 @05:08AM (#35651361)
Wait what no?! NT4 was released in 1996. And Microsoft touching Open Source without ten foot poles back then also feels wrong.
Re:Why Perl? by HeckFeck on Friday April 21, 2023 @06:01AM (#35651689)
Perl was used as part of the Windows XP build process, if you know where to look. It might have been used in NT4 as well.
Re:Why Perl? by gattilorenz on Friday April 21, 2023 @08:04AM (#35652497)
Sure, but it's not "installed by default" in either of them.
Re:Why Perl? by HeckFeck on Friday April 21, 2023 @12:37PM (#35656310)
I wonder if that was ever considered as a possibility at Microsoft. They had proven the camel was capable with Win32 stuff in their build process.

Maybe it was considered technically by some of the programmers, but swiftly quieted by PMs.

Re:Why Perl? by burnished on Thursday April 20, 2023 @07:32PM (#35647973)
Eugh, no, they've just got a little thing so you'll go to the microsoft store to download python when you search for it from the start menu, seem to recall it giving me some cryptic hell with making pip difficult to find. Bastards.