TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #345 · 9 окт.

Функция dir() - удобна для получения списка атрибутов у любого объекта. Ранее я писал про функцию __dir__() в модуле (не путайте её с переменной __all__(), которая указывает список объектов для импорта если встречается конструкция from module import *). Скорее всего вы уже знаете как использовать функцию dir(). Любой объект может реализовать метод __dir__() чтобы указать список имеющийхся и динамических атрибутов. И функция dir() поможет получить список этих атрибутов. >>> dir(str) ['__add__', '__class__', '__contains__', ...] У этой функции есть еще один способ применения. Её можно вызвать без аргумента, и в таком случае она вернёт список имён в текущем неймспейсе. >>> dir() ['__builtins__', '__doc__', '__file__', ...] >>> def test(): >>> x = 1 >>> print(dir()) >>> test() ['x'] #basic#tricks

Резултати

Пронајдени 2 слични објави

Пребарај: #sequential

当前筛选 #sequential清除筛选
djangoproject

@djangoproject · Post #98 · 11.07.2016 г., 12:22

https://docs.python.org/3/library/asyncio.html #asyncio #Asynchronous programming is more complex than classical “#sequential” programming: see the Develop with asyncio page which lists common traps and explains how to avoid them. Enable the debug mode during development to detect common issues.

djangoproject

@djangoproject · Post #153 · 03.09.2016 г., 20:20

http://wla.berkeley.edu/~cs61a/fa11/lectures/streams.html In this chapter, we continue our discussion of real-world applications by developing new tools to process #sequential#data. In Chapter 2, we introduced a sequence interface, implemented in Python by built-in data types such as #tuple and #list. #Sequences supported two operations: querying their length and accessing an element by index. In Chapter 3, we developed a user-defined implementations of the sequence interface, the Rlist class for representing recursive lists. These sequence types proved effective for representing and accessing a wide variety of sequential #datasets.