Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Quantopian def make_pipeline(context) and pipe = pipeline() vs def make_pipeline() and return Pipeline() vs pipe = make_pipeline(context) vs pipe = Pipeline()

I am new to python and Quantopian. I have been watching tutorials and reading tutorials and and reading help files and trying to understand how to make a pipeline. However, i keep seeing it created in a few different ways and i am not sure what the differences are. Some start with def and some don't. Some have context in parenthesis and some don't. Some use make_pipeline and some use pipeline. See below.

Style #1
def make_pipeline(context)
pipe = pipeline()

Style #2
def make_pipeline()
return Pipeline()

Style #3
pipe = make_pipeline(context)

Style #4
pipe = Pipeline()

1 response

Ok... So... Basically... As i think i understand it... The best practice is...

def my_pipeline(A) <--- It is best to make a function using "def" and this can be "def my_pipeline()" or "def make_pipeline()" or "def any_name_i_want()"

then some code can go here... or no code can go here

return my_pipeline(B) <--- then you should end like this and it must match my function name, right? or is it supposed to just always be return Pipeline()?

Where "A" can be nothing or context or other things
and
"B" is can be nothing or some code