Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
使用描述符进行类型提示
In 这个拉取请求 https github com python mypy pull 2266看起来添加了对描述符的类型提示支持 然而 似乎没有发布最终的 正确 用法示例 也没有添加任何文档到typing module https doc
python
python3x
typehinting
mypy
pythondescriptors
在类定义中使用类自己的类型[重复]
这个问题在这里已经有答案了 以下代码无法按预期工作 显然 我不能在类定义中使用类自己的类型 class Foo def init self key str gt None self key key def eq self other Foo
python
typehinting
mypy
PHP 7 - 不支持声明“strict_types”
我在一个小项目中使用 PHP 7 也在我的本地和生产服务器中使用相同的配置 一切都在我的本地服务器上工作 但在完成 LAMP 设置后在生产服务器上我无法在 etc php 7 0 apache 下找到 apache 文件夹 所以我遇到了内部
php
apache
typehinting
为什么我会收到 mypy no overrides of "zip" matches argument 错误?
我有一个带有方法的类 class TimeUtilitiesTestCase def test date and delta self gt None Tests date and delta utility method now date
python
python3x
typehinting
mypy
具有两个或多个返回参数的函数注释
当我为返回一个参数的函数编写注释时 没有任何问题 def func gt str return ok 但是 当我编写带有两个或更多参数的注释时 我的 PyCharm 给了我SyntaxError invalid syntax def fun
python
python3x
typehinting
数组的类型提示是什么?
对于大多数集合 我们可以这样做 from typing import List Tuple etc 有没有提示array As in arr array array i 正如 Carcigenicate 指出的 您可以使用array arr
python
Arrays
typehinting
Python 模块类型输入
我正在使用动态加载Python模块importlib import module如下 def load module mod name str gt return importlib import module mod name 有人可以告
python
typehinting
pythontyping
如何使用类型提示指定多个返回类型
我在 python 中有一个函数 它可以返回一个bool or a list 有没有办法使用类型提示指定返回类型 例如 这是正确的方法吗 def foo id gt list or bool 从文档中 联合型 https docs pyth
python
python3x
typehinting
returntype
pythontyping
为什么 PHP 中需要类型提示?
我无法理解 PHP 中类型提示的重要性 显然 PHP 中的 类型提示 可以定义如下 类型提示 强制您仅传递特定类型的对象 这可以防止您传递不兼容的值 并创建一个 如果您与团队合作等 则为标准 那么 在最基本的级别上进行类型提示 不需要让代码
php
OOP
typehinting
键入提示 PyCharm 内部使用的类[重复]
这个问题在这里已经有答案了 如何在其内部正确键入一个类 在 PyCharm 中 我当前收到此错误 这是一个未解决的参考错误 这通常是有道理的 因为我不希望 PyCharm 完美支持类型 但是 当我在除课程之外的其他课程中使用它时Item类本
python3x
pycharm
typehinting
python 类型提示不会为错误类型生成错误
我最近正在检查类型提示 在阅读了一些理论后 我尝试了一个简单的示例 如下所示 def myfun num1 int num2 int gt int return str num1 num2 a myfun 1 abc print a out
python3x
typehinting
PHP 返回类型提示,对象还是布尔值? [复制]
这个问题在这里已经有答案了 所以我知道我可以在 php7 中进行返回类型提示 我可以使用以下方法进行对象返回提示 function getUser pdo username User 其中 User 是返回的对象 但是 如果在 SQL 中找
php
php7
typehinting
Django 模型子类的类型提示
我有 Django 视图的辅助函数 如下所示 代码如下 它返回 None 或与给定查询匹配的单个对象 例如pk 1 from typing import Type Optional from django db models import
python
django
pycharm
typehinting
使用函数的返回类型指定类型提示
我想将变量的类型暗示为特定函数的返回类型 无需手动指定函数的返回类型是什么 我无法以可用作另一个变量提示的方式从函数中提取返回值类型 def dostuff gt T StuffContainer namedtuple StuffConta
python
python3x
typehinting
pythontyping
Python 3.5 中的类型提示是什么?
Python 3 5 中最受关注的功能之一是类型提示 一个例子类型提示中提到本文 http lwn net Articles 650904 and this one http lwn net Articles 640359 同时还提到负责任
python
python3x
python35
typehinting
pythontyping
间接参数化时如何注释request.param?
In the 间接参数化示例 https docs pytest org en stable example parametrize html indirect parametrization我想输入提示request param表示特定类
python
Pytest
fixtures
typehinting
Intellisense 无法识别 python 3 的类型提示
我想使用 Visual Studio 并使用类型提示 例如在函数参数列表中 查看智能感知 以确定变量的类型 这可以通过以下方式实现isinstance param type 声明 但我想知道我们是否可以在没有这些附加声明的情况下让它工作 注
VisualStudio
python3x
IntelliSense
typehinting
ptvs
可选类型注释。检查是否为 None 后使用值?
我正在用 python 编写一些带有类型注释的代码 我对可选类型有疑问 例如对于这样的代码 maybe number Optional int definition if maybe number None else I know its
python3x
typehinting
如何向 PyPi 分发类型提示?
我致力于将 Python 3 5 类型提示添加到响应库中 但是当我测试进行分发时 sdist or bdist wheel 它没有安装我的 pyi文件 我可以看到它是发行版的一部分 但仅此而已 您可以在此处查看我在存储库中获得的内容 htt
python
setuptools
typehinting
如何键入提示 getter 仅允许 dict 的键?
我想知道如何使这个 getter 更加类型安全 VALUES 1 One 2 Two 3 Three def get key str gt str return VALUES key 而不是类型str我很想有一个keyof VALUES a
python
typehinting
pythontyping
keyof
«
1
2
3
4
5
6
»