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
b8b6d3ef
Kaydet (Commit)
b8b6d3ef
authored
Şub 06, 2008
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Let the world know that UserList is a MutableSequence.
üst
8284c4a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
UserList.py
Lib/UserList.py
+5
-1
UserString.py
Lib/UserString.py
+7
-2
No files found.
Lib/UserList.py
Dosyayı görüntüle @
b8b6d3ef
"""A more or less complete user-defined wrapper around list objects."""
class
UserList
:
import
collections
class
UserList
(
collections
.
MutableSequence
):
def
__init__
(
self
,
initlist
=
None
):
self
.
data
=
[]
if
initlist
is
not
None
:
...
...
@@ -69,3 +71,5 @@ class UserList:
self
.
data
.
extend
(
other
.
data
)
else
:
self
.
data
.
extend
(
other
)
collections
.
MutableSequence
.
register
(
UserList
)
Lib/UserString.py
Dosyayı görüntüle @
b8b6d3ef
...
...
@@ -6,10 +6,11 @@ Note: string objects have grown methods in Python 1.6
This module requires Python 1.6 or later.
"""
import
sys
import
collections
__all__
=
[
"UserString"
,
"MutableString"
]
class
UserString
:
class
UserString
(
collections
.
Sequence
)
:
def
__init__
(
self
,
seq
):
if
isinstance
(
seq
,
str
):
self
.
data
=
seq
...
...
@@ -161,7 +162,9 @@ class UserString:
def
upper
(
self
):
return
self
.
__class__
(
self
.
data
.
upper
())
def
zfill
(
self
,
width
):
return
self
.
__class__
(
self
.
data
.
zfill
(
width
))
class
MutableString
(
UserString
):
collections
.
Sequence
.
register
(
UserString
)
class
MutableString
(
UserString
,
collections
.
MutableSequence
):
"""mutable string objects
Python strings are immutable objects. This has the advantage, that
...
...
@@ -230,6 +233,8 @@ class MutableString(UserString):
self
.
data
*=
n
return
self
collections
.
MutableSequence
.
register
(
MutableString
)
if
__name__
==
"__main__"
:
# execute the regression test to stdout, if called as a script:
import
os
...
...
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