15.07.2021       Выпуск 395 (12.07.2021 - 18.07.2021)       Вопросы и обсуждения

Python Bytes: #242 from lib import * but less



Экспериментальная функция:

Ниже вы видите текст статьи по ссылке. По нему можно быстро понять ссылка достойна прочтения или нет

Просим обратить внимание, что текст по ссылке и здесь может не совпадать.

Watch the live stream:

About the show

Sponsored by us:

Special guest: Al Sweigart

Brain #1: just

  • From a tweet by Jeff Triplett
  • just is a handy way to save and run project-specific commands.
  • Commands, called recipes, are stored in a file called justfile with syntax inspired by make
  • Just is a command runner, not a build system, so it avoids much of Make’s complexity and idiosyncrasies. No need for .PHONY recipes!
  • Linux, MacOS, and Windows are supported with no additional dependencies.”
  • It’s written in Rust.
  • My favorite differences:
like Python
      echo "Hello World!"

      #!/usr/bin/env python3
      print('Hello from python!')

Michael #2: Strong Typing

  • via Roman Right (Beanie)
  • Decorator which checks whether the function is called with the correct type of parameters.
  • Decorator which checks at Runtime whether the function is called with the correct type of parameters.
  • Raises TypeMisMatch if the used parameters in a function call where invalid.

Al #3:

Brian #4: testbook

    def foo(a, b):
       return a + b
    from testbook import testbook

    @testbook('foo.ipynb', execute=True)
    def test_foo(tb):
       foo = tb.ref("foo")
       assert foo(1, 2) == 3

Michael #5: auto-all

  • Automatically manage the __all__ variable in Python modules.
    • Easily populate the __all__ variable in modules.
    • Easily exclude imported objects
    • Clearly differentiate between internal and external facing objects.
    • Use simple, intuitive code.
    • Never worry about forgetting to add new objects to __all__.
    • Help Python IDE's differentiate between internal and external facing objects.
  • Can use “regions” via start_all() and end_all()
  • I prefer the decorator (functions only, seems ripe for a PR for classes)
    def a_public_function():

Al #6:




Разместим вашу рекламу

Пиши: mail@pythondigest.ru

Нашли опечатку?

Выделите фрагмент и отправьте нажатием Ctrl+Enter.

Система Orphus