On 24/01/2015 13:43, Steven D'Aprano wrote:
Mario Figueiredo wrote:
> class Sub:
> pass
>
> foo = Sub()
>
> Sub.__bases__
> foo.__bases__
>
>The last statement originates the following error:
>
> AttributeError: 'Sub' object has no attribute '
On Jan 25, 2015 2:37 PM, "Terry Reedy" wrote:
> 2. the second array is a compact array of entries in insertion order,
such as
>
> [hash, ptr to 'x', ptr to 23]
> [hash, ptr to 'colour', ptr to 'red']
> [hash, ptr to the string 'y', ptr to the int 42]
>
> Iteration would use the compact
On 1/25/2015 7:00 AM, Steven D'Aprano wrote:
What happens inside the dictionary? Dictionaries are "hash tables", so they
are basically a big array of cells, and each cell is a pair of pointers,
one for the key and one for the value:
[dictionary header]
[blank]
[blank]
[ptr t
Mario Figueiredo :
> Knowing Python internals is something that will end benefiting me in
> the long run. There's much to be gained by knowing the inner working
> of your programming language...
>
> Python is missing an under-the-hood book, I suppose. Tracing through
> Python source code to learn
In article <54c4dae1$0$13005$c3e8da3$54964...@news.astraweb.com>,
steve+comp.lang.pyt...@pearwood.info says...
> [...]
Most excellent. Thanks for the hard work, explaining this to me. :)
Knowing Python internals is something that will end benefiting me in the
long run. There's much to be gained
Mario Figueiredo wrote:
> In article <54c4606a$0$13002$c3e8da3$54964...@news.astraweb.com>,
> steve+comp.lang.pyt...@pearwood.info says...
>>
>> It doesn't.
>
> Your explanation was great Steven. Thank you. But raises one question...
>
>>
>> Assigning a value to a variable ("m = 42", hex 2A) r
In article <54c4606a$0$13002$c3e8da3$54964...@news.astraweb.com>,
steve+comp.lang.pyt...@pearwood.info says...
>
> It doesn't.
Your explanation was great Steven. Thank you. But raises one question...
>
> Assigning a value to a variable ("m = 42", hex 2A) results in the compiler
> storing that
On 25/01/2015 01:55, Terry Reedy wrote:
'This situation' being that Someclass.attro works but Someclass().attro
raises...
In other words, if 'Someclass.attro' evaluates to an object ...
then 'Someclass().attro' *normally* evaluates to the same object
I am sorry Terry, but I do not agree, beca
Mario Figueiredo wrote:
> But that begs the OT question: How does Python maps names to memory
> addresses in the interpreter?
It doesn't.
You are thinking of an execution model like C or Pascal, where variables are
best thought of as fixed memory addresses. But Python, like many modern
languages
On 1/24/2015 4:51 PM, Marco Buttu wrote:
On 24/01/2015 20:24, Terry Reedy wrote:
On 1/24/2015 5:16 AM, Mario Figueiredo wrote:
Consider the following code at your REPL of choice
class Sub:
pass
foo = Sub()
Sub.__bases__
foo.__bases__
The last
In article ,
ros...@gmail.com says...
> Awesome! I'm always a bit wary of analogies... sometimes they're
> really helpful, other times they're unhelpful and confusing.
Yeah. Your's was all it took :)
The thing with analogies is to never take them literally. They are
analogies, after all. But th
In article ,
ian.g.ke...@gmail.com says...
>
> No, you're being told that the *object* doesn't know the names of the
> variables that it's bound to. In the context above, the variable is
> right there under that name in the globals dict, as can be seen in the
> disassembly:
[snipped]
Yes. I got
On Sun, Jan 25, 2015 at 9:33 AM, Mario Figueiredo wrote:
> In article ,
> ros...@gmail.com says...
>>
>> Let me explain by way of analogy.
> [snipped]
>
> Gotcha! Thanks for the explanation :)
Awesome! I'm always a bit wary of analogies... sometimes they're
really helpful, other times they're unh
In article ,
ros...@gmail.com says...
>
> Let me explain by way of analogy.
[snipped]
Gotcha! Thanks for the explanation :)
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, Jan 25, 2015 at 9:09 AM, Mario Figueiredo wrote:
> Meaning the interpreter knows a variable's name. Which would allow it to
> produce an error message such as:
>
> AttributeError: 'foo' object has no attribute '__bases__'
>
> For the following code:
>
> class Sub:
> pass
>
On Sat, Jan 24, 2015 at 3:02 PM, Mario Figueiredo wrote:
> In article ,
> tjre...@udel.edu says...
>>
>> > "__main__"
>> > from module import a_name
>>
>> A module is a namespace associating names with objects. This statememt
>> says to import the a_name to object association from modul
In article ,
ian.g.ke...@gmail.com says...
>
> On Sat, Jan 24, 2015 at 2:14 PM, Mario Figueiredo wrote:
> > But that begs the OT question:
>
> No, it doesnt. http://en.wikipedia.org/wiki/Begging_the_question
Cute.
> I'm not sure I'm understanding what you're asking, but the import
> statement
On 24/01/2015 13:43, Steven D'Aprano wrote:
Mario Figueiredo wrote:
> class Sub:
> pass
>
> foo = Sub()
>
> Sub.__bases__
> foo.__bases__
>
>The last statement originates the following error:
>
> AttributeError: 'Sub' object has no attribute
In article ,
tjre...@udel.edu says...
>
> > "__main__"
> > from module import a_name
>
> A module is a namespace associating names with objects. This statememt
> says to import the a_name to object association from module and add it
> to __main__
>
> > y = a_name + 1
>
> This
On 1/24/2015 4:14 PM, Mario Figueiredo wrote:
In article <54c39366$0$13006$c3e8da3$54964...@news.astraweb.com>,
steve+comp.lang.pyt...@pearwood.info says...
AttributeError: 'Sub' instance has no attribute '__bases__',
AttributeError: 'foo' object has no attribute '__bases__'
On 24/01/2015 20:24, Terry Reedy wrote:
On 1/24/2015 5:16 AM, Mario Figueiredo wrote:
Consider the following code at your REPL of choice
class Sub:
pass
foo = Sub()
Sub.__bases__
foo.__bases__
The last statement originates the following error:
On Sat, Jan 24, 2015 at 2:14 PM, Mario Figueiredo wrote:
> In article <54c39366$0$13006$c3e8da3$54964...@news.astraweb.com>,
> steve+comp.lang.pyt...@pearwood.info says...
>> > AttributeError: 'Sub' instance has no attribute '__bases__',
>> > AttributeError: 'foo' object has no att
In article <54c39366$0$13006$c3e8da3$54964...@news.astraweb.com>,
steve+comp.lang.pyt...@pearwood.info says...
> > AttributeError: 'Sub' instance has no attribute '__bases__',
> > AttributeError: 'foo' object has no attribute '__bases__'
>
> The first would be nice. The second is
In article ,
tjre...@udel.edu says...
> > AttributeError: 'Sub' object has no attribute '__bases__'
>
> In this message, 'Sub' is an adjective, modifying 'object, not naming
> it. If you attend to the last line of the traceback
>
My first reaction is to look at 'Sub' as a noun, not an
On 1/24/2015 5:16 AM, Mario Figueiredo wrote:
Consider the following code at your REPL of choice
class Sub:
pass
foo = Sub()
Sub.__bases__
foo.__bases__
The last statement originates the following error:
This is an anomalous situation. Normall
Mario Figueiredo wrote:
>
> Consider the following code at your REPL of choice
>
> class Super:
> pass
Super is irrelevant here, since it isn't used.
> class Sub:
> pass
>
> foo = Sub()
>
> Sub.__bases__
> foo.__bases__
>
> The
Consider the following code at your REPL of choice
class Super:
pass
class Sub:
pass
foo = Sub()
Sub.__bases__
foo.__bases__
The last statement originates the following error:
AttributeError: 'Sub' object has no attribute '__ba
27 matches
Mail list logo