Skip to content

Instantly share code, notes, and snippets.

@squirrel532
Last active November 9, 2015 17:43
Show Gist options
  • Save squirrel532/929ddb71f68a849e9574 to your computer and use it in GitHub Desktop.
Save squirrel532/929ddb71f68a849e9574 to your computer and use it in GitHub Desktop.

##Python 3.5

  • ASYNC, AWAIT
  • single thread
  • event loop
  • taskqueue celery == asyncio

Type Hit

  • It's just a hint, a comment, let your code be self-documenting.
    def func(x: int, y: int) -> bool:
        return x < y 
  • use mypy test.py check types.
  • can use another file *.pyi to store the hint.

PEP465 - @ operator

  • This still don't be implemented in stdlib, we need to overwrite it by ourselves.
  • simplize the expression
  • It tooks 7 years to accept this operator.

PEP448

default = {...}
overwrite = {...}
d = {**default, **overwrite}

joint = [*a, *b, *c] # a,b ,c are iterable object.

subprocess

r = sp.run(['ls', '-a']) # CompletePrecess Object.
r.check_returncode()

byteformating

  • no .format()
  • use str, byte is for low level work.
  • .fromhex()

about python on windows

Python3.5 won't support Windows XP

  • Embedded version only for Windows(without pip, vs runtime).
  • we should ncapesule thard-party librery by ourselves.

PEP428 - pathlib

os.path is old and hard to use.

For example, Path.home() can get the home directory, and also it can be sended to open() to open a file.

BT / BLE / 藍牙

  • 藍牙 (O) 藍芽 (X)
  • bluetooth SIG is expensive ($ 6000 per device, $8000 a year for membership fee).
  • Both WiFi, Bluetooth are using 2.4GHz (ISM band).
  • Different from huge band width of Wifi, BT's band width is 2M * 40 channels.
  • BlueZ, hciconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment