[Tutor] Why not to use include?

Dotan Cohen dotancohen at gmail.com
Mon Jun 9 18:21:23 CEST 2008


2008/6/9 W W <srilyk at gmail.com>:
>> Thanks, Wayne, I am actually aware of this method. But it seems that
>> what I really want _is_ a function, and not a simple include.
>
> When you say function, exactly what are you referring to? Because
> really all a function *is* is a set of statements that
>
> takes input*
> does something*
> gives output*
>
> *optional
>
> For instance, in PHP, include('header.php') is a function that works
> similar to the few lines of code I wrote earlier.
>
> the input to the include function is the filename, the process or
> "does something" is it opens the file, and the output is returning it
> into the php file.
>

I was doing this in PHP:
$title="Page title";
include"/path/to/header.php";

In Python I suppose that I will do something like this:
makeHeader("Page title")

I would define makeHeader() in a class, so that I could use it (and
other functions) across multiple pages.

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


More information about the Tutor mailing list