PyData Careers – Telegram
PyData Careers
21.4K subscribers
238 photos
10 videos
26 files
398 links
Python Data Science jobs, interview tips, and career insights for aspiring professionals.

Admin: @HusseinSheikho || @Hussein_Sheikho
Download Telegram
Question from the interview

What is Meta in Django and why is it needed?

Answer: Meta is a nested class used to set additional settings for a model or form. It doesn't directly describe the fields, but controls the object's behavior: table name (db_table), sorting (ordering), constraints (unique_together), human-readable names (verbose_name), and other parameters.

Django uses metaclasses to retrieve information from Meta when creating a model and configure its operation in the ORM and admin interface. There's no need to override the mechanism — it's enough to define the class Meta within the class.


tags: #interview

https://news.1rj.ru/str/DataScienceQ
Please open Telegram to view this post
VIEW IN TELEGRAM
1
This media is not supported in your browser
VIEW IN TELEGRAM
🔖 An excellent resource for learning about neural networks

We're sharing a cool resource for learning about neural networks, offering clear, step-by-step instruction with dynamic visualizations and easy-to-understand explanations.

In addition, you'll find many other useful materials on machine learning on the site.

Find and use it — https://mlu-explain.github.io/neural-networks/

tags: #AI #ML #PYTHON

@CODEPROGRAMMER
Please open Telegram to view this post
VIEW IN TELEGRAM
1
Forwarded from Code With Python
Media is too big
VIEW IN TELEGRAM
Build and Automate Django CRM

#Django #CRM #PYTHON
4
Forwarded from Udemy Coupons
101 Python Projects | The Complete Python Course for 2025

Master Python in 2025: Build 101 Projects, Learn Socket Programming , Automation, Data Analysis, OpenCV and OOP....

🏷 Category: development
🌍 Language: English (US)
👥 Students: 6,622 students
⭐️ Rating: 4.3/5.0 (143 reviews)
🏃‍♂️ Enrollments Left: 955
Expires In: 0D:4H:4M
💰 Price: $28.67 => FREE
🆔 Coupon: 3F0CCFA8597F6D23CD48

⚠️ Please note: A verification layer has been added to prevent bad actors and bots from claiming the courses, so it is important for genuine users to enroll manually to not lose this free opportunity.

💎 By: https://news.1rj.ru/str/DataScienceC
Forwarded from Udemy Coupons
Python Zero to Hero: Master Coding with Real Projects

Python for Beginners & Beyond: Learn to Code with Real-World Projects...

🏷 Category: it-and-software
🌍 Language: English (US)
👥 Students: 15,346 students
⭐️ Rating: 4.2/5.0 (138 reviews)
🏃‍♂️ Enrollments Left: 983
Expires In: 0D:4H:4M
💰 Price: $26.03 => FREE
🆔 Coupon: 42CE25692A9A939BF456

⚠️ Please note: A verification layer has been added to prevent bad actors and bots from claiming the courses, so it is important for genuine users to enroll manually to not lose this free opportunity.

💎 By: https://news.1rj.ru/str/DataScienceC
Interview question

Why is list.sort() faster than sorted(list), if the same list is being sorted?

Answer: The list.sort() method performs in-place sorting, modifying the original list without creating a new copy. This makes it more efficient in terms of memory and performance.

The sorted(list) function creates a new sorted list, which requires additional memory allocation and copying of elements before sorting, which can increase time and memory overhead.


tags: #interview

https://news.1rj.ru/str/DataScienceQ
Please open Telegram to view this post
VIEW IN TELEGRAM
4
Python tip:

A shallow copy (copy.copy()) copies the object itself, but not its nested elements.

A deep copy (copy.deepcopy()) copies both the object and all its nested structures.

Therefore, with a shallow copy, changes in the nested elements are reflected in the original, while with a deep copy, they are not.

https://news.1rj.ru/str/DataScienceQ
4
The methods getitem() and setitem() allow to implement access to object elements by index or key, just like in lists or dictionaries. 


class CustomContainer:
    def __getitem__(self, key):
        return self.data[key]  # Returns the value by key/index

    def __setitem__(self, key, value):
        self.data[key] = value  # Sets the value by key/index


__getitem__() is called when accessing obsetitem __setitem__() — when assigning obj[key] = value. It allows to emulate the behavior of built-in collections.

