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
886687dc
Kaydet (Commit)
886687dc
authored
Şub 24, 2009
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use ABCs to validate documented restriction to Sets or Sequences.
üst
9aa53c2f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
random.py
Lib/random.py
+4
-3
No files found.
Lib/random.py
Dosyayı görüntüle @
886687dc
...
@@ -43,6 +43,7 @@ from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
...
@@ -43,6 +43,7 @@ from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
from
math
import
sqrt
as
_sqrt
,
acos
as
_acos
,
cos
as
_cos
,
sin
as
_sin
from
math
import
sqrt
as
_sqrt
,
acos
as
_acos
,
cos
as
_cos
,
sin
as
_sin
from
os
import
urandom
as
_urandom
from
os
import
urandom
as
_urandom
from
binascii
import
hexlify
as
_hexlify
from
binascii
import
hexlify
as
_hexlify
import
collections
as
_collections
__all__
=
[
"Random"
,
"seed"
,
"random"
,
"uniform"
,
"randint"
,
"choice"
,
"sample"
,
__all__
=
[
"Random"
,
"seed"
,
"random"
,
"uniform"
,
"randint"
,
"choice"
,
"sample"
,
"randrange"
,
"shuffle"
,
"normalvariate"
,
"lognormvariate"
,
"randrange"
,
"shuffle"
,
"normalvariate"
,
"lognormvariate"
,
...
@@ -296,10 +297,10 @@ class Random(_random.Random):
...
@@ -296,10 +297,10 @@ class Random(_random.Random):
# preferred since the list takes less space than the
# preferred since the list takes less space than the
# set and it doesn't suffer from frequent reselections.
# set and it doesn't suffer from frequent reselections.
if
isinstance
(
population
,
(
set
,
frozenset
)
):
if
isinstance
(
population
,
_collections
.
Set
):
population
=
tuple
(
population
)
population
=
tuple
(
population
)
if
not
hasattr
(
population
,
'__getitem__'
)
or
hasattr
(
population
,
'keys'
):
if
not
isinstance
(
population
,
_collections
.
Sequence
):
raise
TypeError
(
"Population must be a sequence or
set. For dicts, use dict.keys(
)."
)
raise
TypeError
(
"Population must be a sequence or
Set. For dicts, use list(d
)."
)
random
=
self
.
random
random
=
self
.
random
n
=
len
(
population
)
n
=
len
(
population
)
if
not
0
<=
k
<=
n
:
if
not
0
<=
k
<=
n
:
...
...
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