@sgmrt · Post #1692 · 07.04.2023 г., 06:47
[CCL]: If you are at #Promenade, #Bayfront or #MarinaBay, you may take the TEL, DTL, or alternative modes of transport. Free regular bus and free bridging bus services are still available. - SMRT
Hashtags
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
Пребарај: #bayfront
@sgmrt · Post #1692 · 07.04.2023 г., 06:47
[CCL]: If you are at #Promenade, #Bayfront or #MarinaBay, you may take the TEL, DTL, or alternative modes of transport. Free regular bus and free bridging bus services are still available. - SMRT
Hashtags
@sgmrt · Post #1467 · 20.06.2022 г., 05:58
[CCL] UPDATE: Shuttle train service is available #Bayfront & #MarinaBay at Platform B. Passengers are advised to use DTL to continue their journey between #Bayfront and #Promenade. - SMRT
Hashtags
@sgmrt · Post #1466 · 20.06.2022 г., 05:43
[CCL]: Due to a track fault, additional 10 mins travelling time between #Promenade & #MarinaBay. Shuttle train service is available #Bayfront & #MarinaBay at Platform B. Passengers are advised to use DTL to continue their journey between #Bayfront and #Promenade. - SMRT
Hashtags
@sgmrt · Post #1690 · 07.04.2023 г., 06:15
[CCL]: Pls add 40mins of train travel time between #DhobyGhaut/#MarinaBay and #Stadium. Commuters are advised to take other lines such as DTL, NSL and NEL if you are at #DhobyGhaut, #MarinaBay, #Promenade or #Bayfront. Free regular bus and free bus bridging svcs are available. - SMRT
@sgmrt · Post #1740 · 23.06.2023 г., 15:33
[CCL] UPDATE: No train service between #Esplanade / #Bayfront and #Mountbatten. Additional 30 minutes between #DhobyGhaut and #Esplanade, #MarinaBay and #Bayfront, and #Mountbatten and #PayaLebar. Please use alternative means of transport to continue your journey. - SMRT
@sgmrt · Post #1738 · 23.06.2023 г., 14:58
[CCL] UPDATE : No train service between #Esplanade / #Bayfront and #Mountbatten. Additional 30 minutes between #DhobyGhaut and #Esplanade, #MarinaBay and #Bayfront, and #Mountbatten and #PayaLebar. - SMRT
@sgmrt · Post #2469 · 01.09.2025 г., 00:49
[CCL] UPDATE: Passengers travelling towards #MarinaBay, please transfer at #DhobyGhaut or #Bishan for the North-South Line, or #Caldecott for the Thomson-East Coast Line. Passengers travelling towards #Bayfront, please transfer at #Promenade or #MacPherson for the Downtown Line. - SMRT