1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Pythonのあんまり知らなそうな組み込み関数、変数、メソッド集 #3 [Ellipsis, any, hasattr]

1
Posted at

前回は__import__, __builtins__, __doc__を紹介しました!
これはその続きの記事です!


Ellipsis

オブジェクトです。どんなオブジェクトかというと...

...

これです。

実はこの三連続のドットはオブジェクトという扱いになっているんです!

print(type(...)) # <class 'ellipsis'>

直訳してみるとEllipsisは「省略記号」という意味らしいです。

hasattr

そのままの意味で、オブジェクトがその名前の属性を持っているかを返します。

print(hasattr(str, "join")) # True
print(hasattr(str, "joint")) # False

Pythonには関数を簡略化した関数が、多くあるような気がします。
今日中にまたこのシリーズは出すと思います!

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?