On Fri, Dec 16, 2016 at 11:36 AM, Erik <pyt...@lucidity.plus.com> wrote:
> On 12/12/16 23:23, Chris Angelico wrote:
>>
>> In JavaScript, it's normal to talk about "calling a function as a
>> constructor". When you do, there is a 'this' object before you start.
>
>
> No there isn't. There is an implicit binding of a variable called "this"
> based on the syntactic sugar of whether you're calling a function as method
> on an object or not.
>
> In "strict" mode, this has been redefined to be "undefined" (i.e., there is
> no object) for when you're not - otherwise it will be a binding to the
> global "document" object (and in Node.js, I think something else entirely.
> It's a mess ...).

I'm talking about when you call a function as a constructor: "new
Foo()". Doesn't that have a 'this' object before the function starts?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to