Python Forum
Python Returns Hexadecimal
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Returns Hexadecimal
#1
Within Python Simpy library, you have Resources that can be used by Processes, and at any point in time there may be Processes queuing to use a particular Resource (they have to wait until it is free).

The good news is, there is a command which lets you know what Process is using a Resource at any point in time. (t1.users if the Resource variable name is "t1", for those interested, though not really of relevance.)

The bad news is, you get a return similar to the one below. I think it is a hexadecimal?? What makes the news even worse, is that this number will change everytime you run the exact same script. It is like it is directing me to a memory location or something alike. Whatever it is, it is of zero use. Does anyone have any experience with the below returned information?

<Request() object at 0x1ea08ec1b38>

I've included more attempts of getting some more useful information from this return below.

INPUT

print(t1.users, "\n")
print(len(t1.users), "\n")
print(t1.users[0], "\n")
print(id(t1.users), "\n")
print(type(t1.users), "\n")
print(dir(t1.users), "\n")
print(callable(t1.users), "\n")
print(list(t1.users), "\n")

OUTPUT

[<Request() object at 0x1ea08ec1518>]

1

<Request() object at 0x1ea08ec1518>

2104683938184

<class 'list'>

['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']

False

[<Request() object at 0x1ea08ec1518>]
Reply
#2
Please, take time to read forum rules and follow them. Use BBCode tags.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Forum Jump:

User Panel Messages

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