nschloe / termplotlib

:chart_with_upwards_trend: Plotting on the command line
GNU General Public License v3.0
673 stars 19 forks source link

this will help people understand that it need to be a list #32

Closed orena1 closed 5 years ago

nschloe commented 5 years ago

It'd be lovely if this worked, however:

Don't use a empty list as default argument in Python.

https://docs.python.org/3/reference/compound_stmts.html#function-definitions

https://stackoverflow.com/questions/366422/what-is-the-pythonic-way-to-avoid-default-parameters-that-are-empty-lists

orena1 commented 5 years ago

Thank for the info ,so I assume a function definition is needed. Anyway, thanks for the package, it is great for fast and easy monitoring cluster queue!

zzz4zzz commented 5 years ago

If you don't care about python2 you can just declare typing:

def plot(
    x,
    y,
    width: int=80,
    height: int=25,
    label: Optional[str]=None,
    xlim: Optional[Tuple[float, float]]=None,
    ylim: Optional[Tuple[float, float]]=None,
    xlabel: Optional[str]=None,
    title: Optional[str]=None,
    extra_gnuplot_arguments: Optional[List[str]]=None,
    plot_command: str="plot '-' w lines",
    ticks_scale: float=0,
):
orena1 commented 5 years ago

Looks good, anyway pip2 is not supported: pip3 install -U termplotlib