Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Script Another Discrepency
#7
A quick question about the direct api, from the docs how do you tell when a tuple is expected.

I wanted to get the offsets for a layer so I tried calling 'layer.get_offsets()' like
Code:
x,y = layer.get_offset()


This resulted in an error. I checked the docs for get_offsets and it listed return value as boolean, so I thought maybe wrong function and at the time I was tired so I just used the old way using pdb.

Today I took the time to look at the type hints and see it returns a tuple of success,x,y, so I fixed things.  So when using the api docs can I assume that if the description says it returns  x and the return value is boolean, that the function will return a tuple of boolean,x ?

Thanks
Reply


Messages In This Thread
RE: Python Script Another Discrepency - by Ofnuts - 04-01-2025, 09:36 PM
RE: Python Script Another Discrepency - by Ofnuts - 04-01-2025, 10:14 PM
RE: Python Script Another Discrepency - by Ofnuts - 04-01-2025, 11:42 PM
RE: Python Script Another Discrepency - by silenuznowan - 04-02-2025, 02:04 PM
RE: Python Script Another Discrepency - by Ofnuts - 04-03-2025, 09:13 AM

Forum Jump: