You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You seem to have managed to avoid providing a way to get an Information object in a particular unit. Intuitively, you expect to be able to do information.bytes or information.gigabytes. Consider implementing __getattr__(). You could implement it as a method that takes a unit constant, but which of these would you prefer to see?
int(math.ceil(size.bits / 8e+9))
size.to(Information.GIGABYTES)
size.gigabytes
Go with the last one. Should you be returning floats or decimals? Bits should always return int.
The text was updated successfully, but these errors were encountered:
You seem to have managed to avoid providing a way to get an
Information
object in a particular unit. Intuitively, you expect to be able to doinformation.bytes
orinformation.gigabytes
. Consider implementing__getattr__()
. You could implement it as a method that takes a unit constant, but which of these would you prefer to see?int(math.ceil(size.bits / 8e+9))
size.to(Information.GIGABYTES)
size.gigabytes
Go with the last one. Should you be returning
float
s ordecimal
s? Bits should always returnint
.The text was updated successfully, but these errors were encountered: