Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


Top White Papers

More on LinuxToday


LinuxProgramming: Migrating from Perl to Python: Numeric Objects

Sep 18, 2000, 12:32 (0 Talkback[s])
(Other stories by Martin C. Brown)

"In this article on migrating from Perl to Python we're going to look at the basic numeric object type."

"It'll be no surprise to you that Python uses an oject to hold a number. There are no restrictions on what type of number can be stored within a Number object, which basically follows the same premise as the Perl scalar and it's built in IV (Integer Value) and DV (Double Value) types. However, unlink Perl, Python also supports complex numbers and arbitrarily large integers."

"As we already know, Python creates an object using the type as determined from information that is assigned to the object when it is created. With number objects it is the format of the number that determines the method in which the information is stored. We therefore need to know how to introduce numerical constants into our Python programs. Details on the different types of constants, and how Python stores them internally are outlined below."

Complete Story

Related Stories: