Python type hints allow annotating function and variable types in Python code. They were introduced in PEP 484 for Python 3.5 and provide documentation of types without runtime enforcement. Using type hints and tools like mypy enables type checking of code without execution, improving code quality and readability. They help with code completion, refactoring Python 2 code to Python 3, and catching type errors during development.
The document discusses a presentation on the benefits of type hints in Python. It provides an outline of the presentation which includes an introduction to type hints, how to use type hints, and the benefits of type hints. Some key benefits mentioned are improved code completion, the ability to catch type errors without running code, and using type hint tools for static type analysis.
Build a RESTful API with the Serverless Frameworkmasahitojp
The document discusses how to build a RESTful API using the Serverless framework on AWS. It introduces the Amazon API Gateway for creating API endpoints and AWS Lambda for hosting backend functions. The Serverless framework simplifies deploying Lambda functions by packaging code and dependencies, testing functions locally, and deploying with a single command. It also addresses challenges like installing Python libraries and supporting non-Python modules through Docker.
The document discusses using Python with AWS Lambda. It introduces serverless frameworks like AWS Lambda, Google Cloud Functions, and Microsoft Azure Functions. It then focuses on using Python with AWS Lambda, including how to package dependencies, deploy code, and leverage the Serverless framework to simplify deployments. Logging to CloudWatch Logs and adding unit tests are also covered.
The speaker discussed the benefits of type hints in Python. Type hints allow specifying the expected types of function parameters and return values, improving code readability, enabling code completion in editors, and allowing static type checking tools to analyze the code for type errors. The speaker demonstrated how to write type hints according to PEP 484 and PEP 526 standards and how to retrieve type information. Tools like Mypy were presented for doing static type analysis to catch errors. Using type hints and type checkers in continuous integration was recommended to catch errors early when collaborating on projects. The speaker concluded by explaining how using type hints made it easier for their team to port code from Python 2 to Python 3.
Pyston is a JIT-based implementation of Python 2.7 built using LLVM. It compiles Python code to LLVM IR for optimization and execution via LLVM's JIT engine. Current benchmarks show recursion sees benefits from LLVM JIT, while loops do not, and the implementation is missing major parts of the Python language. Future versions aim to add exceptions, classes, arguments and more.
This document discusses Play! Scala, a framework that allows building web applications in Scala on the Play! platform. It can use Scala instead of Java for the Play! framework. Anorm is used to interact with databases instead of JPA/Hibernate. Play! Scala applications can be deployed to PaaS platforms like Heroku and CloudBees. The document provides links for documentation, mailing lists and the GitHub repository for further information.
44. コメントを書こう
• 何を実装しようとしてたか忘れるよね
• Whyとかを書いとくと後々思い出しやすくなりますよね
def _service_json_to_dict(service_dict) -> Dict[TypetalkPlan, int]:
# service_json format is too strange, I'd like to change simple Dict
# e.g. [{"key": [“ham”], "value": 7}, {"key": [“spam”], "value": 1}]
result: Dict[TypetalkPlan, int] = dict()
for m in mixpanel_dict:
key = m['key'][0]
value = m['value']
result[key] = value
return result