PYTHON_TG Telegram 2704
Вопрос с собеседования

Какие объекты можно положить в множество?

Ответ: В Python множество (set) может содержать только хешируемые (то есть неизменяемые) объекты. Это означает, что в set можно положить числа, строки, кортежи (если все их элементы тоже хешируемы), булевы значения и другие неизменяемые типы.

Объекты типа list, dict, set и другие изменяемые структуры — положить нельзя: они не имеют хеш-функции (__hash__) и вызовут ошибку TypeError.


tags: #собеседование

Python Developer | Чат
Please open Telegram to view this post
VIEW IN TELEGRAM



tgoop.com/python_tg/2704
Create:
Last Update:

Вопрос с собеседования

Какие объекты можно положить в множество?

Ответ: В Python множество (set) может содержать только хешируемые (то есть неизменяемые) объекты. Это означает, что в set можно положить числа, строки, кортежи (если все их элементы тоже хешируемы), булевы значения и другие неизменяемые типы.

Объекты типа list, dict, set и другие изменяемые структуры — положить нельзя: они не имеют хеш-функции (__hash__) и вызовут ошибку TypeError.


tags: #собеседование

Python Developer | Чат

BY Python Developer


Share with your friend now:
tgoop.com/python_tg/2704

View MORE
Open in Telegram


Telegram News

Date: |

Telegram is a leading cloud-based instant messages platform. It became popular in recent years for its privacy, speed, voice and video quality, and other unmatched features over its main competitor Whatsapp. Add up to 50 administrators You can invite up to 200 people from your contacts to join your channel as the next step. Select the users you want to add and click “Invite.” You can skip this step altogether. On Tuesday, some local media outlets included Sing Tao Daily cited sources as saying the Hong Kong government was considering restricting access to Telegram. Privacy Commissioner for Personal Data Ada Chung told to the Legislative Council on Monday that government officials, police and lawmakers remain the targets of “doxxing” despite a privacy law amendment last year that criminalised the malicious disclosure of personal information. Matt Hussey, editorial director of NEAR Protocol (and former editor-in-chief of Decrypt) responded to the news of the Telegram group with “#meIRL.”
from us


Telegram Python Developer
FROM American