Python Forum
Variables as labels vs fixed storage location
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Variables as labels vs fixed storage location
#3
(Sep-21-2017, 07:08 PM)cnoblejr Wrote: Clearly the "stuff" on the right-hand side are objects and have a fixed location. The y and x are just labels that point to the objects.
id() show identity of an object the number is the object memory address.
x any y can both can point to same memory address.
>>> x = 5
>>> y = x
>>> id(x)
1434501200
>>> id(y)
1434501200
(Sep-21-2017, 07:08 PM)cnoblejr Wrote: Most books say that variables are like boxes stored somewhere by the compiler/assembler/loader and the items that appear on the right-hand side get placed in the appropriate box.
Python dos it an other way than most languages other-languages-have-variables.
Python has "names"
Quote:Seems simpler to think of variables as boxes rather than labels that get hung on (point to) objects.
No boxes is more correct to describe how other languages use variables.
This picture show the Python model,that name labels can get hung on same object in memory.
[Image: ab2tag.png]
Reply


Messages In This Thread
RE: Variables as labels vs fixed storage location - by snippsat - Sep-21-2017, 11:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  help seeking for prediction of fixed effect model gotodockforevildragon 1 196 Jun-23-2024, 08:09 AM
Last Post: johnthomson112
  uploading files from a ubuntu local directory to Minio storage container dchilambo 0 615 Dec-22-2023, 07:17 AM
Last Post: dchilambo
  Upload Files to Azure Storage Container phillyfa 6 987 Dec-22-2023, 06:11 AM
Last Post: Pedroski55
  How to do "fixed size" (wrapping) math in Python? AlexanderWulf 13 2,344 Jul-19-2023, 04:13 PM
Last Post: deanhystad
  Fixed colum width for rowLabels i Matplotlib pandabay 0 526 Jun-10-2023, 03:40 PM
Last Post: pandabay
  Encrypt and decrypt in python using own fixed key SriRajesh 3 5,520 Feb-20-2022, 01:18 PM
Last Post: dboxall123
  Play fixed frequency sound in python 3 jpezz 2 2,945 Feb-07-2021, 08:21 PM
Last Post: jpezz
  Referencing a fixed cell Mark17 2 2,192 Dec-17-2020, 07:14 PM
Last Post: Mark17
  Secure App Data Storage for Kivy Android App JonPC 1 2,551 Nov-08-2019, 03:42 PM
Last Post: luke
  Real time graph of the temperatures and storage linkxxx 3 2,827 Aug-29-2019, 09:44 AM
Last Post: linkxxx

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020