Skip to content

Commit

Permalink
Add more details to docstring for class constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
lapets committed Sep 29, 2024
1 parent f542ead commit 2a22595
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/blooms/blooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ class blooms(bytearray):

def __init__(self, *args, **kwargs):
"""
Create and initialize a new :obj:`blooms` instance. An instance can be of any
non-zero length.
Create and initialize a new :obj:`blooms` instance.
>>> b = blooms(1)
>>> b @= bytes([0])
Expand All @@ -83,8 +82,18 @@ def __init__(self, *args, **kwargs):
>>> bytes([1]) @ b
False
This method checks that the instance has a valid size before permitting its
creation.
Any approach for creating an instance of the built-in :obj:`bytearray` class
can also be used to create an instance of this class.
>>> b = blooms(range(256))
>>> bytes([1]) @ b
False
>>> b = blooms(b'abc')
>>> bytes([0]) @ b
True
An instance can be of any non-zero length. This method checks that the instance
has a valid size.
>>> b = blooms()
Traceback (most recent call last):
Expand Down

0 comments on commit 2a22595

Please sign in to comment.