Recent

Author Topic: Thoughts on Python?  (Read 22227 times)

bill0287

  • Full Member
  • ***
  • Posts: 146
Thoughts on Python?
« on: June 27, 2016, 11:21:02 pm »
I started learning pascal when Delphi 1 came out and I am very comfortable with the language. I also hear about python a lot, and was wondering if anyone had any thoughts on learning python as well? Is it an easy language to learn? What kind of programs are best suited for it? etc.

I've looked over some content online, but would also like a gut feel reaction of some others who have python experience.

Thanks

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Thoughts on Python?
« Reply #1 on: June 27, 2016, 11:26:22 pm »
Certainly there's many cases these days where you don't have the choice of doing everything in Pascal, for a variety of reasons. One good way to do parts of virtually any project in Pascal is to put your Pascal non-UI code into a dynamic library, then learn enough of one or more languages to demonstrate that the library can be used with those languages.

See article series here on how-to:

https://dl.dropboxusercontent.com/u/28343282/MacXPlatform/PascalDynLibs.html

-Phil

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Thoughts on Python?
« Reply #2 on: June 28, 2016, 12:50:11 am »
Just learn if you want to learn, no need to ask anyone first before getting your hands dirty with any language. Even learning a really dead language (no (recent) implementation, just a bunch of specs or docs) is not a bad idea. You'll find what a language is good for after you gain enough knowledge for the language. It's typically "everything" for a general purpose language, ignoring the technical aspects (speed, memory). Don't limit yourself from people's opinion.

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Thoughts on Python?
« Reply #3 on: June 28, 2016, 01:30:07 am »
Python
 - Great language
 - Easy to learn
 - Interpreted language so not as fast as compiled languages
 - Best language for string manipulation (in my opinion)
 - Wonderful for writing system scripts (especially on Linux)  :D
 - Hard to find a good free GUI for Python (PyQt is the best that I know of and it is not free)
 - Lots of frameworks exist for writing web applications (I've used web2py and I like it)
 - Lots of tutorials everywhere on the Internet
 - Everything is already included in the language (Tcl/tk is there also but I think it is an ugly GUI)

JD
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Thoughts on Python?
« Reply #4 on: June 28, 2016, 09:15:42 pm »
IMHO I never really understood which kind of apps python was suitable for.

Of course the believers say everything, but, as JD says, as soon as you need a GUI, or work on windows, it is already second rate (if not third).

So unless writing strictly for the Linux distributions IMHO there is no point.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Thoughts on Python?
« Reply #5 on: June 28, 2016, 10:03:31 pm »
IMHO I never really understood which kind of apps python was suitable for.

Scripting and plugins, not legacy desktop "apps".

In some areas, Python is about the only thing you would use. For example, in GIS. See this list of plugins for the open-source QGIS:

http://plugins.qgis.org/plugins

Other languages need not apply, except perhaps for developing dynamic libraries to be called from Python, eg,

https://dl.dropboxusercontent.com/u/28343282/MacXPlatform/PascalDynLibs_3.html#QGIS


sfeinst

  • Full Member
  • ***
  • Posts: 230
Re: Thoughts on Python?
« Reply #6 on: June 28, 2016, 10:07:47 pm »
Of course the believers say everything, but, as JD says, as soon as you need a GUI, or work on windows, it is already second rate (if not third).

I don't use Python myself, nor any apps using it, but I'm pretty sure EverNote is written in Python.  I know ZIM (a local Wiki/Treepad tool) is also written in Python.

Not saying it is great or that its UI can't be improved, but there are apps with GUIs that seem to work fine.  Just wanted to point out that a UI can be built with the tool.  I'm not sure what libs you need to do it.

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Thoughts on Python?
« Reply #7 on: June 28, 2016, 11:31:37 pm »
Not saying it is great or that its UI can't be improved, but there are apps with GUIs that seem to work fine.  Just wanted to point out that a UI can be built with the tool.  I'm not sure what libs you need to do it.

Anything built using the Qt library looks great. That is where the heavy lifting is done. But it is not free. I also prefer Python for anything related to Data Mining. Python makes parsing data files for data manipulation easy. If you're into Big Data/Data Mining, sooner or later you'll run into Python.  :)

JD
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Thoughts on Python?
« Reply #8 on: June 29, 2016, 01:19:11 am »
Anything built using the Qt library looks great. That is where the heavy lifting is done. But it is not free.

