A certainl part of an if() structure never gets executed.

Nick the Gr33k support at superhost.gr
Sun Jun 16 05:59:00 EDT 2013


On 16/6/2013 12:22 μμ, Denis McMahon wrote:
> On Sun, 16 Jun 2013 11:07:12 +0300, Nick the Gr33k wrote:
>
>> On 16/6/2013 9:32 πμ, Denis McMahon wrote:
>>> On Sat, 15 Jun 2013 19:18:53 +0300, Nick the Gr33k wrote:
>>>
>>>> In both situations we still have 2 memory units holding values, so
>>>> hows that different?
>>>
>>> Consider that each named variable is a pointer to a memory location
>>> that holds a value. This is one of the ways in that a typed compiled
>>> language and an untyped scripted language may differ in their treatment
>>> of data items (or variables).
>>>
>>> Consider the following C and Python code:
>>>
>>> C:
>>>
>>> int a, b;
>>> b = 6;
>>> a = b;
>>>
>>> In C, this places the numeric value 6 into the memory location
>>> identified by the variable "b", then copies the value from the location
>>> pointed to by "b" into the location pointed to by "a".
>>>
>>> b is a pointer to a memory location containing the value 6 a is a
>>> pointer to another memory location also containing the value 6
>>>
>>> Python:
>>>
>>> b = 6
>>> a = b
>>>
>>> In Python, this first puts the value 6 in in a memory location and
>>> points "b" at that memory location, then makes "a" point to the same
>>> memory location as "b" points to.
>>>
>>> b is a pointer to a memory location containing the value 6 a is a
>>> pointer to the same memory location
>>>
>>> Do you understand the difference?
>>>
>> Yes and thank you for explaining in detail to me.
>> So Python economies(saves) system's memory. Good job Python!
>
> No. Don't read that into it.
>
> For example, in Python
>
> a = 6
> b = a
> c = 6
>
> a and b point to one memory location that contains the value 6
> c points to a different memory location that contains the value 6

I believe you are mistaken.

a here is not a pointer but variable,
which is a memory location that stores value 6.

b here is a pointer. It's value is the memory location of variable a 
which stores value 6.

c here is just te same as a , a variable.

>> A pointer = a variable that has as a value a memory address a variable =
>> a memory address that has as a value the actual value we want to store.
>
> These are really C terms, not Python terms. Stop thinking that C is
> behaving like Python.


I think it behaves the same way, but lets here from someone else too.

>> Is this how the thing works?
>
> No.
>
> Python is an interpreted language. C is a compiled language. They present
> very different feature sets to the user. You need to understand this, and
> at the moment you're not doing so.

Whats the difference of "interpreting " to "compiling" ?

I have also asked other things too which you didn't quote, please do.

-- 
What is now proved was at first only imagined!



More information about the Python-list mailing list