RE: First commit to spltools, a python package for working with Splinterlands data.

avatar
(Edited)

You are viewing a single comment's thread:

Awesome, thanks for the feedback.

I was not aware that snake_case was a PEP. I have just at some point gotten used to CamelCase or mixedCase so those are my defaults. I will adapt to snake_case for Python then.

The HTTPAdapter setup is appropriate when you call the API repeatedly right? I've not tried using that class but it looks simple enough. When I get to calls like that I might just steal your code ;)



0
0
0.000
1 comments
avatar

Especially when you get to code to retrieve all balances for example.

This needs more than one call to the spl api at this point you need to address a back-off/retry strategy. Also if for some reason the spl api gives a other return then successful like 502.

No problem with using my code as inspiration or copy/paste 😁, I'm also not official developer just learning as wel.

I also like camelcase more for my java programs 🤣.

This is what chatgpt think PEP8 should look like for class functions and variables.

class MyClassName:
    """A simple example class following PEP 8 style."""

    def __init__(self, first_value, second_value):
        """Initialize the class with two variables."""
        self.first_value = first_value
        self.second_value = second_value

    def calculate_sum(self):
        """Calculate the sum of the two values."""
        return self.first_value + self.second_value

# Usage
my_object = MyClassName(first_value=10, second_value=20)
result = my_object.calculate_sum()

print(f"The sum is: {result}")

But using classes and going object oriented (OOP) with python is another great topic on what todo with it😁.

0
0
0.000