Re: A trivial question that I don't know - document a function/method

2022-10-24 Thread Mats Wichmann
On 10/23/22 14:20, Paulo da Silva wrote: Às 21:58 de 22/10/22, Paulo da Silva escreveu: Hi all! What is the correct way, if any, of documenting a function/method? Thank you all for the, valuable as usual, suggestions. I am now able to make my choices. Paulo It also matters whether you exp

RE: A trivial question that I don't know - document a function/method

2022-10-24 Thread Schachner, Joseph (US)
22, 2022 4:58 PM To: python-list@python.org Subject: A trivial question that I don't know - document a function/method Hi all! What is the correct way, if any, of documenting a function/method? 1. def foo(a,b): """ A description. a: Whatever 1

Re: A trivial question that I don't know - document a function/method

2022-10-23 Thread Karsten Hilbert
Am Sun, Oct 23, 2022 at 05:16:48PM -0400 schrieb Thomas Passin: > > def make_title_from_headline(self, p, h) -> str: > > > > def plot(self, stackposition=MAIN, clearFirst=True) -> None: > 1. Knowing the type of a parameter isn't all you usually want to know; Sure, as I said: > >and use

Re: A trivial question that I don't know - document a function/method

2022-10-23 Thread Paulo da Silva
Às 21:58 de 22/10/22, Paulo da Silva escreveu: Hi all! What is the correct way, if any, of documenting a function/method? Thank you all for the, valuable as usual, suggestions. I am now able to make my choices. Paulo -- https://mail.python.org/mailman/listinfo/python-list

Re: A trivial question that I don't know - document a function/method

2022-10-23 Thread Thomas Passin
On 10/23/2022 2:37 PM, Karsten Hilbert wrote: Am Sat, Oct 22, 2022 at 09:49:55PM -0400 schrieb Thomas Passin: def make_title_from_headline(self, p, h): """From node title, return title with over- and underline- strings. ... RETURNS a string """ def plot(self,

Re: A trivial question that I don't know - document a function/method

2022-10-23 Thread Karsten Hilbert
Am Sat, Oct 22, 2022 at 09:49:55PM -0400 schrieb Thomas Passin: > def make_title_from_headline(self, p, h): > """From node title, return title with over- and underline- strings. ... >RETURNS >a string > """ > def plot(self, stackposition=MAIN, clearFirst=True): > "

Re: A trivial question that I don't know - document a function/method

2022-10-22 Thread Thomas Passin
ons are welcome. Thanks. Paulo This is not a trivial question - not because it is hard but because it is important, and more so when someone else needs to work with your code. It's surprising how easy it is to forget these details about even your own code. Here are some examples of ho

Re: A trivial question that I don't know - document a function/method

2022-10-22 Thread Dan Stromberg
I don't think there is a "correct" way. It depends somewhat on what tools you're using. I like pydocstyle, which I have hung off of vim with syntastic. pydocstyle checks for https://peps.python.org/pep-0257/ conformance. Also, rather than describe the types of formal parameters to functions in

A trivial question that I don't know - document a function/method

2022-10-22 Thread Paulo da Silva
Hi all! What is the correct way, if any, of documenting a function/method? 1. def foo(a,b): """ A description. a: Whatever 1 b: Whatever 2 """ ... 2. def foo(a,b): """ A description. a -- Whatever 1 b -- Whatever 2 """

Re: A Trivial Question

2011-09-29 Thread alex23
On Sep 29, 8:06 am, Chris Rebert wrote: > Try this: > > def trial(): >     class Foo(object): >         def __init__(self): >             print("Hello, world!") >     Foo() > trial() While this will display "Hello, world!" in the way required, with a slight adjustment you end up with something po

Re: A trivial question

2011-09-29 Thread jitendra gupta
HI The class Foo you have defined is local NameSpace for trial functioon, for details http://docs.python.org/tutorial/classes.html def trial(): class Foo(object): def __init__(self): print("Hello, world!") lacalClass = Foo() >>>trial "Hello, world!" Thanks Jitendra On Thu, Sep 29, 2011 at

A trivial question

2011-09-29 Thread Tayfun Kayhan
I accidentally wrote such a code (below) while trying to write sth else for my application but i am now just wondering much how to run the class Foo, if it is possible. Is not it weird that Python does not give any error when I run it ? Sorry for that it's pretty unimportant question according t

Re: A Trivial Question

2011-09-28 Thread Chris Angelico
On Thu, Sep 29, 2011 at 7:53 AM, Tayfun Kayhan wrote: > def trial(): >class Foo(object): > def __init__(self): > print("Hello, world!") > trial() # not worked, as expected. Python doesn't have "class declarations" in the way that some other languages do. The 'class' statement i

Re: A Trivial Question

2011-09-28 Thread Chris Rebert
On Wed, Sep 28, 2011 at 2:53 PM, Tayfun Kayhan wrote: > I accidentally wrote such a code (below) while trying to write sth else for > my application but i am now just wondering much how to run the class Foo, if > it is possible. Is not it weird that Python does not give any error when I > run it ?

A Trivial Question

2011-09-28 Thread Tayfun Kayhan
I accidentally wrote such a code (below) while trying to write sth else for my application but i am now just wondering much how to run the class Foo, if it is possible. Is not it weird that Python does not give any error when I run it ? Sorry for that it's pretty unimportant question according t