简体   繁体   English

python:语法糖-是官方的吗? 文档在哪里描述?

[英]python: syntactic sugar - is it official? where is it described in documentation?

I often see notes that eg [] is syntactic sugar for _getitem_ ( Why/How does Pandas use square brackets with .loc and .iloc? ), but neither by web search, not here on SO, not in glossary in docs.python.org I could find list of all sugars for Python. 我经常看到,例如笔记[]是语法糖_getitem_为什么/如何大熊猫使用方括号的.loc和.iloc? ),但无论通过网络搜索,而不是在这里所以,不是在词汇docs.python。组织我能找到的所有的Python糖的名单。 Are sugars official or left to each implementation specifics? 糖是官方的还是留给每个实施细节的?

It's documented in the Python data model documentation . 它记录在Python数据模型文档中 It's not exactly synthetic sugar, and more of an implementation detail of how container types work. 它不完全是合成糖,更多是关于容器类型如何工作的实现细节。 Python has lots of these so-called "magic methods" Python有很多这些所谓的“魔术方法”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在哪里可以找到有关 python 中不可变类型的官方文档 - Where to find official documentation on immutable types in python Python语法糖:函数arg别名 - Python syntactic sugar: function arg aliases 如何在没有语法糖的情况下实例化Python列表 - How to instantiate Python list without syntactic sugar 对Python装饰器和“语法糖”感到困惑 - Confused about Python decorators and “syntactic sugar” 有无语法糖的Python装饰器之间的区别? - Difference between Python decorator with and without syntactic sugar? 熊猫中的波浪号(〜)的正式文档在哪里? - Where is official documentation for tilde (~) in Pandas? 列表推导式是 Python 3 中`list(generator expression)` 的语法糖吗? - Are list comprehensions syntactic sugar for `list(generator expression)` in Python 3? 在 python 中,属性装饰器如何在内部使用语法糖(@)工作? - How does property decorator work internally using syntactic sugar(@) in python? 接口只是“语法糖”吗? - Are Interfaces just “Syntactic Sugar”? Python函数或语法糖返回生成器表达式的所有元素? - Python function or syntactic sugar to return all elements of a generator expression?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM