本文整理汇总了C#中PythonLanguageVersion.IsNone方法的典型用法代码示例。如果您正苦于以下问题:C# PythonLanguageVersion.IsNone方法的具体用法?C# PythonLanguageVersion.IsNone怎么用?C# PythonLanguageVersion.IsNone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PythonLanguageVersion
的用法示例。
在下文中一共展示了PythonLanguageVersion.IsNone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Expression
/// <summary>
/// Returns a sequence of all keywords usable in an expression in a
/// particular version of Python.
/// </summary>
public static IEnumerable<string> Expression(PythonLanguageVersion version = PythonLanguageVersion.None) {
yield return "and";
yield return "as";
if (version.IsNone() || version >= PythonLanguageVersion.V35) {
yield return "await";
}
yield return "else";
if (version.IsNone() || version.Is3x()) {
yield return "False";
}
yield return "for";
if (version.IsNone() || version >= PythonLanguageVersion.V33) {
yield return "from";
}
yield return "if";
yield return "in";
yield return "is";
yield return "lambda";
yield return "None";
yield return "not";
yield return "or";
if (version.IsNone() || version.Is3x()) {
yield return "True";
}
yield return "yield";
}
示例2: InvalidOutsideFunction
/// <summary>
/// Returns a sequence of all keywords that are invalid outside of
/// function definitions in a particular version of Python.
/// </summary>
public static IEnumerable<string> InvalidOutsideFunction(
PythonLanguageVersion version = PythonLanguageVersion.None
) {
if (version.IsNone() || version >= PythonLanguageVersion.V35) {
yield return "await";
}
yield return "return";
if (version.IsNone() || version >= PythonLanguageVersion.V25) {
yield return "yield";
}
}
示例3: Statement
/// <summary>
/// Retuns a sequence of all keywords usable as a statement in a
/// particular version of Python.
/// </summary>
public static IEnumerable<string> Statement(PythonLanguageVersion version = PythonLanguageVersion.None) {
yield return "assert";
if (version.IsNone() || version >= PythonLanguageVersion.V35) {
yield return "async";
yield return "await";
}
yield return "break";
yield return "continue";
yield return "class";
yield return "def";
yield return "del";
if (version.IsNone() || version.Is2x()) {
yield return "exec";
}
yield return "if";
yield return "elif";
yield return "except";
yield return "finally";
yield return "for";
yield return "from";
yield return "global";
yield return "import";
if (version.IsNone() || version.Is3x()) {
yield return "nonlocal";
}
yield return "pass";
if (version.IsNone() || version.Is2x()) {
yield return "print";
}
yield return "raise";
yield return "return";
yield return "try";
yield return "while";
yield return "with";
yield return "yield";
}