473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Number methods


I can't find any description of these. Most are obvious, but some
are not. Note that this is from the point of view of IMPLEMENTING
them, not USING them. Specifically:

Does Python use classic division (nb_divide) and inversion (nb_invert)
or are they entirely historical? Note that I can very easily provide
the latter.

Is there any documentation on the coercion function (nb_coerce)? It
seems to have unusual properties.

Thanks for any hints.
Regards,
Nick Maclaren.
Jan 17 '07 #1
1 1508
Nick Maclaren wrote:
I can't find any description of these. Most are obvious, but some
are not. Note that this is from the point of view of IMPLEMENTING
them, not USING them. Specifically:
The Python equivalents of these methods are described in the
reference manual:
http://docs.python.org/ref/numeric-types.html

More details can be founf in various PEPs:
http://www.python.org/dev/peps/
Does Python use classic division (nb_divide) and inversion (nb_invert)
or are they entirely historical? Note that I can very easily provide
the latter.
Python uses classic divison by default. True divison is used only when
the division __future__ directive is in effect. See PEP 238 for
details:
http://www.python.org/dev/peps/pep-0238/

The nb_invert method is used for the implementation of the bitwise
inverse unary operator (~). I don't think that it is deprecated. See:
http://docs.python.org/lib/bitstring-ops.html for details.
Is there any documentation on the coercion function (nb_coerce)? It
seems to have unusual properties.
It is used for old style Python classes and extension types that
don't have Py_TPFLAGS_CHECKTYPES in their tp_flags. See:
http://docs.python.org/ref/coercion-rules.html
and
http://www.python.org/dev/peps/pep-0208/
for details.

Ziga

Jan 21 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dave Merrill | last post by:
Python newb here. Say a class contains some rich attributes, each defined as a class. If an instance of the parent class recieves a call to a method belonging to one of those attributes, it should...
5
by: joemono | last post by:
Hello everyone! First, I appologize if this posting isn't proper "netiquette" for this group. I've been working with perl for almost 2 years now. However, my regular expression knowledge is...
5
by: Shane | last post by:
I wonder if someone has any ideas about the following. I am currently producing some reports for a manufacturing company who work with metal. A finished part can contain multiple sub-parts to...
5
by: Subrahmanyam Arya | last post by:
Hi Folks , I am trying to solve the problem of reading the numbers correctly from a serial line into an intel pentium processor machine . I am reading 1 byte and 2byte data both positive...
2
by: Mark | last post by:
I have it in my head that I saw a marketing document from Microsoft with the total number of classes and methods in the .NET Framework. Something like 70,000 methods? I don't need precise numbers,...
0
by: Flack | last post by:
Hello, Is it possible to find out how many methods are listening to a certain event? For example, if a number of methods subscribed to a controls DragDrop event using +=, can I find out how many...
1
by: Flack | last post by:
Hello, Is it possible to find out how many methods are listening to a certain event? For example, if a number of methods subscribed to a controls DragDrop event using +=, can I find out how many...
8
by: Mark | last post by:
I have it in my head that I saw a marketing document from Microsoft with the total number of classes and methods in the .NET Framework. Something like 70,000 methods? I don't need precise numbers,...
42
by: Holger | last post by:
Hi guys Tried searching for a solution to this, but the error message is so generic, that I could not get any meaningfull results. Anyways - errormessage:...
19
by: VK | last post by:
http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/ b495b4898808fde0> is more than one month old - this may pose problem for posting over some news servers. This is why I'm...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.