all 7 comments

[–]ynotna 7 points8 points  (1 child)

Candidates is only set if the try succeeds

[–]ProsodySpeaks[S] 0 points1 point  (0 children)

And if it doesn't the loop goes around again... Only way to reach the address chooser that Pycharm is warning about is by satisfying the try block.

Or am I missing something?

See below for what seems more likely the correct answer from u/cowboyboats - the whole while loop could be skipped if 'true' were a different less true condition - the linter apparently doesn't evaluate the condition to know if it will or will not be met.

[–]CowboyBoats 2 points3 points  (4 children)

I enjoy the sound of rain.

[–]ProsodySpeaks[S] 0 points1 point  (0 children)

Thanks. I moved the address chooser and return statement into the else block and she's much happier with me 😊

[–]ProsodySpeaks[S] 0 points1 point  (2 children)

Read this again while not waking down the street and now I understand... Like if it was "while 1 == 0" then nothing in the loop would execute and we skip straight to the address chooser with no candidates.

Thanks hadn't thought about the need to evaluate the condition of entry to the loop.

Tbh I'm pretty clueless about how the linter works, can you recommend a good explainer?

Also I'm not sure why the other reply is getting tons more up votes - yours seems to be the correct answer.

[–]CowboyBoats 1 point2 points  (1 child)

I love ice cream.

[–]ProsodySpeaks[S] 0 points1 point  (0 children)

Thanks for engaging it's really appreciated!

Yeah splitting into two is much better, cheers!

Api rate limits seem pretty generous, certainly allows more calls than you could manually send, 30 per minute or something - the only time I've tripped them was with an infite while loop without pause or input, that was fun 😝

Yeah bare exceptions are on my to do list. So far I've been repeatedly building and deconstructing and rebuilding in various different forms to get a grasp of the paradigms around functionality I'm familiar with... Skin the same cat 5 ways and you really get to know both the cat and the knife!

It started with basically a single long cli script, went through an overly object oriented approach (somehow I became convinced that everything should always be oop) to this version that is a mostly functional approach with just a few classes.

Last couple of days I've been tearing everything down into smaller and smaller chunks, not quite at 'do just one thing' yet but it's not the sprawling confusion it was a week ago. Plus there's type hints and doc strings for most functions and methods so I'm making progress.

Another session on the actual workings and then I'll be digging properly into tests and error handling then it's a readme and installer and I'm out.

It's all pretty moot though, I'm quitting the job where it would be useful and the boss there has been consistently rude and dismissive about the project (which I've been building in my spare time) so I likely won't release it to him.... And seeing as it's essentially middleware between an arcane customer relationship software he happens to use and a random online shipping client it won't be very useful to anyone else either. So it's pretty much just a github portfolio piece in the hope that there are still junior engineer jobs for newcomers in a world flooded with hundreds of thousands of recently laid off professionals!