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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #60 · 31 мар.

Вторая по частоте 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

Резултати

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

Пребарај: #ppod

当前筛选 #ppod清除筛选
EverythingScience

@EverythingScience · Post #4991 · 11.12.2025 г., 21:06

#PPOD: Titan's Surface 🌕 The atmosphere of Titan, one of Saturn’s moons, appears similar to that on Earth about 3.5 billion years ago, before life appeared. After a seven-year journey on board the Cassini spacecraft, ESA’s Huygens probe reached Titan’s surface, marking the most distant landing ever achieved by a spacecraft. During the descent, its cameras collected data on the dense atmosphere and took the first-ever images of the surface. These revealed an extraordinary world with lakes, islands, and erosion features similar to those that shape our planet, confirming that liquid methane once flowed there. Methane on Titan is found in liquid form, not as a gas, due to the intense pressure and cold temperatures, about –180° C. Credit: esaNASA Source: @SETIInstitute @EverythingScience

Hashtags

EverythingScience

@EverythingScience · Post #4944 · 02.12.2025 г., 22:00

#PPOD: Deimos Before Sunrise 🌄 NASAPersevere captured this view of Deimos, the smaller of Mars' two moons, shining in the sky at 4:27 a.m. local time on March 1, 2025, the 1,433rd Martian day, or sol, of the mission. In the dark before dawn, the rover's left navigation camera used its maximum long-exposure time of 3.28 seconds to capture 16 individual shots, which were combined into a single image that was later sent to Earth. In total, the image represents an exposure time of about 52 seconds. The low light and long exposures add digital noise, making the image hazy. Many of the white specks seen in the sky are likely noise; some may be cosmic rays. Two of the brightest white specks are Regulus and Algieba, stars that are part of the constellation Leo. "Woodstock Crater," at center right, is roughly a half-mile (750 meters) away from the rover. At the time, Perseverance was en route to "Witch Hazel Hill." Credit: NASANASAJPLCaltech Source: @SETIInstitute @EverythingScience

Hashtags

EverythingScience

@EverythingScience · Post #4877 · 23.11.2025 г., 06:55

#PPOD: The Eye of the Crater 👁️ A vast cavity on the Red Planet looks back at ESA TGO with an icy stare. The crater is located in Utopia Planitia, the largest known impact basin in the Solar System, with a diameter of roughly 3,300 km, or twice the size of Earth’s Sahara Desert from north to south. This remnant of an ancient impact is just one of the many scars asteroids have inflicted upon the Red Planet. Water, volcanoes, and impacts from asteroids shaped the Martian surface in the ancient past. Mars is currently a cold, dry desert. This view from CaSSIS shows a crater approximately eight kilometres in diameter with material ejected in a manner that scientists believe suggests the presence of water ice. When the asteroid hit this region of Mars, the water ice melted, and a mix of liquid water and dust rock was propelled from the top layers. The smooth appearance of the crater is consistent with other features in the region, which have evidence of a water-ice history. Zooming into the crater, it is possible to see streaks on the walls of the crater, showing evidence of landslides, and ripples sculpted by the wind. Credit: ESA/ TGO/CaSSIS Source: @SETIInstitute @EverythingScience

Hashtags

EverythingScience

@EverythingScience · Post #4724 · 30.10.2025 г., 00:40

#PPOD: Mar­tian Win­ter Won­der­land ❄️ This sweeping view along a rusty red ridge and into a crater showcases the exquisite beauty of icy, layered terrain in the south polar region on Mars. The High Resolution Stereo Imaging camera onboard ESA’s Mars Express captured this frosty scene in the Ultimi Scopuli region near the south pole of Mars on 19 May 2022. At this time, it was southern hemisphere spring, and ice was starting to retreat. Dark dunes began to peak through the frost, and the elevated terrain appears ice-free. Credit: esaDLR enFU Berlin Source: @SETIInstitute @EverythingScience

Hashtags

EverythingScience

@EverythingScience · Post #5111 · 16.01.2026 г., 03:10

#PPOD: Neptune 🔵 NASAVoyager 2 made its closest approach to #Neptune in 1989, flying by 4,950 km above its cloud tops. It is still the only spacecraft to have visited the planet! The mission revealed 6 new moons, rings, and geysers erupting from the moon Triton. This Voyager 2 image of Neptune, processed by Kevin Gill, was captured on Aug. 31, 1989. Credit: NASANASAJPLCaltech / Kevin M. Gill Source: @SETIInstitute @EverythingScience

EverythingScience

@EverythingScience · Post #5078 · 06.01.2026 г., 19:10

#PPOD: Curiosity Sends Holiday Postcard from #Mars🌄 Team members working with NASA’s MarsCuriosity created this “postcard” by commanding the rover to take images at two times of day on Nov. 18, 2025, spanning the 4,722nd and 4,723rd Martian days, or sols, of the mission. The panoramas were captured at 4:15 p.m. on Sol 4,722 and 8:20 a.m. on Sol 4,723 (both at local Mars time), then merged together. Color was later added for an artistic interpretation of the scene, with blue representing the morning panorama and yellow representing the afternoon one. The resulting “postcard” is similar to ones the rover took in June 2023 and November 2021. Adding color to these kinds of merged images helps different details stand out in the landscape. Credit: NASANASAJPLCaltech Source: @SETIInstitute @EverythingScience

Hashtags