Skip to content

Commit c4adf46

Browse files
committed
Merge pull request #8 from adrianliaw/use-super
Use "super"
2 parents 6736912 + 8307285 commit c4adf46

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

pycuber/formula.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,22 +265,40 @@ def __hash__(self):
265265

266266
@property
267267
def name(self):
268+
"""
269+
Name of the Step object (B', R, U2)
270+
"""
268271
return self.__name()
269272

270273
@property
271274
def is_counter_clockwise(self):
275+
"""
276+
True if direction is counter-clockwise (not including 180 degrees)
277+
False otherwise
278+
"""
272279
return self.__is_counter_clockwise()
273280

274281
@property
275282
def is_clockwise(self):
283+
"""
284+
True if direction is clockwise (not including 180 degrees)
285+
False otherwise
286+
"""
276287
return self.__is_clockwise()
277288

278289
@property
279290
def is_180(self):
291+
"""
292+
True if the action is to turn 180 degrees
293+
False otherwise
294+
"""
280295
return self.__is_180()
281296

282297
@property
283298
def face(self):
299+
"""
300+
Face of the step (R, U, l, x, M)
301+
"""
284302
return self.__face()
285303

286304

@@ -367,9 +385,10 @@ def __getitem__(self, index):
367385
>>> a[1]
368386
U
369387
"""
388+
result = super(Formula, self).__getitem__(index)
370389
if isinstance(index, slice):
371-
return Formula(list.__getitem__(self, index))
372-
return list.__getitem__(self, index)
390+
return Formula(result)
391+
return result
373392

374393
def __setitem__(self, index, item):
375394
"""
@@ -387,9 +406,9 @@ def __setitem__(self, index, item):
387406
del self[index]
388407
return
389408
if isinstance(index, slice):
390-
list.__setitem__(self, index, Formula(item))
409+
super(Formula, self).__setitem__(index, Formula(item))
391410
else:
392-
list.__setitem__(self, index, Step(item))
411+
super(Formula, self).__setitem__(index, Step(item))
393412

394413
def __setattr__(self, name, value):
395414
"""

0 commit comments

Comments
 (0)