473,385 Members | 1,798 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,385 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 1438
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
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...

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.