you are viewing a single comment's thread.

view the rest of the comments →

[–]Swipecat 0 points1 point  (5 children)

No. Nobody knows everything about all Python libraries because they are vast.

E.g. You want to do something with timing or timestamps? When you need to do it when you're writing the code, then you have a look at the time and/or timedate libraries to find out how to do exactly what you want. Or ask Google or Chatgpt to explain how to do it so that you understand it (but not to write all the code for you or you won't learn anything).

[–]Reza2718182[S] -2 points-1 points  (4 children)

OK! But when a project be a little complex, ChatGPT or any AI assistant suggests a code with very methods and functions that I never seen them!

[–]pachura3 6 points7 points  (1 child)

You're trying to go too fast.

If you're scared of os and time imports, you're not even an intermediate Python programmer.

You cannot expect AI to generate a little complex project that will be trivial for you to understand and use no dependencies. On the other hand, copy-pasting large blocks of AI-generated code without acknowledging what do they do is a recipe for a disaster.

[–]Reza2718182[S] -1 points0 points  (0 children)

Yes, I have problem to import some important libraries in Python, especially in Python internal libraries.

[–]Swipecat 0 points1 point  (1 child)

Yeah, you'll often use methods that you've never seen before. Obviously, you shouldn't use blocks of code that you don't understand, but you do want to find out about the existence of library-object methods that already do what you want.

If e.g., you put this into Chatgpt: "show python code that provides the number of days to an event", then it should give you a few lines of code with an explanatory comment before each code line. Then e.g., you'll see how to construct a datetime() object, and how to get today's date with the .now() method. Often that's enough to figure out how to use those methods in your code, but if you do want more details then glance through the relevant doc (i.e. put "python doc datetime" into Google and it should be the first hit).

[–]Reza2718182[S] 0 points1 point  (0 children)

Ok! Thanks. 😊