473,326 Members | 2,108 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,326 software developers and data experts.

Re: questions from a lost sheep

On Thu, 2008-10-02 at 15:18 -0500, sk**@pobox.com wrote:
JoeI've started to think fondly of the rock-solid stability of Python,
Joeand have been wondering if perhaps aggressive unit testing could
Joemitigate most of the problems of weak typing.

Note: Python is not weakly typed. It is dynamically typed. But, yes,
there is no substitute for unit tests in a language like Python.
just to make it maybe clearer - here an excerpt from the excellent book
dive into python, which is also free available:

"""
statically typed language: A language in which types are fixed at
compile time. Most statically typed languages enforce this by requiring
you to declare all variables with their datatypes before using them.
Java and C are statically typed languages.

dynamically typed language: A language in which types are discovered at
execution time; the opposite of statically typed. VBScript and Python
are dynamically typed, because they figure out what type a variable is
when you first assign it a value.

strongly typed language: A language in which types are always enforced.
Java and Python are strongly typed. If you have an integer, you can't
treat it like a string without explicitly converting it.

weakly typed language: A language in which types may be ignored; the
opposite of strongly typed. VBScript is weakly typed. In VBScript, you
can concatenate the string '12' and the integer 3 to get the string
'123', then treat that as the integer 123, all without any explicit
conversion.

So Python is both dynamically typed (because it doesn't use explicit
datatype declarations) and strongly typed (because
once a variable has a datatype, it actually matters).
"""
http://diveintopython.org/getting_to...s.html#d0e4188
cheers, hannes

Oct 2 '08 #1
2 1435
johannes raggam wrote:
On Thu, 2008-10-02 at 15:18 -0500, sk**@pobox.com wrote:
>JoeI've started to think fondly of the rock-solid stability of Python,
Joeand have been wondering if perhaps aggressive unit testing could
Joemitigate most of the problems of weak typing.

Note: Python is not weakly typed. It is dynamically typed. But, yes,
there is no substitute for unit tests in a language like Python.

just to make it maybe clearer - here an excerpt from the excellent book
dive into python, which is also free available:

"""
statically typed language: A language in which types are fixed at
compile time. Most statically typed languages enforce this by requiring
you to declare all variables with their datatypes before using them.
Java and C are statically typed languages.

dynamically typed language: A language in which types are discovered at
execution time; the opposite of statically typed. VBScript and Python
are dynamically typed, because they figure out what type a variable is
when you first assign it a value.

strongly typed language: A language in which types are always enforced.
Java and Python are strongly typed. If you have an integer, you can't
treat it like a string without explicitly converting it.

weakly typed language: A language in which types may be ignored; the
opposite of strongly typed. VBScript is weakly typed. In VBScript, you
can concatenate the string '12' and the integer 3 to get the string
'123', then treat that as the integer 123, all without any explicit
conversion.

So Python is both dynamically typed (because it doesn't use explicit
datatype declarations) and strongly typed (because
once a variable has a datatype, it actually matters).
"""
http://diveintopython.org/getting_to...s.html#d0e4188
cheers, hannes
That is a GREAT explanation of statically, dynamically, strongly and weakly
typed languages. So many programmers are confused about these differences. Many
believe that statically typed is the only way to have strongly typed and they
are incorrect. Thanks for this.

-Larry
Oct 3 '08 #2
On Oct 2, 11:08*pm, johannes raggam <raggam...@adm.atwrote:
statically typed language: A language in which types are fixed at
compile time. Most statically typed languages enforce this by requiring
you to declare all variables with their datatypes before using them.
Java and C are statically typed languages.

dynamically typed language: A language in which types are discovered at
execution time; the opposite of statically typed. VBScript and Python
are dynamically typed, because they figure out what type a variable is
when you first assign it a value.

strongly typed language: A language in which types are always enforced.
Java and Python are strongly typed. If you have an integer, you can't
treat it like a string without explicitly converting it.

weakly typed language: A language in which types may be ignored; the
opposite of strongly typed. VBScript is weakly typed. In VBScript, you
can concatenate the string '12' and the integer 3 to get the string
'123', then treat that as the integer 123, all without any explicit
conversion.
I have always considered this argument rather weak.
It is true, we Pythonista we are in a better position
that Perl and VBScript users, but still how strong is
"strong" typing really? When I can never know the types
accepted by a function at compile time?
When I can change the class of
an object at runtime?
Dynamic typing has its advantages, but calling it "strong" is
ridicolous for people coming from a background in ML or Haskell. The
definitions change
according to the circles you frequent, so there will be always
confusions on the terminology, unfortunately.

Oct 3 '08 #3

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

Similar topics

10
by: Mist in the night | last post by:
Hi, I copied the DATA directory from a backup ghost image to a new SQL 6.5 installation and, after fixing a problem with the directory structure (which caused the databases to be marked as...
162
by: techievasant | last post by:
hello everyone, Iam vasant from India.. I have a test+interview on C /C++ in the coming month so plz help me by giving some resources of FAQS, interview questions, tracky questions, multiple...
50
by: Jatinder | last post by:
I 'm a professional looking for the job.In interview these questions were asked with some others which I answered.But some of them left unanswered.Plz help. Here are some questions on C/C++, OS...
1
by: ASP Yaboh | last post by:
1. If I use an ArrayList as my data source, how do I construct the accessor methods? That is, forget about properties for a moment, if I wanted the 5th item in the ArrayList, I would write the...
7
by: et | last post by:
I'm not sure I understand the use of the ViewState. Do I understand correctly that values of controls are automatically held in a hidden control called ViewState? If so, then why can't we get...
6
by: Együd Csaba | last post by:
Hi All, I'd like to dump out my database using plain text format. Everything is ok, but the bytea filds. Restoring the dump file (using <<psql -f LO_TRY_INSERT_BYTEA.sql tmp7>>) it sends an...
8
by: onetitfemme | last post by:
1._ How can you stop a browser from displaying horizontally floating objects in new lines once they should not be shrunk any longer? The browser should then show a horizontal scrollbar. I know...
3
by: gallows | last post by:
In this code: void f() { char* s1 = new char; s1 = "fred"; char* s2 = new char; s2 = "fred"; }
6
by: Peter Michaux | last post by:
Maybe you want a job with Meebo? You have to pass the test first... <URL:http://blog.meebo.com/?page_id=254> I enjoyed these questions. Any other nice little JavaScript quizzes out there? ...
102
by: dreamznatcher | last post by:
Hello, I'm considering a career switch to a more database-related job, but need help on a few questions and issues. I'm a Computer Engineering graduate and have always felt most comfortable...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.