#python_builtins_by_driscollis Suchergebnisse
#Python includes a function called `vars()`, which will return the __dict__ attribute for a module, class, instance, or any other object with a __dict__ attribute. Without an argument, `vars()` acts like `locals()` #python_builtins_by_driscollis 🧵🐍👇
#Python has the useful `globals()` built-in It returns the dictionary implementing the current module namespace. For code within functions, this is set when the function is defined and remains the same regardless of where the function is called. #python_builtins_by_driscollis
#Python includes several handy built-in functions you can use to work with class attributes. One such built-in is called `delattr` and is used for deleting attributes. I have never really needed this built-in myself, but here's an example #python_builtins_by_driscollis
#Python has a `bytes()` built-in that is closely related to its `bytearray()` built-in. 🐍🔥 The difference is that `bytes()` as immutable! `bytes()` has the same non-mutating methods and indexing and slicing behavior. #python_builtins_by_driscollis
Another great #Python built-in is `chr()` 🐍🔥 `chr(i)` will return the string representing a character whose Unicode code point is the integer i. Note: This is the inverse of `ord()` Below are a couple of examples: #python_builtins_by_driscollis
#Python includes a `memoryview() built-in class. According to the docs, "memoryview objects allow Python code to access the internal data of an object that supports the buffer protocol without copying." #python_builtins_by_driscollis 🧵🐍👇
#Python includes two functions for creating sets. You are probably familiar with `set()`, so let's talk about the `frozenset()` built-in today! ☃️🐍 docs.python.org/3/library/stdt… #python_builtins_by_driscollis 🧵🐍👇
Another great #Python built-in function is `getattr()`. `getattr()` will eturn the value of the named attribute of object. If the string is the name of one of the object’s attributes, the result is the value of that attribute. #python_builtins_by_driscollis 🧵👇🐍
#Python includes the `complex()` built-in function, which will return a complex number with the value real + imag*1j or convert a string or number to a complex number Let's learn more about how `complex()` works! #python_builtins_by_driscollis 🧵🐍👇
Another great built-in #Python function is `callable()` According to the docs, `callable()` will return True if the object argument appears callable, False if not. #python_builtins_by_driscollis 🧵🐍👇
#Python includes a handy `filter()` function that is built-in `filter()` takes two arguments: 🐍 function - The function to call 🐍 iterable - An iterable of items to pass to the function #python_builtins_by_driscollis 🧵🐍👇
Starting in Python 3.7, the `breakpoint()` built-in function was added It is defined in PEP 553 and simplifies adding a breakpoint to your code #python_builtins_by_driscollis 🧵🐍👇
One of #Python's most controversial built-in functions is `eval()`. The main reason it is controversial is that it can be used to execute arbitrary code. #python_builtins_by_driscollis 🧵🐍👇
#Python includes a handy built-in function called `input()` that you can use to prompt the user for information. The function will read what the user types in and return it as a string #python_builtins_by_driscollis 🧵🐍👇
#Python includes a `memoryview() built-in class. According to the docs, "memoryview objects allow Python code to access the internal data of an object that supports the buffer protocol without copying." #python_builtins_by_driscollis 🧵🐍👇
Another great built-in function in #Python is the `ascii()` built-in You will learn about `ascii()` in this mini-thread! 🧵🐍👇 #python_builtins_by_driscollis
Did you know there is a handy built-in for #Python called `hasattr()`? It takes in the object and a string. The result is True if the string is the name of one of the object’s attributes, False if not. #python_builtins_by_driscollis 🧵🐍👇
Python includes a built-in callable named `bytearray()`. The bytearray class is a mutable sequence of integers in the range 0 <= x < 256. They return a new array of bytes #python_builtins_by_driscollis 🧵🐍👇
Starting in Python 3.7, the `breakpoint()` built-in function was added It is defined in PEP 553 and simplifies adding a breakpoint to your code #python_builtins_by_driscollis 🧵🐍👇
#Python includes an `exec()` built-in that is closely related to the `eval()` built-in. The difference is that `exec()` can take code blocks, but it always returns None #python_builtins_by_driscollis 🧵🐍👇
Something went wrong.
Something went wrong.
United States Trends
- 1. Philip Rivers 11.5K posts
- 2. Colts 28K posts
- 3. #WWERaw 17.2K posts
- 4. Alec Pierce 3,065 posts
- 5. Purdy 10.1K posts
- 6. Niners 5,718 posts
- 7. #FTTB 4,281 posts
- 8. #WLRDeluxe 23.6K posts
- 9. #ForTheShoe 1,713 posts
- 10. #SFvsIND 1,314 posts
- 11. Kittle 5,769 posts
- 12. Kansas 31.1K posts
- 13. Adam the Woo N/A
- 14. Uncle Phil N/A
- 15. Missouri 14.1K posts
- 16. Luter 1,164 posts
- 17. CJ West N/A
- 18. Saleh 8,234 posts
- 19. Arrowhead 10.7K posts
- 20. Greenland 63.3K posts