Real Python tips from the IT industry. #Python #WebDevelopment #Programming

Joined October 2021
10 Photos and videos
Quickly learn how to utilize classes in Python! #coding #pythonforbeginners #programming #Python
14
Write efficient Python code using the zip function! #pythonprogramming #WebDevelopment #learnpython
9
Lists are a very efficient tool for programming in Python. Every project, no matter how small or complicated, needs a list! #python #pythonprogramming #WebDevelopment
4
Did you know that if your table type is Unlogged Table in PostgreSQL, you can lose data? Particulary after major upgrades. PostgreSQL is one of the most commonly used databases with Python. Please take a look at the screenshots. #Python #PostgreSQL #pythonlearning
1
1
Did you know that if your dictionary matches the function's parameters, you can pass it as a keyword argument? Python will throw an error if it does not match. #python #pythonprogramming #pythoncode
3
Python Tips retweeted
27 Jan 2022
A great example of breaking "I - Isolated" in the FIRST principle of unit testing :) The order that the tests run can be seen using "-v" option. In this case, the tests are run in alphabetical order based on their names as per the Python doco. docs.python.org/3/library/un…
1
1
This is correct. Lists are mutable in Python. Therefore, lists shouldn't be used via a global variable. #python
You should run the tests in verbose mode. My guess is that test_a runs first and modifies the list. You should probably be using a setup method in your TestCase so it uses a new Python list for both tests
1
Why isn't the first unit test successful? In other words, Why is the second unit test successful? #python #pythonlearning #pythonquiz #pythonprogramming
4
7
25
That's correct! #Python
Replying to @tipsfromit
It will give ERROR (UnboundLocalError) As in function firstname is defined after using it. Function follows LEGB rule, so it first check in local variables, it is present but initialised after using it.
1
1
Did you know that you can overload the constructor method in Python since 3.8? #Python
1
1
2
The patch decorator can be tough when you want to create a mock object in Python. Because you will need to write the path as a string. There is a nice alternative: patch.object. Which one is easier for your Python unit tests? What do you think?
1
The patch decorator can be tough when you want to create a mock object in Python. Because you will need to write the path as a string. There is a nice alternative: patch.object. Which one is easier for your Python unit tests? What do you think?
Python quiz: What is the output of this code?
1
1
Did you know that you can use "named tuples" as a type hinting in Python? Learn new tips and tricks about Python here #Python #pythonlearning #programming
1
1