#146 Slay the dragon, learn the Python
Python Bytes - Un pódcast de Michael Kennedy and Brian Okken - Lunes
Categorías:
Sponsored by DigitalOcean: pythonbytes.fm/digitalocean
Special guest: Trey Hunner
Brian #1: Positional-only arguments in Python
- by Sanket
- Feature in 3.8
- “To specify arguments as positional-only, a
/
marker should be added after all those arguments in the function definition. “ - Great example of a
pow(x, y, /, mod=None)
function where the namesx
andy
are meaningless and if given in the wrong order would be confusing.
Trey #2: django-stubs
- Type checking for Django!
- It’s new and from my very quick testing on my Django site it definitely doesn’t work with everything yet, but it’s promising
- I don’t use type annotations in Django yet, but I very well might eventually
Michael #3: CodeCombat
- Super fun game for learning to code
- Real code but incredibly easy coding
- Can subscribe or use the free tier
- Just got $6M VC funding
Brian #4: Four Use Cases for When to Use Celery in a Flask Application
- or really any web framework
- by Nick Janetakis
- “Celery helps you run code asynchronously or on a periodic schedule which are very common things you'd want to do in most web projects.”
- examples:
- sending emails out
- connecting to 3rd party APIs.
- performing long running tasks. Like, really long.
- Running tasks on a schedule.
Trey #5: pytest-steps
- Created by smarie
- Can use a generator syntax with yield statements to break a big test up into multiple named “steps” that’ll show up in your pytest output
- If one step fails, the rest of the steps will be skipped by default
- You can also customize it to make optional steps, which aren’t required for future steps to run, or steps which depend on other optional steps explicitly
- The documentation shows a lot of different ways to use it, but the generator approach looks by far the most readable to me (also state is shared between steps with this approach whereas the others require some fancy state-capturing object which looks confusing to me)
- I haven’t tried this, but my use case would be my end-to-end/functional tests, which would work great with steps because I’m often using Selenium to navigate between a number of different pages and forms, one click at a time.
Michael #6: docassemble
- Created by Jonathan Pyle
- A free, open-source expert system for guided interviews and document assembly, based on Python, YAML, and Markdown.
- Features
- WYSIWYG: Compose your templates in .docx (with help of a Word Add-in) or .pdf files.
- Signatures: Gather touchscreen signatures and embed them in documents.
- Live chat: Assist users in real time with live chat, screen sharing, and remote screen control.
- AI: Use machine learning to process user input.
- SMS: Send text messages to your users
- E-mail: Send and receive e-mails in your interviews.
- OCR: Use optical character recognition to process images uploaded by the user.
- Multilingual: Offer interviews in multiple languages.
- Multiuser: Develop applications that involve more than one user, such as mediation or counseling interviews.
- Extensible: Use the power of Python to extend the capabilities of your interviews.
- Open: Package your interviews and use GitHub and PyPI to share your work with the docassemble user community.
- Background Tasks: Do things behind the scenes of the interview, even when the user is not logged in.
- Scalable: Deploy your interviews on multiple machines to handle high traffic.
- Secure: Protect user information with server-side encryption, two-factor authentication, document redaction, and other security features.
- APIs: Integrate with third-party applications using the API, or send your interviews input and extract output using code.
Extras
Michael:
Joke
via Avram Lubkin
Knock! Knock! Who's there? Recursive function. Recursive function who? Knock! Knock!
Nice. to get that joke, you’ll have to understand recursion. to understand recursion,
- either google “recursion”, and click on “did you mean “recursion””
- learn it in small steps. step one, recursion
text conversation:
- first person: “Hey, what’s your address?”
- second: gives IP address
- first: “No. Your local address”
- second: 127.0.0.1
- first: “No. Your physical address”
- second: gives MAC address