473,546 Members | 2,239 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 4925
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
4413
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 reuse for various template parameters. I wonder if there exist techniques for achieving a dynamic polymorphism using the generic programming. Is this...
0
3161
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 through pro*c using old dynamic sql. I tried to set it to raw 11 bytes and use type 187 (timestamp) and it segfaults! I try now to set it to string type...
3
9621
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 see no problems and think the app is running okay. I turned a database monitor on the app and see that the database is getting SQL return coes of...
5
2854
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. Construct instances of types from data. 3. Use new types and instances in a type safe manner. e.g.
7
3375
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 either AND or OR but never mixed together. We can use Northwind database for my question, it is very similar to the structure of the problem on the...
0
1765
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 somewhere else, etc. My limited searching turned up nothing. I work in a heterogeneous environment with php web pages and python modules/scripts. This...
13
14595
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 Nicolai M. Josuttis. Chapter 14.) How to implement analogue of this technique via static polymorphism? Perhaps there is special design pattern for...
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 colour box to put the cookie into. But since the colour of the box depends on whatever Factory is boxing them (Different branding etc) the PutInBox...
5
2575
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 algorithm to solve a certain messy problem, and many different things. For that I often use several general modules that I have written, like...
0
7435
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7694
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7792
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6026
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5080
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1921
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 we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.