Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
如何使用封闭类的类型键入提示方法?
我在 Python 3 中有以下代码 class Position def init self x int y int self x x self y y def add self other Position gt Position re
python
python3x
pycharm
typehinting
pythontyping
你能提示 PHP 5.2.5 中的返回类型吗?
我认为我的 eclipse 的 ctrl 单击链接可能会受益匪浅 Edit 我正在使用 Eclipse PDT Edit 2 我对使用 return 或 var 语句将文档块放在函数 和变量 之前的解决方案感到非常满意 我刚刚更新了我的应用
php
eclipse
returnvalue
php52
typehinting
python 通用类型提示 + 用户定义的容器 + 约束实现 __add__ 方法的类型
我想在 python 3 8 中以 Lisp 方式实现一个 Liste 类 其中包含 head 和 tail car cdr 和 nil 我想定义一个通用类型 接受 Liste 中类型 T 的对象 from future import an
python
typehinting
abstractdatatype
generictypeargument
Python mypy:float和int是与numbers.Real不兼容的类型
我是 Python 静态类型模块的新手mypy 我试图将整数和浮点数附加到一个数组中 我静态地将其输入为 Real 但mypy说它们是与 Real 不兼容的类型 我认为整数和浮点数是实数的子类型 from typing import Lis
python
typehinting
mypy
pythontyping
Python 是否评估前向引用的类型提示?
我正在查看 PEP 484 部分转发参考文献 https www python org dev peps pep 0484 forward references并注意到以下声明 该定义可以表示为字符串文字 稍后解决 这让我想知道 稍后 是什
python
typehinting
PEP
PHP 对原始值的类型提示?
我想知道是否可以类型提示一种方法来期望原始类型 像这样的事情 public function someMethod string str Or private function anotherMethod int num 就像你会的那样 p
php
primitivetypes
typehinting
在类构造函数中表达兄弟嵌套类的类型提示
我在使用 pycharm 编码时使用 python 的类型提示系统 我相信它使用typing模块 但是我有一个场景 pycharm 给我一个错误 我找不到关于如何在线修复它的答案 from typing import List class
python
typehinting
pythontyping
执行文件时出现类型错误
所以我试图运行一个文件 但它一直给我这条消息 TypeError type object is not subscriptable 我打开文件 这些是导致问题的行 def inputs string to list inputs strin
python
python3x
annotations
typehinting
受约束的 TypeVar 和 Union 之间有什么区别?
如果我想要一个可以是多种可能类型的类型 Union我似乎是这样表示的 U Union int str U可以是一个int or a str 我注意到了TypeVars 允许可选的 var arg 参数 它们似乎也做同样的事情 T TypeV
python
typehinting
pythontyping
uniontypes
typevariables
如何定义一个不是类的泛型类型?
我想定义一个通用类型 就像是 from typing import TypeVar Sequence Union Generic T TypeVar T RecurSeqOf Sequence Union Generic T Sequenc
typehinting
mypy
pythontyping
Python39
Python 类型提示 可使用一种已知位置类型调用,然后使用 *args 和 **kwargs
我下面的功能foo 其中有 具有已知类型的一个位置 arg 之后有可变数量的位置参数和关键字参数 from typing import Callable def foo bar str args kwargs gt None Some fu
python
typehinting
typing
mypy
PHP7 中的可空返回类型
PHP 7 介绍返回类型声明 这意味着我现在可以指示返回值是某个类 接口 数组 可调用或新的可提示标量类型之一 就像函数参数一样 function returnHello string return hello 通常情况下 值并不总是存在
php
Nullable
returntype
typehinting
php7
如何捕获 PHP 类型提示中的“可捕获的致命错误”?
我正在尝试在我的一堂课上实现 PHP5 的类型提示 class ClassA public function method a ClassB b class ClassB class ClassWrong 正确用法 a new ClassA
php
FATALERROR
typehinting
当 value 是 cls 的实例时,您可以注释返回类型吗?
给定一个带有初始化辅助方法的类 class TrivialClass def init self str arg str self string attribute str arg classmethod def from int cls
python
OOP
pycharm
typehinting
pythontyping
有没有办法将数组传递给 python 泛型?
我正在做一些元编程 我需要一种方法来动态定义类型提示 有没有办法将参数数组传递给类型提示 就像是 Some programatically generated list where I don t know the content unti
python
python3x
typehinting
pythontyping
Typehint 使用 importlib 动态导入模块
给出如下内容 import importlib module path mod mod importlib import module module path package None print mod Foo Bar x where m
python
typehinting
mypy
pythontyping
pythonimportlib
为什么 Python 不会通过“-> type”函数定义抛出类型异常? [复制]
这个问题在这里已经有答案了 在其他语言中 类似示例的任何内容都会引发类型错误 为什么不用Python呢 gt gt gt def foo a int gt str return a 1 gt gt gt foo 5 6 Python 中的类
python
python3x
Exception
types
typehinting
我应该如何类型提示一个也可以是无限的整数变量?
搜索这个主题时我发现了以下内容 如何表示整数无穷大 我同意 Martijn Peeters 的观 点 即为int可能不是最好的想法 然而 这使得类型提示变得困难 假设以下代码 myvar 10 type int myvar math inf
python
typehinting
mypy
我如何告诉 PyCharm 参数的预期类型是什么?
当涉及到构造函数 赋值和方法调用时 PyCharm IDE 非常擅长分析我的源代码并找出每个变量应该是什么类型 我喜欢它正确的时候 因为它为我提供了良好的代码完成和参数信息 并且如果我尝试访问不存在的属性 它会给我警告 但当涉及到参数时 它
python
pycharm
typehinting
pythontyping
codecompletion
Python 2 中的类型提示
In PEP 484 类型提示被添加到 Python 3 中 其中包括typing模块 在Python 2中有什么办法可以做到这一点吗 我能想到的就是有一个装饰器添加到方法中来检查类型 但这会在运行时失败 并且不会像提示所允许的那样更早被捕
python
python27
types
typehinting
pythontyping
«
1
2
3
4
5
6
»