In general, the semantics of the Scala Native language are the same as Scala on the JVM. However, a few differences exist, which we mention here.
NUMERALS = [
'zero',
'one',
'two',
...
]
def numeral2number(numeral):
return NUMERALS.index(numeral.lower)
NUMERALS = {
'zero': 0,
'one': 1,
'two': 2,
...
}
def numeral2number(numeral):
return NUMERALS.get(numeral.lower)
class MyConsumer(AsyncWebsocketConsumer):
async def disconnect(self, close_code):
# соединение закрылось
First, it always recompiles and does not store the result for the module that’s loaded directly from the command line.
python test.py
, то неважно есть ли test.pyc. А если test.py будет импортироваться из другого скрипта или интерактивного сеанса интерпретатора, то будет загружена скомпилированная версия из кэша. Second, it does not check the cache if there is no source module.
To support a non-source (compiled only) distribution, the compiled module must be in the source directory and there must not be a source module.