473,503 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic data types

Hi,

The description of Python always mentions "very high level dynamic data
types". Now, I can't seem to find any examples of these (nothing
described with this term anyway). Is this simply refering to built-in
dynamic data structures such as lists and dictionaries, with a great
deal of operators defined on? Or is there something else meant by
"dynamic data types" in Python?

Regards,

Charlie

Jul 18 '05 #1
5 4921
rbt
Charlie wrote:
Hi,

The description of Python always mentions "very high level dynamic data
types". Now, I can't seem to find any examples of these (nothing
described with this term anyway). Is this simply refering to built-in
dynamic data structures such as lists and dictionaries, with a great
deal of operators defined on? Or is there something else meant by
"dynamic data types" in Python?

Regards,

Charlie


I've always thought of it like this... in C, we have to do something
like this when declaring a variable:

int x = 0;

We had to specifically tell the language compiler that x is an integer.
In Python, all we have to do is:

x = 0

The interpretor knows that x is an integer. We can also change the type
like this:

str(x)
float(x)
long(x)

etc...

To me, this is why Python types are called dynamic. They are easy to
setup and easy to modify when compared to older, more static languages.

Bye
Jul 18 '05 #2
rbt wrote:
I've always thought of it like this... in C, we have to do something
like this when declaring a variable: int x = 0; We had to specifically tell the language compiler that x is an integer.In Python, all we have to do is: x = 0 The interpretor knows that x is an integer. We can also change the typelike this: str(x)
float(x)
long(x)


Just to clarify, str(x) does not change x, but

x = str(x)

does. Probably rbt knows this. I wonder how often this feature should
be employed. In my Python programs, most variables keep the same type
throughout. This makes a code easier for me to understand, and this
constraint should facilitate translation of the code to a statically
typed language (perhaps even a variant of Python) in the future, if
necessary.

The ability to grow a list with "append" is a very convenient feature
of Python. The C++ vector is similar but stores elements of the same
type, whereas a Python list or tuple can store elements of different
types.

Jul 18 '05 #3
Charlie wrote:
The description of Python always mentions "very high level dynamic data
types". Now, I can't seem to find any examples of these (nothing
described with this term anyway). Is this simply refering to built-in
dynamic data structures such as lists and dictionaries, with a great
deal of operators defined on? Or is there something else meant by
"dynamic data types" in Python?


I'd say this is "list", "dict", "set", all the similar ones,
plus anything custom defined by the programmer... plus probably
just about any other data type in Python, since they're all
"high level", the "very" part is meaningless, and they're
pretty much all more "dynamic" than most similar things in,
say, a language that's, uh, "less dynamic". ;-)

Really, think of it as marketing propaganda, and don't worry
exactly what the original author of the words intended it
to apply to.

-Peter
Jul 18 '05 #4
I would assume that they're refering to the fact that even the basic
data types such as int are derived from object, and hence have methods:
int.__class__.__base__

<type 'object'>

Java, for example, has both an Integer object and a basic int data
type. One word. Yuck.

Paul S.

Jul 18 '05 #5
Paul Simmonds wrote:
I would assume that they're refering to the fact that even the basic
data types such as int are derived from object, and hence have methods:
int.__class__.__base__


<type 'object'>

Java, for example, has both an Integer object and a basic int data
type. One word. Yuck.


Heh heh. Yeah, I can remember that annoyance well. I believe Java
1.5's supposed to have auto-boxing and -unboxing though, which should
make this less of a pain...

Steve
Jul 18 '05 #6

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

Similar topics

4
4408
by: Leslaw Bieniasz | last post by:
Cracow, 20.10.2004 Hello, As far as I understand, the generic programming basically consists in using templates for achieving a static polymorphism of the various code fragments, and their...
0
3154
by: syamalarao | last post by:
Oracle has two dynamic sql models. The old and the new ANSI model. I wish to know where and how the timestamp oracle data types are supported. I am having trouble setting the timestamp data...
3
9615
by: JDPope | last post by:
I have a situation which I cannot get a good lead on how to resolve. One of the applications I support uses the Hibernate software to generate SQL. The app is JAVA with JDBC. In testing the users...
5
2850
by: Stephen Lamb | last post by:
How would one do the following at runtime? I'm really interested in steps 2 and 3. 1. Read data from somewhere that describes types and instances. 2. Construct new types from data. 3....
7
3370
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
0
1761
by: todddeluca | last post by:
I am posting code for calling almost any python function from php, because it seems generally useful. Please feel free to suggest improvements or tell me this has already been done better...
13
14587
by: Krivenok Dmitry | last post by:
Hello all! Perhaps the most important feature of dynamic polymorphism is ability to handle heterogeneous collections of objects. ("C++ Templates: The Complete Guide" by David Vandevoorde and...
8
338
by: mfc | last post by:
Suppose I have a Cookie class and a Factory Class. There are many types of Cookies and maybe one or more Factories with a ProcessCookie Method. Suppose all the PutInBox method does is decide what...
5
2571
by: bearophileHUGS | last post by:
I often use Python to write small programs, in the range of 50-500 lines of code. For example to process some bioinformatics data, perform some data munging, to apply a randomized optimization...
0
7192
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
7064
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
7261
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,...
1
6974
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
5559
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,...
0
4665
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1492
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
369
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.