Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18450

Re: python philosophical question - strong vs duck typing

From Terry Reedy <tjreedy@udel.edu>
Subject Re: python philosophical question - strong vs duck typing
Date 2012-01-03 15:38 -0500
References <CAOFf2a0dG1tR1-2sJnqCCGqVXocqvzGScGeDJXeXwKdfdvuT-Q@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.4383.1325623116.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 1/3/2012 1:13 PM, Sean Wolfe wrote:

> I have a theoretical / philosophical question regarding strong vs duck
> typing in Python. Let's say we wanted to type strongly in Python and

Python objects are strongly typed, in any sensible meaning of the term.
What you mean is statically or explicitly typing names.

> were willing to compromise our code to the extent necessary, eg not
> changing variable types or casting or whatever. Let's say there was a
> methodology in Python to declare variable types.
>
> The question is, given this possibility, would this get us closer to
> being able to compile down to a language like C or C++?

Cython compiles Python as is to C. It also gives the option to add type 
annotations to names to get faster code. Shredskin compiles a subset of 
Python, or a subset of usages, to C, with similar benefits.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: python philosophical question - strong vs duck typing Terry Reedy <tjreedy@udel.edu> - 2012-01-03 15:38 -0500
  Re: python philosophical question - strong vs duck typing Ben Finney <ben+python@benfinney.id.au> - 2012-01-04 10:10 +1100
  Re: python philosophical question - strong vs duck typing alex23 <wuwei23@gmail.com> - 2012-01-03 18:15 -0800
    Re: python philosophical question - strong vs duck typing John Nagle <nagle@animats.com> - 2012-01-08 21:35 -0800
      Re: python philosophical question - strong vs duck typing Robert Kern <robert.kern@gmail.com> - 2012-01-09 10:45 +0000
        Re: python philosophical question - strong vs duck typing John Nagle <nagle@animats.com> - 2012-01-13 09:30 -0800
      Re: python philosophical question - strong vs duck typing Lie Ryan <lie.1296@gmail.com> - 2012-01-11 00:05 +1100

csiph-web