And you find Perl's syntax is closer to C family than Python's?
Absolutely.
If so, that is a decidedly minority opinion.
Really? I've never seen Python listed in a C language family list, like
these on Wikipedia:
https://en.wikipedia.org/wiki/Category:C_programming_language_family
https://en.wikipedia.org/wiki/List_of_C-family_programming_languages
Yes, really. First of all, those are Wikipedia entries, and thus are
not always correct, and can contain questionable material.
Your second link has a big box at the top saying as much. Python had
been on that list, but was removed. Some comments mention that "most
of the list" doesn't make sense (not just Python).
Next, those articles, even if you take them on faith, don't say that
the languages necessarily have ***SYNTAX*** like the C family, only
that they are "related to C", whatever that means.
Further, if you take those articles on faith, then you are including
languages like Fortress, Nim, and R in the "C family".
Just take a look at the code in the various languages. Fortress is
nothing like C, and purposely so. These pages indicates Fortress isn't
even influenced by C:
http://codesnippets.wikia.com/wiki/Fortress
https://en.wikipedia.org/wiki/Fortress_(programming_language)
Instead, it syntactically resembles Scala, Haskell, or Standard ML,
none of which are on the list. And your basic eyeball sanity check
would confirm that none of those languages resembles C. Actually,
Fortress was *really* meant to have math-notation syntax (complete
with non-ASCII symbols, like APL). Here are some code samples:
https://software.intel.com/en-us/articles/First-Impressions-of-the-Fortress-Language
Nim is strongly inspired by Python, syntactically and otherwise,
including indentation-delimited blocks:
https://nim-lang.org/features.html
From the other direction, if you look at articles about C and Python,
you'll see that they claim Python *was* influenced by C. And the
inventor of Python has specifically said he took many syntax choices
from C, to make the language more accessible.
I think there is a basic matrix that goes like this:
Fan of both C and Perl: "Perl is C-like"
Fan of both C and Python: "Python is C-like"
Fan of Perl but not C: "Perl is not C-like"
Fan of Python but not C: "Python is not C-like"
It's natural and understandable. But I think most people who know both
Perl and Python would say that neither one is much like C. Perl has
some superficial syntax which is more C-like (for loops,
block-delimiting curly braces) and some superficial syntax which very
much isn't (sigils, things like @_, all the regex stuff, etc.). At a
deeper level Perl and Python are much more like each other (and Ruby
and Lua) than either one is like C.
Is it that you really just miss block-delimiting braces? And maybe
semicolons after every statement?
Yes. Even though I indent my code, I don't like using whitespace to delimit
code blocks. Also with long statements, I like the freedom to split a
statement across multiple lines, and further indent the additional lines of
such a statement for clarity.
Python lets you split statements across multiple lines, and further
indent the additional lines for clarity. Granted, there are rules
which govern where you can split lines without an explicit
continuation character, but you can always use an explicit
continuation character, and you can *virtually always* arrange your
braces, brackets, or parens such that an expression spans mutliple
lines.
I honestly don't mind if someone doesn't like Python, including for
superficial reasons. Everyone is entitled to their own preferences. I
just hate seeing incorrect or partially-true (and misleading)
statements presented as fact.
John Y.
As an Amazon Associate we earn from qualifying purchases.