/tech/ - Technology and Computing

Technology, computing, and related topics (like anime)

Site was down because of hosting-related issues. Figuring out why it happened now.

Build Back Better

Sorry for the delays in the BBB plan. An update will be issued in the thread soon in late August. -r

Max message length: 6144

Drag files to upload or
click here to select them

Maximum 5 files / Maximum size: 20.00 MB

More

(used to delete files and postings)


The Python Pill Anonymous 04/27/2020 (Mon) 17:46:30 No.2720
I'm having mixed feelings about this language. I've been recently tasked to write a project using it and part of me is really happy about how relaxing it is to code with it, that is to say, how braindead most of its functionalities are and how easy it is to just grab a module from someone else, try it, find out they forgot some very important functionality, just add it in post and use it as you please. On the other hand, it's staggeringly heavy duty unless you're going for GPU processing and some design choices are just counter intuitive (why is there no Switch case? who thought that having different parts of code be separated by indenting them would have been a good idea?) - so I'm left asking you guys: 1) Is it worth it learning expansively over other languages? 2) What are your thoughts on its features? 3) Some neat modules you've found?
1) You should learn any language you happen to find, regardless of their apparent usefulness. You never know when they'll be actually useful in your life and it's better to be ready beforehand. 2) They're ok, but they're also not that great. 3) I use Python sparingly and not for big programs, so I can't comment.
One nice aspect of python is that everybody knows it, which makes it easy to share your scripts with others.
>>2720 1)No language is worth learning expansively if you don't have good reasons to use it regularly (for example, if you need to know C++ for your job you better learn as much of it as you can, but if you only use once or twice a year for some light modding you don't need to know it that well). 2)No great features IMO and quite a few big ones missing or lacking (there's basically no ability to create a self-contained file out of your project, be it a native executable or whatever) 3)NumPy and SciPy, if you don't already know about them.
>>2721 >2) They're ok, but they're also not that great. Can you elaborate a bit on this one? >3) I use Python sparingly and not for big programs, so I can't comment. What do you use instead? >>2722 Ah yes, this indeed. I'm having such an easy time finding out how everything works, which is a blessing since most of the documentation for what the actual libraries do is weirdly unfinished - by that I mean, I end up experimenting much more than I would like to even with silly programs for simple stuff that apparently isn't included in any pre-made module. And this is why I was talking about the Switch case problem, apparently not a single person on the dev team found it necessary to create one, so you have to instead implement chains of If Then Else, granted they're optimized greatly but it still blows.
>>2723 >there's basically no ability to create a self-contained file out of your project What do you mean by this? I think you can create working executables with it. I've been using a great deal of sklearn lately
>>2725 >Can you elaborate a bit on this one? For example, dealing with lists using the [i:j] notation is cool since it's a built-in operator and can handle negative indices "intuitively", but all in all it's not really any different than learning the quirks of a "sublist" function/method in some other language. I like the [] operator, but it's nothing special. Another example is list comprehension, which is fine when you have to write a simple filter, but when you get even just slightly more complex (sometimes working with a list of lists is enough) it fails pretty noticeably as it only makes things even harder to read. I use list comprehension myself whenver possible, but this "whenever possible" usually means "in places where a filter doesn't have to span multiple lines". Just to be clear, those features are useful and if you're going to learn the language I advise you to use them as much as possible, but beware that they're nothing revolutionary as some people make them look like. >What do you use instead? It depends. Lately I had to work with Ruby, but some time ago I was using Java. I also write some C from time to time for small personal projects. I also maintain a few projects written in javascript, used by a bunch of people.
I like python just fine. It's a pretty simple and intuitive language. You can pretty much just make what you want and half the time it works on the first try. Awhile back I tried making my own little scripting language in C. It took almost a week to program just the parser. I ended up with a double free bug that I just could not track down. I decided to write a kind of prototype version in python. It took me a week to do the whole thing, and I didn't work half the intensity as I did in C. Of course, its slow as balls in python. It's just a toy language to prove to myself I can do it. Now that I've got a mental map of how the completed interpeter should work, it should be much easier to rewrite it in C. I'm putting that off, though. I have other projects I want to work on now. Thanks for coming to my TED talk. Here's a shithub link. https://github.com/SpaceBudokan/Sutakku-py
>>2726 >I think you can create working executables with it. With external and unofficial tools, not natively afaik. No official support is a big deal when money is involved, you can't simply go "teehee we can't deploy the new code because some guy on github no longer maintains his py2exe tool, whoopsie".
>>2720 I hate Python packages. Disgusting virtual envs.
1. Learn it for computer vision or machine learning. Other than that it's a lazy alternative for writing native applications, but performance is going to suffer. 2. The reference and scoping semantics are both about as backwards as you'd expect for a scripting language, deploying python programs is a pain in the ass, and its async/await system is poorly implemented compared to its contemporaries. It also has most of your typical dynamic typing pitfalls in terms of maintainability, although it doesn't suffer from php and javascript's type coercion problems. It does typically manage to be fairly concise, although this is due in large part to library design, but it's nice to have regardless. 3. pyopencl is pleasant to work with, although I would generally recommend writing a native library containing your opencl code instead.
>>2720 >2) What are your thoughts on its features? It tries to make everything easy by having a simple syntax that is leaving out many things you'd see in other languages. Like curlybraces. But that makes python actually much harder to read because everything looks the same.
I am not sure if I should like Python. Some of the pro's I can think of is the pretty strong standard library. Also the data structures are very simple to use. Also there are very easy libraries for every task I can imagine (flask, tensorflow, pandas, opencv, mongodb, ...) But to be honest, most of the times being "pythonic" feels like messy code. The thought of having multiple classes in one file is not my favorite choice. Also the missing type safety, missing interfaces, structs,... makes it difficult for me. I head learnt most of my clean code and clean architecture skills from Uncle Bob. And Python seems to work against the code style I learnt.

Report/Delete/Moderation Forms
Delete
Report