Name

__hex__, __oct__

Synopsis

__hex__(self)
__oct__(self)

Built-in function hex( x ) calls x .__hex__( ). Built-in function oct( x ) calls x .__oct__( ). Each of these special methods should return a string representing the value of x, in base 16 and 8 respectively.

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.