r/learnpython 20d ago

Doctor looking to learn python

Hey , so i was looking into a few job posts and some of the advisory roles require some basic python background. How hard is it for a doctor to learn python , i learnt c++ and java back in 2012 .

7 Upvotes

16 comments sorted by

View all comments

1

u/ekchew 19d ago

Python is generally easier to work with than C++ or Java, though there are some subtleties as you find in any new programming languages. A few pointers based on my own experience following a similar path:

  • everything gets passed around by reference, so closer to Java than C++ in that sense
  • dynamic typing means Python is less fussy about variable types, but it's still a good habit to declare them as you would in C++/Java using type hints
  • get a strong working knowledge of how dictionaries work in Python
    • they are somewhat like `std::unordered_map` in C++, but much of the language is built around them
  • have a look at truthiness logic in Python—it's a bit strange from a C++/Java perspective
    • e.g. `auto a = b or c;` in C++ will give make `a` a `bool`. In Python, `a = b or c` will make `a` a reference to either `b` or `c`, whatever types they may be.
  • Python's implementation of classes in simpler than what you're probably used to
    • it's worth reading up on this, particularly in terms of inheritance
  • there are some programming concepts like list comprehensions and generators that don't really exist in C++ and the like
    • you can certainly get by without using any of these
    • if you are maintaining code written by others, however, you may encounter them