Python seems to be all the rage nowadays.

Python seems to be all the rage nowadays.

As a long time Delphi developer, why should I consider learning Python?

(From a purely technical perspective, disregard job opportunities for now please.)
https://developers.slashdot.org/story/18/07/20/227246/is-python-the-future-of-programming

Comments

  1. No real point learning something for the sake of it. How can we know what would be useful to you.

    ReplyDelete
  2. Thomas Mueller If you are interested, consider taking a shallow dive just so you are familiar with the lingo of new rage. For me, it took only 5 minutes.

    Your are likely to use, (or are using) Linux, and even perhaps a distro that has some sort of Nautilus knock off for a file manager. If so, I can think of no finer use of the Nautilus "scripts" directory to fill your right clicked "file and directory context menus" with tons of great code (much in python). Mine is stuffed with great "copy file path" like utilities, and most are a only few lines of code. Add a few, and then, your an expert, and can get back to Delphi (or C++).

    ReplyDelete
  3. Totally stupid language but most popular in servers...sometimes I wonder how some languages find their way to the market

    ReplyDelete
  4. John Kouraklis , I don't think Python is stupid, every language has it's place, Python shines in Data Science and Artificial Intelligence.

    ReplyDelete
  5. Python is my second language after Delphi. It's amazing, and especially suited for data analysis and web development. One thing that it endears it to Pascal fans is its readability and emphasis on simplicity. Its weakness seems to be desktop application development (which is Delphi's strength). Overall I'd highly recommend Delphi developers learn python, even as just an insurance policy.

    ReplyDelete
  6. It will depend on the type of environment you will add. In order to program in a practical and fast way, it is a good alternative.
    Now if you are focused for example on memory resource management (embedded system) ideally would use C/C++ or even the newly arrived Rust.

    ReplyDelete
  7. To learn something new is NOT a bad thing. Will it be useful you never know until that time arrives.

    Python is really simple to pick up and any real programmer can learn it within 8 hours.

    You can use it with Apple Macs, DIY projects (Raspberry, BeagleBone, etc.) and even on Windows.

    My advice to anybody is a new day is another day of learning.

    ReplyDelete
  8. I use Python all the time to prototype image processing algorithms (using OpenCV with Python is pretty easy). Then, once the algorithm is proven out, I'll code it in Delphi. Having Python in your 'toolkit' can be very handy.

    ReplyDelete
  9. John Kouraklis Would you care to elaborate why you believe that to be so

    ReplyDelete
  10. Ok, maybe it was not the right word and I know it is used extensively in big data, stats, etc but I find totally counterproductive when I need to take care of the spaces and indentation if I want the code to run

    ReplyDelete
  11. John Kouraklis as someone who does a lot of Python programming, I can honestly say that once you are used to it (does not take long), indentation is not a problem. I suspect your criticism is largely due to lack of experience.

    ReplyDelete
  12. Thomas Mueller If you're looking for a new language to learn, check out Go. I would say it's at least as easy as Python, more performant, has a large community, great standard library, big and growing ecosystem, plus corporate backing from Google. Just do a search on Python vs Go, and you'll find most of the articles and blog posts are about people moving from Python to Go, not the other way around.

    ReplyDelete
  13. I found python rather difficult to get my head around. My reason for learning it (well enough to read it) was to understand the Mercurial source code so I submit a pull request (mission accomplished!). The mercurial source was probably the most difficult code I have ever had to read, not because it's that complicated a subject, but because of the way python (or at least the hg team) name variables, functions etc. The other thing I struggled with was that formatting matters... the last time I had to deal with that was cobol on a mainframe (thankfully I didn't have to do much of that!).

    ReplyDelete
  14. Oh, and with .net core now being cross platform, if you want another language from an employment perspective, C# is (imho) much easier to learn, and the .net libraries are easier to use.

    ReplyDelete
  15. Python is useful if you want to look at Machine learning or Data science side.

    ReplyDelete
  16. John Kouraklis I find it totally counterproductive when I need to take care of putting all variables in their own block if I want the code to run.
    Significant whitespace keeps getting brought up as an argument against python but aside from copying code from Stackoverflow that never seems to be a problem in real life. Also I have yet to see an example of a language that doesn't have any syntactic quirks that a developer needs to take care of.
    Python is great as a scripting language and for rapid prototyping. Plus it is really easy to pick up at least the basics. That won't stop anyone from producing bad and unreadable code of course.

    On the other hand anyone claiming to know what the future of programming might be like immediately disqualifies themselves. As a (de-)motivational example of what people thought the future would be like see this: https://youtu.be/8pTEmbeENF4
    youtube.com - Bret Victor The Future of Programming

    ReplyDelete
  17. IMO, Python is the "modern visual basic". Nice for tinkering, but unsuitable for larger projects.

    ReplyDelete
  18. Lars Fosdal Well, it's useful for way more than tinkering. Lack of compile time type checking causes headaches for developers used to that crutch. I do wonder whether tools would make a difference.There is an awful lot of coding though that is not large scale big code base dev. Scripting. Glue code. Web code. Python has its place and many of the comments here are from people that don't do the type of development where Python shines. Use the right tool for the job.

    ReplyDelete
  19. David Heffernan "There is an awful lot of coding though that is not large scale big code base dev. Scripting. Glue code. Web code." - Nothing wrong with using Python for tinkering in those contexts.

    ReplyDelete
  20. Lars Fosdal So you belittle anything written in Python?

    ReplyDelete
  21. DropBox is written in Python. It's certainly a large scale app with wide deployment.

    ReplyDelete
  22. David Heffernan Do I? I said "unsuitable for larger projects".

    ReplyDelete
  23. Lars Fosdal Tinkering is belittling

    ReplyDelete
  24. David Heffernan Depends on the Thesaurus, I guess.

    From
    https://www.urbandictionary.com/define.php?term=tinkers

    #5

    "Tinker
    noun--A non-professional person skilled at mechanical or electrical inventions and/or repairs.

    verb--To engage in minor repairs or inventing.
    John's an excellent tinker; he got my lawn-mower running in ten minutes.

    John's always tinkering. His latest widget gets my mail and throws away the ads."

    It certainly wasn't intended to be belittling.

    ReplyDelete
  25. Lars Fosdal It was though. Anyway, I guess if somebody turned up here with a few half baked ill informed criticisms of Delphi there would be a strong reaction. Criticism of Python from non experts is no better.

    ReplyDelete
  26. David Heffernan On the topic of belittling, pot/kettle/black much?

    ReplyDelete
  27. Lars Fosdal Not a convincing argument.

    ReplyDelete
  28. Not an argument. A repeat observation.

    ReplyDelete
  29. Apart from Data science or NLP you can also do web development using frameworks like Django or Flask. Its not a bad language to learn. I have used Python mostly for NLP for web development i rather prefer to use java script framework.

    ReplyDelete
  30. Lars Fosdal So you attack the individual rather than the argument? Really.

    ReplyDelete
  31. Python is a major development tool. Not a toy, not unsuitable for large projects. Youtube is largely written in Python, for example (nevermind the occasional .php extension)

    ReplyDelete
  32. David Heffernan Please spend more time at SO.

    ReplyDelete
  33. Lars Fosdal Attack the individual. Nice one.

    ReplyDelete
  34. I get the impression that I should have deleted some comments to prevent arguments. Thanks for everybody who has contributed.

    ReplyDelete
  35. As a long time Pascal lover, I had to look at Python à few years ago in the IA field. It has been a good surprise to me, a powerful language suitable for a lot of applications. I keep using Pascal (Delphi, FPC, Lazarus) but in no way I would neglect Python if the opportunity is given.

    ReplyDelete
  36. As for whether or not you should learn Python, only you can decide that. Learning a new language is often useful and interesting. But there are many out there. Why Python rather than any other? That's for you to say.

    Since the discussion has veered on to opinions of what Python is useful for, and less useful for, I will offer some thoughts on what I do with it.

    I first learnt Python because, at work, I was looking for a scripting language that was not Perl. Perl is perfectly functional but aesthetically I did not enjoy using it. Further, I was intending to take our company's product (OrcaFlex) and wrap its API with a Python interface. That would allow our users to automate OrcaFlex using a more approachable language that Delphi or C++ which were until then the available options. Our users are mechanical or naval engineers rather than software developers, and so languages like Delphi and C++ have a bigger barrier to entry than something like Python.

    This project has proved successful beyond my wildest expectations. Python automation of OrcaFlex is now incredibly widespread. We run training courses for the Python interface to OrcaFlex. We have subsequently added a MATLAB interface (for users that prefer MATLAB, or are already MATLAB users) that is pretty much interchangeable.

    But before we even released our Python interface to OrcaFlex to our customers, we adopted it internally for our own integration and system test code. Previously this had been done in Delphi, but we found it was much more productive when we switch to Python. With our Delphi test code there was a lot more boilerplate. The Python test code is much more concise and we can concentrate on the numerical aspects without worrying about allocating objects, sizing arrays etc. The dynamic nature of Python turns out to win here.

    That work has Python on the outside, but we also embed Python into OrcaFlex. For example, we use it to let users specify geometric shapes by providing equations, and we then perform symbolic calculus on those equations using sympy. The huge array of powerful third party modules makes this an easy win. Because of the general purpose nature of Python we are not limited as we would be if we attempted to introduce our own domain specific language.

    There is a misconception, in my view, that Python is just for scripting. I think the comment that Lars made that it was fine for "tinkering" reflects that view point. At least that's how I interpreted it. Whilst so many of us arrive at Python with scripting in mind, it can and is used for so much more. I think before it is written off as just for small scale development, one should look at organisations and projects that use it on large scale development. I've never done that, but I know that it happens. Knowing how I benefit from compile time type checking in a large project, I worry that not having that would cause problems in large scale development. But reading around the subject, people using dynamic languages like Python for large scale development simply work in different ways. They have different techniques for solving the problems. I don't think dynamic languages should be written off by people that don't have extensive experience in them.

    Now, I'm certainly not advocating using dynamic languages for everything. I don't think I'd want to write a desktop Windows app like OrcaFlex in Python. The VCL meets my needs there very well. But similarly I'd never want to write build scripts in Delphi, I'd never want to go back to writing my test code in Delphi, and I don't want to write automation and extension of OrcaFlex in Delphi. Use the right tool for the job at hand. Different jobs are best solved by different tools. Ergo, if you only have one tool available then that makes you a less useful developer in my opinion.

    ReplyDelete

Post a Comment