Skip to content

v0.9.7: more builtins, libs; support triple py sugar

Compare
Choose a tag to compare
@litlighilit litlighilit released this 02 Mar 10:40
· 222 commits to master since this release

Full Changelog: v0.9.5...v0.9.7

break

  • nitertools -> n_itertools; use openArray over seq

Bug Fixes

  • sorted not compile for ptr list, etc and for generics seq
  • complex(int,int) not compile
  • datetime.timedelta not compile
  • Lib/errno cannot be compiled in Windows (931a9f5)
  • except claude with no exception type (e.g. except:) crashes compiler
  • Lib/platform: machine() result fixed for some arch; closes #48
  • pass expr was supported instead of pass (:use discard expr instead)
  • zip: support no-seq args and any number of args over only 2; allow non-static strict
  • triple strlit won't be escape-translated
  • except with no exc type (e.g. except:) not compile

Fixes for inconsistence with Python

  • zip: not compile Iterable[T] (T differs each other)
  • builtins.round(float[, n]) not to-even
  • str(Inf) -> Infinity when JS (#44)
  • int(char) err msg differs py's
  • pass expr was supported instead of pass (:use discard expr instead)
  • zip: support no-seq args and any number of args over only 2; allow non-static strict
  • triple strlit won't be escape-translated
  • except with no exc type (e.g. except:) not compile

Feature additions

Lib

  • collections.abc: include iters, collections, asyncs, generators
  • bisect and n_bisect
  • random (all func besides randint,seed,choice,Random)
  • itertools.accumulate
  • os.urandom, os.getrandom
  • builtins

builtins

  • print: allow `end` along with endl for keyword
  • allow items(tuple)
  • max/min supports iterable & keywords
  • format
  • dir
  • literal will be automatically interpreted as Py list/set/dict/str
  • support __getitem__, __setitem__ and __delitem__ syntax (e.g. ls[1:3])
  • strlitCat in def (e.g. "asds" "sad")

in def (func body)

  • support equal sign minus like x=-1/x==-1
  • literal will be automatically interpreted as Py list/set/dict/str
  • support __getitem__, __setitem__ and __delitem__ syntax (e.g. ls[1:3])
  • strlitCat in def (e.g. "asds" "sad")

EXT

  • @ for Sequence
  • bytes: init from openArray[uint8] or Iterable[SomeInteger]
  • nextImpl

inner

  • Objects/obmalloc.nim: pyalloc pyfree
  • /pyconfig:
    • pycore/pymath
    • c_defined, py_getrandom
  • os_impl.platformAvailWhen
  • doc(pylib.nim): add version info in doc output

Patches for Nim-compatibility

  • newUninit for nim before 2.1.1

CI

  • update actions/cache@v2 to v4
  • mv tfloat.nim tests tests/testament
  • add tests/testament
  • doc will be deployed to docs.nimpylib.org

impr

  • faster int(char)
  • numTypes.floats: use faster isfinite from isX
  • tonim: no list will be initialized when unpacking an array
  • print: sep,endl's default value is now char over string