![]() This statement is a bit of a simplification and I'll expand on it pretty soon it has been defined in the current program flow (as in you wrote a def or a class or just a plain 'ol assignment statement to make it mean something.Try typing those in an interpreter and see what happens it is a part of the defaultPython environment.For this to be true it has to satisfy one of the following conditions: You'll get a similar result for doing this: print my_undefined_variableįor datetime (or anything really) to be considered defined, it has to accessible from the current scope. Apparently Python doesn't know what datetime means - datetime is not defined. Try typing the following into a Python console: oTime = () But most things you will want to do will need a little more than that. Some things are built in, for example the basic types (like int, float, etc) can be used whenever you want. You can't use anything in Python before it is defined. To use any package in your code, you must first make it accessible. Virtual environments, while definitely worth using, do invoke some confusion, so I'll then take you through a little bit of how virtual environments change the import system. Once we've covered the basics of importing, we'll talk about version conflicts and introduce a common tool used for avoiding such conflicts - the virtual environment. This tutorial goes over the mechanism of importing those packages - making extra functionality (maybe someone else's code) accessible to your code. Python gets a lot of its power from the packages it installs by default and those that you can install yourself. So what is this about?Īny monologue about the strengths of a popular language is going to touch on the strength of the tools accessible to that language, and Python is no different. As a beginner Python developer I was once faced with sifting through a million tutorials to get my head around this stuff, and I've been asked about it enough times that it's pretty obvious that something is missing in tutorial space. But there are a lot of overly technical, incomplete, incorrect or just wrong ones out there.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |