I’m having trouble with this… Basically, whenever I try to use part of Python, from the manual, I almost always have no idea what to import. I tried the documentation, and it’s not really helping me… I don’t know what to do, really.
Is there an easy way for me to find out what the right import command is for each command in the manual? Failing that, what do I have to import to use Lerp Intervals?
In order to use a class, you need to import it from its module. You can find the exact name of that module in the documentation of the class inside its page in the API reference.
For example, if you want to use LerpFunc, you can go to its page, you can retrieve its module (interval.LerpInterval), and you obtain this sentence:
Ah. Direct is what I was missing when I tried doing just that. The little mistakes that cost you hours of your life… barely avoids putting axe through monitor
Is it equally possible to import it in the method “import direct.interval as x”?
He has a point though. I remember some manual pages dont show what import you need. I think it was either the Interval page or Task page. I dont remember the rest.
Most do.
Ok, but I think that it’s better if you have no duplicate information (otherwise you’ll have inconsistencies between manual and reference if, for example, you move a class from one module to another), and I think that the best position for this thing is in the API reference. A useful contribution may be a link from wiki to reference, but I don’t think this is worthwhile the effort, at the end it’s only a search.
Sorry, but Im completely against your suggestion. 99% of the other manual pages do tell you what to import so i think most share my opinion. Do you imagine complete newbies being told to go to Python reference to know what to import to be able to run the scripts in the manual?
And what for? Simply because the import structure might change one day (and that, if will ever happen, might be in years to come)?
Its just not worth it.
Most of the manual pages were updated after the new importing mechanism was added in 1.7.0, and also the old ways of importing is still valid.
Ok, but I don’t think that the entire manual should be written for complete newbies. I agree with this point of view for the introductory part. But, again, it’s only an opinion, the value of the manual is very high. Maybe my opinion is misleaded because I see the manual as a digital version of a potential paper manual, a book. In a book you discuss only relevant parts of code (and imports aren’t so relevant imho), and provide the entire working code (and assets) somewhere (zip files on CD or internet, …). So, the text is focused on the important (conceptual) parts, and for technical aspects (like imports) you can easily find all the stuff you need. But again, I understand your opinion, and I see that I’m inside the 1% quota.
And often theres a complete, working out-of-the-box, ‘summary’ code in the end of the chapter/section/etc which has it.
But this isnt important. Im not saying every code snippet in the manual should have an include or ‘run()’/work out of the box, its just that why should you go to another documentation page just to find out what you need to include? You argue that the classes might be moved/renamed and we will need to update both the manual and reference, but it happens soo seldom that its just not worth it in my opinion.
well since this topic is solved, I don’t see any problem.