Функция hash() в Python позволяет вычислять хеш-значения для различных объектов. Обычно для целых чисел хеш совпадает с их значением, но есть исключения, которые могут удивить даже опытных программистов.
Разбираем, почему hash(-1) и hash(-2) в CPython возвращают одинаковое значение. Рассмотрим особенности работы hash(), внутреннюю реализацию хэширования целых чисел и причину специальной обработки -1.
Вопрос:
Что выведет функция hash() для следующих значений: 1, 0, -1, -2?
Indonesian netizens are highly active, frequently commenting, sharing, and turning local videos into national trends. 2. Platforms Dominating Indonesian Popular Videos
Furthermore, the rapid infrastructure expansion of 4G and 5G networks, paired with highly affordable mobile data plans, has democratized internet access outside the main island of Java. For millions of Indonesians, smartphones are not just communication tools; they are the primary window to entertainment, bypassing traditional television entirely. Dominant Genres in Indonesian Popular Videos
The Indonesian entertainment landscape is heavily shaped by pioneering creators who have built media empires from their digital roots.
The daily lives of Indonesia’s top celebrities and digital influencers generate constant traffic. Family vlogs detailing luxury lifestyles, high-production prank videos, and heartwarming social experiments that highlight charity and community support are staples of the Indonesian YouTube ecosystem. The Rise of Digital Megastars
Despite its explosive growth, the industry faces significant hurdles. For millions of Indonesians, smartphones are not just
While the global internet relies on a standard suite of apps, the platform dynamics in Indonesia have distinct frontrunners:
Music is a massive driver of video views in Indonesia. Dangdut , a genre of Indonesian folk and traditional popular music, has evolved into Dangdut Koplo —a faster, digitized version featuring heavy percussion. Videos of live performances, localized street dances, and acoustic covers of pop songs with a traditional Javanese or Sundanese twist regularly accumulate tens of millions of views within days of release. 4. Daily Vlogs and "Settingan" (Staged Reality)
Maaf — saya tidak bisa membantu membuat, mencari, atau menyediakan konten pornografi, eksploitasi seksual, atau materi yang menampilkan orang di bawah umur atau yang tampak di bawah umur. Itu termasuk permintaan untuk "bokep" atau istilah serupa.
The Indonesian entertainment landscape in 2026 is a vibrant mix of high-production cinema, viral digital creators, and a booming streaming market. Indonesia has surpassed 80% internet penetration, with over 180 million active social media users driving trends Campaign Brief Asia 🎬 Top Movies & Cinema (2026) Indonesian cinema is currently dominated by Horror-Comedy Family Drama with artists like: On TikTok
Content centered around family dynamics, respecting elders, and the annual holiday migration ( Mudik ) always resonates deeply. Emotional storytelling that highlights community warmth or bittersweet family moments consistently goes viral. Street Food and Mukbang Culture
Indonesia’s entertainment landscape is heavily defined by its massive consumption of online video content. Platforms like YouTube and TikTok are not just entertainment hubs; they are cultural touchstones that dictate what goes viral across Southeast Asia.
You cannot discuss without acknowledging the massive influence of Korean pop culture. However, local producers have brilliantly localized this trend. Bands and soloists like Rossa , Juicy Luicy , and Rizky Febian dominate YouTube Trending.
However, the industry is not without its dark side. The term has become a buzzword regarding viral videos. The pressure to create viral content often leads creators to engage in dangerous pranks, immoral challenges, or the invasion of privacy. The Indonesian public and government bodies, such as the Broadcasting Commission (KPI), are currently engaged in a debate about where to draw the line between entertainment and ethical boundaries. such as the Broadcasting Commission (KPI)
Games like Mobile Legends: Bang Bang (MLBB) and PUBG Mobile are national pastimes. Esports tournaments pack out physical stadiums and draw millions of concurrent viewers on YouTube and Facebook Gaming. Highlights of clutch plays, tournament dramas, and pro-player vlogs are staples of the trending page.
Indonesian music has gained significant traction worldwide, with artists like:
On TikTok, where trends are born and die in days, the top creators command audiences of staggering size. currently holds the crown with 86.66 million followers, followed closely by Vilmei with 71.84 million and Ria Ricis with 53.85 million. These influencers are masters of engagement, with many achieving rates above 5%. The platform's explosive growth as a news source is also notable, with its usage rising from 11% in 2021 to 34% in 2025, solidifying its role as a key information hub for Indonesians.
Comedians like , Mamang Kesbor , and Bintang Emon utilize Instagram Reels and YouTube Shorts to deliver sharp, observational humor that resonates deeply with the "Sandwich Generation" (young adults stuck between caring for parents and children) and the struggles of modern dating.
Content is moving away from being strictly Jakarta-centric. Creators from Sumatra, Sulawesi, and Eastern Indonesia are gaining massive traction by showcasing their unique cultures, languages, and landscapes.
hash() может показаться незначительной, важно помнить о ней при работе с хэш-функциями и структурами данных, основанных на хэшировании. В большинстве случаев вы не столкнетесь с проблемами, но знание этой детали поможет вам избежать потенциальных ошибок и лучше понимать внутреннее устройство Python.Ключевые выводы:
Для небольших целых чисел в Python используется оптимизация (интернирование).
hash(x) == x для большинства целых чисел, но hash(-1) == -2 из-за внутренней реализации и для предотвращения коллизий.
Это поведение является специфичным для CPython и может отличаться в других реализациях Python (например, PyPy).
Используйте == для сравнения значений и is для сравнения идентичности объектов.
Надеюсь, теперь эта загадка с hash(-1) стала немного понятнее!
hash(-1) всегда возвращает -2, поэтому hash(-1) == hash(-2).__hash__() в пользовательских классах.