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
06360405
Kaydet (Commit)
06360405
authored
Tem 04, 2010
tarafından
Alexander Belopolsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed doctests
üst
2e733c96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
Rev.py
Demo/classes/Rev.py
+10
-12
No files found.
Demo/classes/Rev.py
Dosyayı görüntüle @
06360405
...
...
@@ -4,8 +4,7 @@ From: "Steven D. Majewski" <sdm7g@elvis.med.virginia.edu>
It works on mutable or inmutable sequences.
>>> chars = list(Rev('Hello World!'))
>>> print ''.join(chars)
>>> Rev('Hello World!')
!dlroW olleH
The .forw is so you can use anonymous sequences in __init__, and still
...
...
@@ -16,16 +15,16 @@ good reason to use anonymous values in creating the sequence to avoid
confusion. Maybe it should be change to copy input sequence to break
the connection completely ? )
>>> nnn =
range(3
)
>>> nnn =
list(range(3)
)
>>> rnn = Rev(nnn)
>>> for n in rnn:
print
n
>>> for n in rnn: n
...
2
1
0
>>> for n in range(4, 6): nnn.append(n) # update nnn
...
>>> for n in rnn:
print
n # prints reversed updated values
>>> for n in rnn: n # prints reversed updated values
...
5
4
...
...
@@ -35,7 +34,7 @@ the connection completely ? )
>>> nnn = nnn[1:-1]
>>> nnn
[1, 2, 4]
>>> for n in rnn:
print
n # prints reversed values of old nnn
>>> for n in rnn: n # prints reversed values of old nnn
...
5
4
...
...
@@ -45,16 +44,15 @@ the connection completely ? )
#
>>> WH = Rev('Hello World!')
>>> print
WH.forw, WH.back
>>> print
(WH.forw, WH.back)
Hello World! !dlroW olleH
>>> nnn = Rev(
range(1, 10
))
>>> print
nnn.forw
>>> nnn = Rev(
list(range(1, 10)
))
>>> print
(nnn.forw)
[1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> print
nnn.back
>>> print
(nnn.back)
[9, 8, 7, 6, 5, 4, 3, 2, 1]
>>> rrr = Rev(nnn)
>>> rrr
>>> Rev(nnn)
<1, 2, 3, 4, 5, 6, 7, 8, 9>
'''
...
...
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