Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9db487b

Browse files
committed
#14201: Update ctypes docs to match behavior changed from 214b28d7a999.
Original patch by Erik Johansson, slightly updated by Meador Inge.
1 parent b186f1d commit 9db487b

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

Doc/library/ctypes.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,11 +1386,16 @@ copy of the windows error code.
13861386
The default mode which is used to load shared libraries. On OSX 10.3, this is
13871387
*RTLD_GLOBAL*, otherwise it is the same as *RTLD_LOCAL*.
13881388

1389-
Instances of these classes have no public methods, however :meth:`__getattr__`
1390-
and :meth:`__getitem__` have special behavior: functions exported by the shared
1391-
library can be accessed as attributes of by index. Please note that both
1392-
:meth:`__getattr__` and :meth:`__getitem__` cache their result, so calling them
1393-
repeatedly returns the same object each time.
1389+
Instances of these classes have no public methods. Functions exported by the
1390+
shared library can be accessed as attributes or by index. Please note that
1391+
accessing the function through an attribute caches the result and therefore
1392+
accessing it repeatedly returns the same object each time. On the other hand,
1393+
accessing it through an index returns a new object each time:
1394+
1395+
>>> libc.time == libc.time
1396+
True
1397+
>>> libc['time'] == libc['time']
1398+
False
13941399

13951400
The following public attributes are available, their name starts with an
13961401
underscore to not clash with exported function names:

0 commit comments

Comments
 (0)