DEV Community

My frustrations with Python

ChrisMuga on March 09, 2018

I have been coding using Python for almost 2 weeks now and I think I have a good handle on the basic stuff, i.e the basic syntax, declaring varia...
Collapse
 
eljayadobe profile image
Eljay-Adobe

I had a long list of complaints with Python 2.x. I thought the language was okay, but awkward, and had unsurmountable problems.

When Python 3.0 came out, I was amazed that every single one of my negatives points against Python 2.x had been rectified in Python 3.0. Wow! That must have been a very painful bandage to rip off.

Since you are coming from PHP, I presume your problem domain is one for which PHP is a good choice for solving those problems. Perhaps the best choice in that domain. Python by itself does not really compete in that domain.

But Python with Django does compete in that space, at least to some extent. (Another more popular alternative is Ruby on Rails ... I've found Ruby not to my liking, and I've found Python to appeal to my sense of code aesthetics. But that's all a subjective matter of one's personal taste.)

Collapse
 
incognitjoe profile image
Joe Butler

The most stable release as I found out is Python2.7 and is actually the default Python environment in my OS

Python 2 is actually deprecated - it was intended to be End Of Life in 2015, but then that was pushed out until 2020. However, there is a freeze on new features, it is purely maintenance releases and there will never be a Python 2.8. The reason 2.7 is already installed on your system is that quite a few operating systems have dependencies on it.

As you're just starting out, you definitely want to be using Python 3, but this does mean checking whether the packages you're aiming to pull in are actually compatible.

Note that you can have multiple Python versions installed - do not attempt to upgrade your system installation manually or you could do some serious damage to system dependencies.

In terms of general package management/dev workflow, I'd highly recommend checking out Pipenv - it's the officially recommended solution, and from personal use, it's absolutely fantastic too.

Collapse
 
blazselih profile image
Blaž Šelih

I don't mean to sound harsh, but this is 2018. If 2/3 compatibility is giving you trouble, you are using wrong packages to begin with.
Have you considered using an ORM to access the database? It may be total overkill for simple CRUD, but is worth learning nevertheless. There are many options, eg. SQLAlchemy is pretty cool and powerful, PonyORM is arguably somewhat simpler.

Collapse
 
pstarek profile image
Pavel Stárek (CZ) • Edited

Hi,

you may try mysqlclient package to access MySQL server on Python 3.x .

github.com/PyMySQL/mysqlclient-python