« first day (5018 days earlier)      last day (149 days later) » 

06:41
Am I the only one who feels confused about this chat UI ?
07:23
@Aran-Fey Yikes! Is the type checker treating UserId itself as a str subtype? Then str(1234) would mean UserId(1234) "works"...
Seems like a bug, to be honest.
07:42
Hm, both PyRight and MyPy complain about the UserId(1234) call for me.
Good morning, has isinstance ever failed on you? I wonder if preferable to compare id instead
id and isinstance do completely different things. oO
id(instance.__class__) == id(ImportedClass)
If you want that, just check instance.__class__ == ImportedClass.
or type(instance) is ImportedClass
but isinstance critically also checks inheritance.
Indeed... I am experiencing some weird behaviour where isinstance(instance, ImportedClass) occassionally does not work, so I wondered if it is more prone to errors due to e.g. order of imports or something.
07:54
isinstance has well-defined behaviour. If it says no, that's the situation.
You should rather investigate why instance isn't a subclass-instance of ImportedClass.
My crystal ball says not to touch sys.path, by the way.
The strange thing is it works 5 times and then suddenly I get this error. Could be editor thingy? I use os.chdir.
This isn't an editor thingy, nor something random. You are veritably dealing with an instance that is not an ImportedClass.
Now it has not happened for about 10 observations. I will try to create minimum replicable problem if it starts again. Cheers.
@MisterMiyagi is any of your bigger code projects available in public repo?
Most of my personal and work Python projects are on GitHub.
08:10
@MisterMiyagi Huh, you're right. I guess my vscode at work must be misconfigured somehow
Well, I do have the type checking settings cranked up to twelve precisely because it would let slip some errors otherwise.
Perhaps you've got some lenient defaults active.
 
4 hours later…
12:02
@MisterMiyagi Think I identified the root cause. Check isinstance(instance, ImportedClass) fails after modifying a class attribute in ImportedClass before re-executing. I suspect the editor does not clear some variables prior to new execution.
12:15
That's generally not how Python works.
Are you running an interactive session, e.g. via IDLE or Jupyter?
How do you modify the class attribute?
 
3 hours later…
15:42
To add to this, VSCode will also run a Jupyter session so you, too, can have all the joy of the nonsense in your favourite IDE
@roganjosh Jupyter in my IDE? God save us all, what is happening to the world
You just need a smartwatch to count the number of "wtf"s a day and you'll really see the benefit (since higher numbers mean good things with smart device counters, obvs)
16:13
@roganjosh ofc

« first day (5018 days earlier)      last day (149 days later) »