Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
934aba66
Kaydet (Commit)
934aba66
authored
Şub 01, 2017
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #29377: Add three new wrappers to types.py (Manuel Krebber).
üst
72268ae1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
0 deletions
+49
-0
types.rst
Doc/library/types.rst
+23
-0
test_types.py
Lib/test/test_types.py
+18
-0
types.py
Lib/types.py
+4
-0
NEWS
Misc/NEWS
+4
-0
No files found.
Doc/library/types.rst
Dosyayı görüntüle @
934aba66
...
@@ -132,6 +132,29 @@ Standard names are defined for the following types:
...
@@ -132,6 +132,29 @@ Standard names are defined for the following types:
C".)
C".)
.. data:: SlotWrapperType
The type of methods of some built-in data types and base classes such as
:meth:`object.__init__` or :meth:`object.__lt__`.
.. versionadded:: 3.7
.. data:: MethodWrapperType
The type of *bound* methods of some built-in data types and base classes.
For example it is the type of :code:`object().__str__`.
.. versionadded:: 3.7
.. data:: MethodDescriptorType
The type of methods of some built-in data types such as :meth:`str.join`.
.. versionadded:: 3.7
.. class:: ModuleType(name, doc=None)
.. class:: ModuleType(name, doc=None)
The type of :term:`modules <module>`. Constructor takes the name of the
The type of :term:`modules <module>`. Constructor takes the name of the
...
...
Lib/test/test_types.py
Dosyayı görüntüle @
934aba66
...
@@ -576,6 +576,24 @@ class TypesTests(unittest.TestCase):
...
@@ -576,6 +576,24 @@ class TypesTests(unittest.TestCase):
self
.
assertGreater
(
object
.
__basicsize__
,
0
)
self
.
assertGreater
(
object
.
__basicsize__
,
0
)
self
.
assertGreater
(
tuple
.
__itemsize__
,
0
)
self
.
assertGreater
(
tuple
.
__itemsize__
,
0
)
def
test_slot_wrapper_types
(
self
):
self
.
assertIsInstance
(
object
.
__init__
,
types
.
SlotWrapperType
)
self
.
assertIsInstance
(
object
.
__str__
,
types
.
SlotWrapperType
)
self
.
assertIsInstance
(
object
.
__lt__
,
types
.
SlotWrapperType
)
self
.
assertIsInstance
(
int
.
__lt__
,
types
.
SlotWrapperType
)
def
test_method_wrapper_types
(
self
):
self
.
assertIsInstance
(
object
()
.
__init__
,
types
.
MethodWrapperType
)
self
.
assertIsInstance
(
object
()
.
__str__
,
types
.
MethodWrapperType
)
self
.
assertIsInstance
(
object
()
.
__lt__
,
types
.
MethodWrapperType
)
self
.
assertIsInstance
((
42
)
.
__lt__
,
types
.
MethodWrapperType
)
def
test_method_descriptor_types
(
self
):
self
.
assertIsInstance
(
str
.
join
,
types
.
MethodDescriptorType
)
self
.
assertIsInstance
(
list
.
append
,
types
.
MethodDescriptorType
)
self
.
assertIsInstance
(
''
.
join
,
types
.
BuiltinMethodType
)
self
.
assertIsInstance
([]
.
append
,
types
.
BuiltinMethodType
)
class
MappingProxyTests
(
unittest
.
TestCase
):
class
MappingProxyTests
(
unittest
.
TestCase
):
mappingproxy
=
types
.
MappingProxyType
mappingproxy
=
types
.
MappingProxyType
...
...
Lib/types.py
Dosyayı görüntüle @
934aba66
...
@@ -36,6 +36,10 @@ MethodType = type(_C()._m)
...
@@ -36,6 +36,10 @@ MethodType = type(_C()._m)
BuiltinFunctionType
=
type
(
len
)
BuiltinFunctionType
=
type
(
len
)
BuiltinMethodType
=
type
([]
.
append
)
# Same as BuiltinFunctionType
BuiltinMethodType
=
type
([]
.
append
)
# Same as BuiltinFunctionType
SlotWrapperType
=
type
(
object
.
__init__
)
MethodWrapperType
=
type
(
object
()
.
__str__
)
MethodDescriptorType
=
type
(
str
.
join
)
ModuleType
=
type
(
sys
)
ModuleType
=
type
(
sys
)
try
:
try
:
...
...
Misc/NEWS
Dosyayı görüntüle @
934aba66
...
@@ -223,6 +223,10 @@ Extension Modules
...
@@ -223,6 +223,10 @@ Extension Modules
Library
Library
-------
-------
-
Issue
#
29377
:
Add
SlotWrapperType
,
MethodWrapperType
,
and
MethodDescriptorType
built
-
in
types
to
types
module
.
Original
patch
by
Manuel
Krebber
.
-
Issue
#
29218
:
Unused
install_misc
command
is
now
removed
.
It
has
been
-
Issue
#
29218
:
Unused
install_misc
command
is
now
removed
.
It
has
been
documented
as
unused
since
2000.
Patch
by
Eric
N
.
Vander
Weele
.
documented
as
unused
since
2000.
Patch
by
Eric
N
.
Vander
Weele
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment