Jinja2 Documentation Release 2.10
documentation is written with Python 2 in mind, so you will have to adapt the shown code examples to Python 3 syntax for yourself. 5 6 CHAPTER 2 API This document describes the API to Jinja2 and not the template provided, errors are logged. If you want template syntax errors to abort the compilation you can set ignore_errors to False and you will get an exception on syntax errors. If py_compile is set to True .pyc files 3. Filters and tests are looked up in separate namespaces and have slightly modified identifier syntax. Filters and tests may contain dots to group filters and tests by topic. For example it’s perfectly0 码力 | 148 页 | 475.08 KB | 1 年前3Mypy 1.10.0+dev Documentation
not at runtime Using types defined in stubs but not at runtime Using generic builtins Using X | Y syntax for Unions Using new additions to the typing module Protocols and structural subtyping Predefined Type Guards Limitations Duck type compatibility Stub files Creating a stub Stub file syntax Using stub file syntax at runtime Generics Defining generic classes Defining subclasses of generic classes Literal types and Enums Literal types Enums TypedDict Totality Supported operations Class-based syntax Mixing required and non-required items Unions of TypedDicts Final names, methods and classes Final0 码力 | 318 页 | 270.84 KB | 1 年前3Mypy 1.8.0 Documentation
not at runtime Using types defined in stubs but not at runtime Using generic builtins Using X | Y syntax for Unions Using new additions to the typing module Protocols and structural subtyping Predefined Type Guards Limitations Duck type compatibility Stub files Creating a stub Stub file syntax Using stub file syntax at runtime Generics Defining generic classes Defining subclasses of generic classes Literal types and Enums Literal types Enums TypedDict Totality Supported operations Class-based syntax Mixing required and non-required items Unions of TypedDicts Final names, methods and classes Final0 码力 | 318 页 | 271.55 KB | 1 年前3Mypy 1.8.0 Documentation
varying-length sequences. You can use the type tuple[T, ...] (with a literal ... – it’s part of the syntax) for this purpose. Example: def print_squared(t: tuple[int, ...]) -> None: for n in t: print(n X | Y syntax for Unions PEP 604 introduced an alternative way for spelling union types. In Python 3.10 and later, you can write Union[int, str] as int | str. It is possible to use this syntax in versions Argument has incompatible type "str"; expected "int" Python 3.6 introduced an alternative, class-based syntax for named tuples with types: from typing import NamedTuple class Point(NamedTuple): x: int y: int0 码力 | 234 页 | 902.89 KB | 1 年前3Mypy 1.10.0+dev Documentation
varying-length sequences. You can use the type tuple[T, ...] (with a literal ... – it’s part of the syntax) for this purpose. Example: def print_squared(t: tuple[int, ...]) -> None: for n in t: print(n X | Y syntax for Unions PEP 604 introduced an alternative way for spelling union types. In Python 3.10 and later, you can write Union[int, str] as int | str. It is possible to use this syntax in versions Argument has incompatible type "str"; expected "int" Python 3.6 introduced an alternative, class-based syntax for named tuples with types: from typing import NamedTuple class Point(NamedTuple): x: int y: int0 码力 | 234 页 | 913.89 KB | 1 年前3Objeet Oriented Python Tutorial
FEATURES ................................................................................. 60 Core Syntax in our Class design ............................................................................ the case of the dictionary, the key is a string and the syntax is [key]. In the case of the module, the key is an identifier, and the syntax is .key. Classes are like Modules Module is a specialized light weight code-centric text editor will do. Also many text editors offer features such as syntax highlighting and in-program script execution, similar to IDEs. Some of the text editors are given0 码力 | 111 页 | 3.32 MB | 1 年前3Django 1.11.x Documentation
template layer The template layer provides a designer-friendly syntax for rendering the information to be presented to the user. Learn how this syntax can be used by designers and how it can be extended by programmers: object-relational mapper in which you describe your database layout in Python code. The data-model syntax offers many rich ways of representing your models – so far, it’s been solving many years’ worth of argument: regex The term “regex” is a commonly used short form meaning “regular expression”, which is a syntax for matching patterns in strings, or in this case, url patterns. Django starts at the first regular0 码力 | 1878 页 | 6.40 MB | 1 年前3Django 1.11.x Documentation
template layer The template layer provides a designer-friendly syntax for rendering the information to be presented to the user. Learn how this syntax can be used by designers and how it can be extended by programmers: object-relational mapper in which you describe your database layout in Python code. The data-model syntax offers many rich ways of representing your models – so far, it’s been solving many years’ worth of argument: regex The term “regex” is a commonly used short form meaning “regular expression”, which is a syntax for matching patterns in strings, or in this case, url patterns. Django starts at the first regular0 码力 | 2747 页 | 2.67 MB | 1 年前3Django 2.2.x Documentation
template layer The template layer provides a designer-friendly syntax for rendering the information to be presented to the user. Learn how this syntax can be used by designers and how it can be extended by programmers: object-relational mapper in which you describe your database layout in Python code. The data-model syntax offers many rich ways of representing your models – so far, it’s been solving many years’ worth of %}- {{ choice.choice_text }}
{% endfor %} The template system uses dot-lookup syntax to access variable attributes. In the example of {{ question.question_text }}, first Django does0 码力 | 2915 页 | 2.83 MB | 1 年前3Django 2.1.x Documentation
template layer The template layer provides a designer-friendly syntax for rendering the information to be presented to the user. Learn how this syntax can be used by designers and how it can be extended by programmers: object-relational mapper in which you describe your database layout in Python code. The data-model syntax offers many rich ways of representing your models – so far, it’s been solving many years’ worth of all %}- {{ choice.choice_text }}
{% endfor %} The template system uses dot-lookup syntax to access variable attributes. In the example of {{ question. question_text }}, first Django does0 码力 | 1910 页 | 6.49 MB | 1 年前3
共 431 条
- 1
- 2
- 3
- 4
- 5
- 6
- 44