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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #197 · 4 јан.

Подразумеваемые неймспейсы или неявные пакеты. Этот функционал добавлен в Python 3.3 Что он означает? Ранее, до 3.3 пакетами считались лишь директории, в которых есть файл __init__.py. Этот файл одновременно являлся свидетельством того, что директория это Python-пакет, и служил "телом" этого пакета. То есть местом, где можно написать код, как это делается внутри модуля. Этот код исполняется в момент импорта пакета, так что его принято называть "код инициализации пакета". Начиная с версии 3.3 Любая директория считается пакетом и Python будет пытаться использовать любую директорию для импорта. Конечно, не любую в файловой системе, а только те что находятся в sys.path. Это значит, что теперь __init__.py нужно делать только если: 🔸 вам требуется создать код инициализации пакета 🔸 нужна совместимость со старыми версиями Python На мой взгляд это немного упрощает разработку, делает её чище, но с другой стороны убивает некоторую однозначность происходящего. Например, я создал репозиторий со своей библиотекой и рядом положил код примеров или тестов. repo_name/ my_library/ __init__.py main.py examples/ exam1.py exam2.py В этом репозитории пакетом является только my_library, остальные директории это не пакеты, это просто дополнительный код в файлах. Директория examples не добавлена в sys.path, в ней нет рабочих модулей. Но если она лежит рядом с my_library, то Python вполне сможет импортнуть из неё модули, так как посчитает что examples это валидный пакет. Конечно, пример несколько надуманный. Никто не будет добавлять корень репозитория в sys.path. Но, я думаю, суть ясна. Иногда директория это просто директория а не пакет! #basic#pep

Hashtags

Резултати

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

Пребарај: #symbol

当前筛选 #symbol清除筛选
Language Trivia 🤔

@languagetrivia · Post #404 · 28.11.2024 г., 16:32

The symbol ¶ was commonly used in Medieval manuscripts to indicate a new paragraph. Since there were no standards for indenting or spacing at the time, specialized scribes known as rubricators marked paragraphs (beginning of a different train of thought within the author's narrative) with these ornate symbols, often drawn in red ink. The symbol ¶ has largely fallen out of common use but remains a symbol for paragraph breaks in formatting tools. Take the quiz below to find out what this symbol is called Tap ❤️ @languagetrivia#theory#symbol

djangoproject

@djangoproject · Post #135 · 01.09.2016 г., 18:35

https://wiki.python.org/moin/PythonDecorators This page largely documents the history of the process of adding #decorators to #Python. If you're just interested in what decorators or the '@' #symbol mean in Python, see the Wikipedia page .http://en.wikipedia.org/wiki/Python_syntax_and_semantics#Decorators or PEP 318.

Language Trivia 🤔

@languagetrivia · Post #352 · 19.11.2024 г., 16:39

The @ symbol has many nicknames across different languages. For example: ➖In Russian, it’s known as собака (sobaka), meaning “dog” ➖In German, it’s called Affenschwanz, meaning “monkey’s tail” ➖In Turkish, it’s known as kuyruklu a, meaning “a with a tail” ➖In Finnish, it’s called kissanhäntä, meaning “cat’s tail” What does the Italian name for this symbol mean? A. Monkey B. Snail C. Dog D. Spider Check out the first comment of the quiz below to see the right answer. @languagetrivia#across_languages#symbol

Language Trivia 🤔

@languagetrivia · Post #367 · 22.11.2024 г., 12:17

The ampersand (&) symbol has a rich history intertwined with the evolution of the English alphabet. Originally, it was a ligature of the Latin word “et,” meaning “and.” Over time, this symbol became so integral to writing that it was included as the 27th character in the English alphabet, following ‘Z’. When reciting the alphabet, people would conclude with “X, Y, Z, and per se and,” which translates to “and, by itself, and.” This phrase was eventually slurred together into the single term “ampersand.” Source Tap ❤️ if you found this interesting @languagetrivia#theory#term#symbol#etymology

Language Trivia 🤔

@languagetrivia · Post #463 · 10.12.2024 г., 19:02

In the world of printing and journalism, the exclamation mark (!) has earned a variety of colorful nicknames. One of these humorous terms compares its shape to a specific part of a dog’s anatomy. Sometimes an exclamation mark is humorously referred to as “a dog’s [what]"? A) Tail 🐕 B) Nose 👃 C) Bone 🦴 D) C*ck🍆 Take the quiz below to find out @languagetrivia#punctuation#symbol#slang

GitHub Trends

@githubtrending · Post #14743 · 23.05.2025 г., 14:00

#javascript#ecmascript_proposals#es2015#es2019#es6#es7#esnext#javascript#js#polyfill#ponyfill#promise#proposal#proposals#shim#symbol#weakmap core-js is a modular JavaScript library that provides polyfills for modern ECMAScript features up to 2024, including promises, symbols, collections, iterators, typed arrays, and many web standards like URL and structuredClone. It lets you use new JavaScript features in older browsers by loading only the needed parts without polluting the global namespace. It integrates well with tools like Babel and swc for optimized polyfilling. This helps you write modern, compatible code that runs smoothly across different environments, improving development efficiency and user experience. You can customize polyfill usage and even build your own tailored version for your project. https://github.com/zloirock/core-js