|
|
Log in / Subscribe / Register

"Structural pattern matching" for Python, part 1

"Structural pattern matching" for Python, part 1

Posted Aug 7, 2020 13:41 UTC (Fri) by excors (subscriber, #95769)
In reply to: "Structural pattern matching" for Python, part 1 by flussence
Parent article: "Structural pattern matching" for Python, part 1

Perl's documentation introduces "format" as being based on FORTRAN, BASIC and nroff, so it's hardly surprising that it doesn't attract many users nowadays. (https://perldoc.perl.org/perlform.html)

f-strings sound a lot more like Perl's interpolated strings (f"Hello {name}" vs "Hello $name") which are widely used, plus they have nicer syntax when embedding expressions (f"HELLO {name.upper()}" vs "HELLO @{[ uc $name ]}", the latter being a horrific but common Perl idiom). They've also got the printf-ish format specifiers which I doubt I'd be able to use without checking the documentation every time, but f-strings seem useful even without that.


to post comments


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds