PHP » PYTHON |
login |
register |
about
|
PYTHON The ArrayAccess interface
is this article helpful?
|
Python replacement for PHP's The ArrayAccess interface
[
edit
| history
]
class ArrayAccess(object):
def __getitem__(self, key): return self.container def __setitem__(self, key, value): self.container=value def __delitem__(self, key, value): del self.container The ArrayAccess interfaceIntroductionInterface to provide accessing objects as arrays. Class synopsisArrayAccess
ArrayAccess
{
/* Methods */
}Example #1 Basic usage
<?php The above example will output something similar to: bool(true) int(2) bool(false) string(7) "A value" Table of Contents
|
more
Recently updated
more
Most requested
more
Last requests
|