Relative Content

Tag Archive for python-3.x

Is it better practice to set default values for optional argparse arguments?

I mention python’s argparse as an example but this would apply to any CLI argument parser library for any language. Just generally speaking, at a high level, if there are a lot of optional arguments for my application, should these arguments’ values be set to at least something, even if its a falsy value?

Is this function correct

import MT5Manager # Create a ManagerAPI object manager = MT5Manager.ManagerAPI() # Connect to the MT5 terminal manager.Connect(“localhost”, 443, “admin”, “password”, MT5Manager.ManagerAPI.EnPumpModes.PUMP_MODE_FULL) # Create a new user new_user = manager.CreateUser( username=”newuser”, password=”newpassword”, group=”users”, email=”[email protected]”, phone=”1234567890″, country=”Country”, city=”City”, address=”Address” ) # Print the login of the newly created user print(new_user.Login) # Disconnect from the MT5 terminal manager.Disconnect() […]

Is this function correct

import MT5Manager # Create a ManagerAPI object manager = MT5Manager.ManagerAPI() # Connect to the MT5 terminal manager.Connect(“localhost”, 443, “admin”, “password”, MT5Manager.ManagerAPI.EnPumpModes.PUMP_MODE_FULL) # Create a new user new_user = manager.CreateUser( username=”newuser”, password=”newpassword”, group=”users”, email=”[email protected]”, phone=”1234567890″, country=”Country”, city=”City”, address=”Address” ) # Print the login of the newly created user print(new_user.Login) # Disconnect from the MT5 terminal manager.Disconnect() […]