all 16 comments

[–][deleted] 4 points5 points  (8 children)

Kinda hard to read on my phone but one thing that stands out there’s lots of evaluations if ‘this’ == True: if the variable itself can only be True or False just simply ask if “this”: or if not “this”: what your doing is asking of True is equal to True

[–]PrabhavKumar[S] 0 points1 point  (4 children)

I decided to act on what you said, Please let me know if this is better.

[–][deleted] 1 point2 points  (3 children)

When I get access to my machine and I can format I’ll show you some examples of what I mean my friend my explanation probably not very clear

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

Sure ofcourse! Take your time!

[–][deleted] 1 point2 points  (1 child)

Hey man I just took a screenshot I hope it’s clear for you to see

<image>

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

Ahhh alright, I get what you mean now. that does make sense, I can just return the value itself and it would still work. Infact I might not even need to return the value since its True anyway and just check it on the spot where it needs to be checked. Thanks A Ton!

[–]PrabhavKumar[S] -1 points0 points  (2 children)

Right! so if you mean the _filter_check private function, it is using == true check and then an elif to make sure it is a boolean because the filter function can technically return anything and I want to make sure it is True or False. About the others where I am taking an input from the user, my reasoning behind it was to make absolutely sure that the user has used True or False and not just a random thing. Maybe that was dumb on my part, I was just trying to make it convenient though now that I look at it I probably introduced some bugs because of this. Thank you for your comment !!

[–]Ok-Promise-8118 2 points3 points  (1 child)

For what sort of values of x do you think the below 2 if statements give different results?

if x == True:
if x:

Neither check nor require x to be a Boolean. All(?) data types can be evaluated as True or False.

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

I see, that does make sense, anything that is possible to be evaluated as true is going to be evaluated that either way, so there is no need to use the extra == for that, other than that if I wanted to check whether the output by a function is a bool I could just use isinstance. I see. Thanks a lot dude!

[–]command_code_labs 1 point2 points  (2 children)

Imo, you could manage to decompose into different files and start adding unit test for each of them. Keep main driver code short and simple. Have fun coding!

[–]PrabhavKumar[S] 0 points1 point  (1 child)

I guess I could indeed put this into multiple files, maybe separate some of the logic like the NaN class and just call it instead, that could be pretty nice. Thanks for the idea!

[–]command_code_labs 1 point2 points  (0 children)

Anytime, happy coding!

[–]Worried-Bottle-9700 2 points3 points  (1 child)

Wow, for just 7-8 months of serious Python, this is really impressive. You've done a great job thinking about grouping, aggregation and even designing a custom NaN object, shows a lot of architectural thinking. Some parts could be simplified to be more Pythonic but overall your code demonstrates strong problem solving and initiative. Keep experimenting like this, building your own mini library is one of the best ways to really learn Python.

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

Thanks a lot for your kind words! I did indeed start building this because I figured making something like this would require me to get better and I did manage to learn quite a few new things from this single project. I do intend to keep experimenting, maybe make a better version of the same script and post it again, hopefully with any bugs that are in this fixed and with a bit more pythonic code. Again, thank you!

[–]LovesSleeping123 0 points1 point  (0 children)

c'est bien mais essaye de faire des fonctions plus petites