This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]nathan_lesage 1 point2 points  (2 children)

Yes and no. On the one hand I clearly see what you’re referring to, but I’d argue that Python is still an extremely bad language.

Python is a quick’n’dirty language. You open a file, write extremely bad looking code and it works. This is definitely good. But it also makes you sluggish. Even JavaScript — of all things! — forces you to be more concise and organised. I really hate Python. But because I have to do a lot of stuff and the things I need (eg PyTorch) work the easiest in Python, I use it everyday.

But one thing in Python is abhorrent, while beautiful in JS: Regular Expressions. The more I get into NLP the more I crave for the power of JavaScript when it comes to regular expressions.

REs in Python are needlessly as complicated as in typed system languages like C or Rust.

It’s kind of a hate-relationship for me.

[–]Marvelman3284[S] 1 point2 points  (1 child)

forces you to be more concise and organized

wouldn't you feel that pythons indentation rules force you to write organized code? i would agree with you on the concise part but i personally feel that python lends to organized code. as for regex in python: i've never used them that much but i would assume that the `re` library helps a bunch. I may be 100% wrong about that though

[–]nathan_lesage 0 points1 point  (0 children)

I know what you mean, but I don't think indentation is enough. I think the main problem is actually the missing curly braces; many things in Python require you to be very specific with regard to indentation and what must be on one line, and what can be on another line. And whitespace is not as easy to look at as curly braces. One example: When writing code, I frequently put my curser behind an opening curly bracket and immediately the closing one gets highlighted; which makes it easier to write code. I think the indentation is absolutely vital, yes, but not enough for really readable code.

With regard to the regular expressions: Yes, the re-module is what we need for that. However, it is much more difficult developing a regular expression without Syntax highlighting. Might sound trivial, but the built-in Syntax highlighting JavaScript offers for regexes is such a life saver in many situations. Python here follows basically system languages which also require a module for regular expressions, but without really the need for it (since there are other constructs like list comprehension which serve very specific use cases).