Вторая по частоте future-функция, которую я использовал, это абсолютный импорт
from __future__ import absolute_import
Что она делает?
Изменения, которые вносит эта инъекция описаны в PEP328
Покажу простой пример.
Допустим, есть такой пакет:
/my_package
/__init__.py
/main.py
/string.py
Смотрим код в my_package/main.py
# main.py
import string
Простой пример готов) Вопрос в том, какой модуль импортируется в данном случае? Есть два варианта:
1. модуль в моём пакете my_package.string
2. стандартный модуль string
И вот тут вступает в дело приоритет импортов. В Python2 порядок следующий: помимо иных источников, раньше ищется модуль внутри текущего пакета, а потом в стандартных библиотеках. Таким образом мы импортнём my_package.string.
Но в Python3 это поведение изменилось. Если мы указываем просто имя пакета, то ищется именно такой модуль, игнорируя имена в текущем пакете. Если мы хотим импортнуть именно подмодуль из нашего пакета то, мы должны теперь явно это указывать.
from my_package import string
или относительный импорт, но с указанием пути относительно текущего модуля main
from . import string
Еще одной неоднозначностью меньше 😎
Подробней про импорты здесь:
https://docs.python.org/3/tutorial/modules.html
#2to3#pep#basic
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
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.
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
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
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
#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