Telegram Group & Telegram Channel
Что выведет этот код?

Строки длиной до 4096 (до версии 3.7 длиной до 21) кэшируются.
s1 = "a" * 4096
s2 = "a" * 4096

print(s1 is s2) # True

s1 = "a" * 4097
s2 = "a" * 4097

print(s1 is s2) # False


Строки не кэшируются, если они созданы в рантайме:
s1 = "python"
s2 = "".join(["p", "y", "t", "h", "o", "n"]) # выражение выполняется в рантайме

print(s1 is s2) # False


Так же следует понимать, что это может поменяться в любой момент и лучше сравнивать строки через ==, а не через is.

#string #строки



tg-me.com/pythrone/9
Create:
Last Update:

Что выведет этот код?

Строки длиной до 4096 (до версии 3.7 длиной до 21) кэшируются.
s1 = "a" * 4096
s2 = "a" * 4096

print(s1 is s2) # True

s1 = "a" * 4097
s2 = "a" * 4097

print(s1 is s2) # False


Строки не кэшируются, если они созданы в рантайме:
s1 = "python"
s2 = "".join(["p", "y", "t", "h", "o", "n"]) # выражение выполняется в рантайме

print(s1 is s2) # False


Так же следует понимать, что это может поменяться в любой момент и лучше сравнивать строки через ==, а не через is.

#string #строки

BY PyThrone




Share with your friend now:
tg-me.com/pythrone/9

View MORE
Open in Telegram


PyThrone Telegram | DID YOU KNOW?

Date: |

The messaging service and social-media platform owes creditors roughly $700 million by the end of April, according to people briefed on the company’s plans and loan documents viewed by The Wall Street Journal. At the same time, Telegram Group Inc. must cover rising equipment and bandwidth expenses because of its rapid growth, despite going years without attempting to generate revenue.

Dump Scam in Leaked Telegram Chat

A leaked Telegram discussion by 50 so-called crypto influencers has exposed the extraordinary steps they take in order to profit on the back off unsuspecting defi investors. According to a leaked screenshot of the chat, an elaborate plan to defraud defi investors using the worthless “$Few” tokens had been hatched. $Few tokens would be airdropped to some of the influencers who in turn promoted these to unsuspecting followers on Twitter.

PyThrone from ms


Telegram PyThrone
FROM USA