✈️ https://news.1rj.ru/str/DataScienceQ
Please open Telegram to view this post
VIEW IN TELEGRAM
4
🔗 Python Tuple Basics: A Quick Guide 👍

Do you know what a Python tuple is? 🤔 In this article, we'll explore the basics of tuples in Python. Let's dive right in!

What are Python Tuples?
------------------------

Tuples are immutable collections of values that can be thought of as lists, but with more structure and safety. They're created using square brackets [] and elements are separated by commas.

Creating a Tuple
----------------

You can create a tuple by enclosing elements in parentheses (). For example:
my_tuple = (1, 2, 3)

This creates a tuple with three values: 1, 2, and 3. You can also use the tuple() function to convert a list into a tuple:
values = [1, 2, 3]
my_tuple = tuple(values)
print(my_tuple) # (1, 2, 3)

Accessing Tuple Elements
---------------------------

Tuples have two ways to access elements: indexing and slicing.

* Indexing is used with square brackets [] to access individual elements. For example:
my_tuple = (1, 2, 3)
print(my_tuple[0]) # prints 1

* Slicing is used with square brackets [] to extract a subset of elements. For example:
my_tuple = (1, 2, 3)
print(my_tuple[1:3]) # prints (2, 3)

Common Features and Gotchas
------------------------------

Tuples have some useful features, such as:

* Immutable: Tuples cannot be modified once created.
* Ordered: Tuples maintain the order of elements.
However, they also come with a few gotchas, such as:

* Performance overhead: Creating or accessing tuples can incur performance penalties.


When working with tuples in Python, keep these best practices in mind:

* Use tuples for immutable data where possible.
* Avoid using tuple unpacking to assign values from one variable to another.
* Be mindful of performance when creating or accessing large number of tuples.

By following this quick guide to Python tuples, you'll be well on your way to understanding the basics of tuples and how they can enhance your Python programming experience. 📚

Check it out for more resources: [https://realpython.com/python-tuple/](https://realpython.com/python-tuple/)
2
FastAPI: Speed, Developer Experience, and More 🚀

🏆 Starting with FastAPI: A Popular Python Web Framework
---------------------------------------------------------

FastAPI is an open-source web framework for building APIs with Python. It provides automatic validation, serialization, and interactive documentation through standard Python type hints.

Choosing the Right Framework for Your Project:
-----------------------------------------------

| Use Case | Pick FastAPI | Pick Flask or Django |
| --- | --- | --- |
| Building a Web App | | — |
| Full-Stack Web Framework | — | — |

Key Features:

* Speed: FastAPI is built on top of Python 3.7+, with a focus on performance and scalability.
* Developer Experience: Easy-to-use API documentation, auto-generated documentation, and support for asynchronous programming.
* Built-in Features: Automatic JSON serialization and deserialization, support for WebSockets and gRPC.

Start Building Your API Today! 💻

Learn more about FastAPI and how to get started with building your own APIs. Check out this free online course: https://futurecoder.io/ 🚀
3
Stop using if obj == None, use if obj is None

In Python, when you write:

obj == None


you're not directly checking if obj is the value None. Instead, you're asking if the object is equal to None.

Yes, in many cases, the result will be the same as for the code:

obj is None


But the behavior of these two variants is different, and this difference is important.

When you use:

obj == None


Python calls the __eq__ method on the object. That is, the object itself decides what it means to be "equal to None". And this method can be overridden.

If obj is an instance of a class in which __eq__ is implemented so that when compared with None, it returns True (even if the object is not actually None), then obj == None may mistakenly give True.

Example:

class Weird:
    def __eq__(self, other):
        return True  # Always asserts that it's equal

obj = Weird()

print(obj == None)  # True
print(obj is None)  # False


Here, it can be seen that obj == None returns True due to the custom behaeqf the __eq__ operator in the class.

Therefore, when using obj == None, the result is not always predictable.

On the other hand, when you write:

obj is None


you're using the is operator, which cannot be overridden. This means that the result will always be the same and predictable.

The is operator checks the identity of objects, that is, whether two references point to the same object. Since None is a singleton (the only instance), obj is None is the correct and most efficient way to perform such a check.

❤️ Therefore, it is always recommended, and this is best practice, to use obj is None instead of obj == None for predictability and efficiency.

👉 https://news.1rj.ru/str/DataScienceQ
Please open Telegram to view this post
VIEW IN TELEGRAM
4
Please open Telegram to view this post
VIEW IN TELEGRAM