日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python源码文件以什么格式结尾结尾_查看python源码,发现里面的函数都以pass结尾,那么意义何在?...

發布時間:2023/12/3 python 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python源码文件以什么格式结尾结尾_查看python源码,发现里面的函数都以pass结尾,那么意义何在?... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

例如:

class str(object):

"""

str(object='') -> str

str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or

errors is specified, then the object must expose a data buffer

that will be decoded using the given encoding and error handler.

Otherwise, returns the result of object.__str__() (if defined)

or repr(object).

encoding defaults to sys.getdefaultencoding().

errors defaults to 'strict'.

"""

其中一個函數

def capitalize(self): # real signature unknown; restored from __doc__

"""

S.capitalize() -> str

Return a capitalized version of S, i.e. make the first character

have upper case and the rest lower case.

"""

return ""

這個函數到底返回了什么?難道返回了一個空字符嗎?

def endswith(self, suffix, start=None, end=None): # real signature unknown; restored from __doc__

"""

S.endswith(suffix[, start[, end]]) -> bool

Return True if S ends with the specified suffix, False otherwise.

With optional start, test S beginning at that position.

With optional end, stop comparing S at that position.

suffix can also be a tuple of strings to try.

"""

return False

這個函數,返回False ,什么意思?

def find(self, sub, start=None, end=None): # real signature unknown; restored from __doc__

"""

S.find(sub[, start[, end]]) -> int

Return the lowest index in S where substring sub is found,

such that sub is contained within S[start:end]. Optional

arguments start and end are interpreted as in slice notation.

Return -1 on failure.

"""

return 0

這個返回一個0 ?

def format(self, *args, **kwargs): # known special case of str.format

"""

S.format(*args, **kwargs) -> str

Return a formatted version of S, using substitutions from args and kwargs.

The substitutions are identified by braces ('{' and '}').

"""

pass

這個是一pass結尾的,那么要這個函數有什么意義

但是我在實際應用他們的時候,返回的并不是這樣的?

我現在的以為是:這個類里面的這些函數,函數體里面什么邏輯都沒有寫?那么函數是怎么運行的?

總結

以上是生活随笔為你收集整理的python源码文件以什么格式结尾结尾_查看python源码,发现里面的函数都以pass结尾,那么意义何在?...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。