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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #156 · 2 окт.

Те, кто в Python не первый день, хорошо знают, что на число можно умножить не только число, но и другие типы. Главное, чтобы у этих типов была реализация такой операции. # list >>> [1] * 3 [1, 1, 1] # tuple >>> (2, 3) * 3 (2, 3, 2, 3, 2, 3) # string >>> "A" * 3 "AAA" Так работает полиморфизм стандартных типов. Интересно здесь то, что это сработает и в том случае, когда порядок операндов обратный. То есть int умножить на [тип]. # list >>> 3 * [1] [1, 1, 1] # tuple >>> 3 * (2, 3) (2, 3, 2, 3, 2, 3) # string >>> 3 * "A" "AAA" Если хотите реализовать такое поведение в ваших классах то следует помнить два момента: 1. Если множитель справа, то вам нужно реализовать метод __mul__, наш класс это первый операнд, то есть слева. myType * 3 2. Если множитель слева, то вам нужно реализовать метод __rmul__, наш класс это второй операнд, справа. 3* myType Всё тоже самое можно делать и для других математических операторов. И если в этом примере действие и результат будут фактически одинаковыми, то бывают ситуации, когда это не так. Например, при умножении матриц имеет значение порядок операндов. Для других операторов, таких как деление или сдвиг, очень важно кто с какой стороны находится. >>> 2/4, 4/2 (0.5, 2.0) >>> 2<<3, 3<<2 (16, 12) >>> 100%15, 15%100 (10, 15) #tricks#basic

Резултати

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

Пребарај: #lassafever

当前筛选 #lassafever清除筛选

Our #LassaFever situation report for week 1, 2025 has been published. 54 cases have been confirmed and 10 deaths have been recorded across 6 states in Nigeria. 🔗Download, read, and share via https://ncdc.gov.ng/ncdc.gov.ng/themes/common/files/sitreps/1bded1685f8dc4961a169a274be138c2.pdf

Hashtags

Our #LassaFever situation reports for weeks 42, 2024 have been published. The weekly report provides a summary of the #LassaFever epidemiological situation and response activities in Nigeria. 🔗Download, read, and share via https://ncdc.gov.ng/diseases/sitreps/?cat=5&name=An%20update%20of%20Lassa%20fever%20outbreak%20in%20Nigeria

Hashtags

Our #LassaFever situation report for week 40, 2024 has been published. 1025 cases have been confirmed and 174 deaths have been recorded across 28 states in Nigeria. 🔗Download, read, and share via https://ncdc.gov.ng/diseases/sitreps/?cat=5&name=An%20update%20of%20Lassa%20fever%20outbreak%20in%20Nigeria

Hashtags

Our latest #LassaFever situation report shows that 982 confirmed cases and 168 deaths have been recorded in 2024. This loss of lives is not just a number but a significant loss of a family member, friend, colleague or a seasoned healthcare worker CEPI vaccines writes on the critical need for a #LassaFever vaccine to control this disease. 🔗 https://cepi.net/lassa-vaccine-urgently-needed-save-thousands-lives Situation report: https://ncdc.gov.ng/diseases/sitreps/?cat=5&name=An%20update%20of%20Lassa%20fever%20outbreak%20in%20Nigeria

Hashtags

We have published our latest #LassaFever epidemiology data. Here you can find a summary of all the latest figures in our weekly infographic.🔽 The full report can be accessed via 🔗https://ncdc.gov.ng/diseases/sitreps/?cat=5&name=An%20update%20of%20Lassa%20fever%20outbreak%20in%20Nigeria

Hashtags

Our #LassaFever situation report for week 32, 2024 has been published. The weekly report provides a summary of the #LassaFever epidemiological situation and response activities in Nigeria. 🔗Download, read, and share via https://ncdc.gov.ng/diseases/sitreps/?cat=5&name=An%20update%20of%20Lassa%20fever%20outbreak%20in%20Nigeria

Hashtags

Our #LassaFever situation report for week 30, 2024 has been published. The weekly report provides a summary of the #LassaFever epidemiological situation and response activities in Nigeria. 🔗Download, read, and share via https://ncdc.gov.ng/diseases/sitreps/?cat=5&name=An%20update%20of%20Lassa%20fever%20outbreak%20in%20Nigeria

Hashtags

Our #LassaFever situation reports for weeks 28 and 29, 2024 have been published. The weekly report provides a summary of the #LassaFever epidemiological situation and response activities in Nigeria. 🔗Download, read, and share via https://ncdc.gov.ng/diseases/sitreps/?cat=5&name=An%20update%20of%20Lassa%20fever%20outbreak%20in%20Nigeria

Hashtags

Our #LassaFever situation report for week 25, 2024 has been published. The weekly report provides a summary of the #LassaFever epidemiological situation and response activities in Nigeria. 🔗Download, read, and share via https://ncdc.gov.ng/diseases/sitreps/?cat=5&name=An%20update%20of%20Lassa%20fever%20outbreak%20in%20Nigeria

Hashtags

Our #LassaFever situation report for week 24, 2024 has been published. The weekly report provides a summary of the #LassaFever epidemiological situation and response activities in Nigeria. 🔗Download, read, and share via https://ncdc.gov.ng/diseases/sitreps/?cat=5&name=An%20update%20of%20Lassa%20fever%20outbreak%20in%20Nigeria

Hashtags

Our #LassaFever situation report for week 23, 2024 has been published. The weekly report provides a summary of the #LassaFever epidemiological situation and response activities in Nigeria. 🔗Download, read, and share via https://ncdc.gov.ng/diseases/sitreps/?cat=5&name=An%20update%20of%20Lassa%20fever%20outbreak%20in%20Nigeria

Hashtags

Our #LassaFever situation report for week 21, 2024 has been published. The weekly report provides a summary of the #LassaFever epidemiological situation and response activities in Nigeria. 🔗Download, read, and share via https://ncdc.gov.ng/diseases/sitreps/?cat=5&name=An%20update%20of%20Lassa%20fever%20outbreak%20in%20Nigeria

Hashtags

123•••10•••1617
ПретходнаСтраница 1 од 17Следна