I believe Qt and PyQt are free for some types of open source projects. Qt is what QGIS is built on and QGIS is free.

And yes, QGIS looks great even on Mac, certainly better than LCL widgets look on Mac.


JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Thoughts on Python?
« Reply #9 on: June 29, 2016, 01:24:54 am »
Anything built using the Qt library looks great. That is where the heavy lifting is done. But it is not free.

I believe Qt and PyQt are free for some types of open source projects. Qt is what QGIS is built on and QGIS is free.

And yes, QGIS looks great even on Mac, certainly better than LCL widgets look on Mac.

You're right. The restriction is for commercial projects. I actually meant to say not free for commercial projects.  :D

JD
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Thoughts on Python?
« Reply #10 on: June 30, 2016, 01:45:04 pm »
IMHO I never really understood which kind of apps python was suitable for.

Of course the believers say everything, but, as JD says, as soon as you need a GUI, or work on windows, it is already second rate (if not third).

So unless writing strictly for the Linux distributions IMHO there is no point.

As an example of a Windows based Python application, take a look at the new PgAdmin 4 (desktop & web interface)
http://pgsnake.blogspot.fr/2016/04/pgadmin-4-elephant-nears-finish-line.html
https://www.postgresql.org/ftp/pgadmin3/pgadmin4/

I believe the developers have tried to create something similar to phpMyAdmin. The problem is that being a Python application, it really shows in the speed of queries. Compared to pgAdmin 3 which was written with C++ with Qt, pgAdmin 4 is SLOW! dBeaver a Java based database management application is even faster than pgAdmin 4. I would keep my pgAdmin 3 & dBeaver for some time to come.

This is why the pros & cons of developing desktop applications with Python should be carefully considered.

Another web based application built with Python is OpenERP/Oddo https://www.odoo.com/.

JD
« Last Edit: June 30, 2016, 01:53:35 pm by JD »
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

cdavidson

  • New member
  • *
  • Posts: 9
Re: Thoughts on Python?
« Reply #11 on: June 30, 2016, 02:39:05 pm »
I like the language and have used it for quite a few utilities, but - so far for me - it seems to fall short when I try it on a major desktop app.  I usually fall back to Lazarus, C# or C/C++.

Instead of QT look at PySide http://wiki.qt.io/PySide it is basically PyQT but allows both free open source and proprietary software development.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Thoughts on Python?
« Reply #12 on: June 30, 2016, 03:20:33 pm »
IMHO I never really understood which kind of apps python was suitable for.

Scripting and plugins, not legacy desktop "apps".

Yes, but  scripting/prototyping is about the first thing ANY language is said to be good for. Even Delphi was with its RAD approach.

And plugins are only doable when the system is specially prepared for Python plugins. Again very general (if system X accepts only  plugins in X... is that a language advantage or the preference of an author?)
 
Quote
In some areas, Python is about the only thing you would use. For example, in GIS. See this list of plugins for the open-source QGIS:

An example of the above.

Quote
Other languages need not apply, except perhaps for developing dynamic libraries to be called from Python, eg,

If I look at the reasons, it seems it only does so because they want vet plugins themselves. (share a plugin program)

Still, Android has the same disease (with Java)
« Last Edit: July 07, 2016, 02:41:38 pm by marcov »

Dasun

  • New Member
  • *
  • Posts: 41
Re: Thoughts on Python?
« Reply #13 on: July 02, 2016, 03:27:40 am »
Calibre is a really nice mult-platform Python  GUI Application ... I set out to learn Python for a multi-platform application and somehow ended up learning Lazarus/FreePascal instead.  One thing that scared me about Python was  no Begin End/{ } construct using whitespace indenting instead .. I have had instances in the past of whitespace being trashed in files and the thought of that happening to a large Python program leaves me stone cold.  Of course, Python is hugely popular and Pascal - well it is considered a little retro in some corners :-)

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Thoughts on Python?
« Reply #14 on: July 02, 2016, 03:46:34 am »
I like the idea of combining good indentation with getting rid of unnecessary begin/end or {}. Apple's new Swift language appears to borrow some nice features of Python (returning tuples as function result) and I had hoped that maybe {} would be optional the way semicolons are optional in Swift.

As for trashing white space, maybe you just need a better editor. I use TextWrangler on Mac - never a hiccup in all the years I've used it.

-Phil

 

TinyPortal © 2005-2018