Why Javer should know some Python?

I am javer, during worktime I am using Java syntax with all Java micro and macroworld. But for some reason I started to learn that language. Reason? There are two people around me who use it (work/unofficially) and to coopearate with them I had to learn it.
While making some little Python project I encountered feelings like that: there are some things I love in Python comparing to Java, some I miss

Why I miss Java writing Python

Static typing

As dev I learned how to statically type. I was static in Delphi, I am static in Java. I prefer to be static. I feel safer then.

Virtual methods

Writing piece of code that should be done according to OOP rules and design patterns may not be easy with Python. You will not have a chance to write code that is virtual function-like. Strategy method can be hard.

Why do I love in Python

Lack of static typing

Yes, the sam reason why I prefer Java. But think about it: you just write. Your variable is exactly that what is. You easily bring to reality all your ideas. You just type list=[] and that is list! You type a = {'a':1} and you have a map (in Pythonish: ‚dict’). Life is easier but don’t forget about consequences!

Ease with daily tasks

For tasks like json, file IO, network and other issue Python is just less verbose. Any examples? Here we go.

Json made simple

No more thinking how to materialize your ideas as file. You may easy save dict/object as json or save it directly as file

[code lang=”python”]
with open(output, 'w', encoding='utf-8') as f :
json.dump(list_of_objects, f, ensure_ascii=False, indent=4)

File is something you open

Nothing easier more than read the file. What do you need to read the file? Just open it

[code lang=”python”]
f = open(path, 'a')

While opening just type the mode (append/read/write) and act!


No more thinking about immortal IOExceptions, networking is way of requesting the space, like that

[code lang=”python”]
page = requests.get(self.url)
page_tree = html.fromstring(page.content)
element_nodes = page_tree.cssselect(self.element_parent)

Above you just GET the url, then take content as text, after that converting to DOM elements, easily traversable. Poetry.

No superheros

I am not trying to say that Python rules. But what I want to remember is fact, that knowing one language you are tight, wider perspective is much more attractive. There are no super-languages, just take what is good and use it in your project. Before that take some time to learn at least foundations of languages available.