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 5 4945
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
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.
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
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.
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics | |
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
possible? If yes, can anyone show me simple examples in C++
|
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 and oracle says invalid month! I tried even using nls_timestamp_format setting but no luck. Obviously...
|
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 -301 for a variety of database accesses (some times the same
access works, okay other times -301)....
|
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.
|
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 database I am working on.
IF(SELECT OBJECT_ID('REPORT')) IS NOT NULL
DROP TABLE REPORT_SELECTION
| | |
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 code requires no no creation of an ad hoc
command line interface to the python module and/or ad hoc...
|
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 this purpose...
|
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 method can't be in the Cookie
class and has to be in the Factory class. The problem is pretty soon...
|
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
implementation of certain data structures, and small general "utility"
functions/classes, plus of course...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| | |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |