我是否需要了解对象,还是可以节省时间并仅学习字典?

我是否需要了解对象,还是可以节省时间并仅学习字典?

问题描述:

可以简短表示=)

我是菜鸟,是的. -.-但是我坚信我不需要学习所有东西..并且适合我的项目的特定知识领域可以节省我的时间..? 我将要构建一款我已经设计但尚未开始构建的游戏. 我将学习完成项目所需的一切.

I'm noob yes. -.- but I'm convinced i don't need to learn everything.. and that a specific field of knowledge suited to my project may save me time..? I'm going to build a game that i have designed but not begun constructing. I'm going to learn everything i need to to get my project finished.

我正在使用python 游戏仅需要引用具有以下值的网格上的位置: 因此,绿色的松树"正方形= *信息*值=树的类型/树的硬度/树的寿命等...

I'm using python the game needs only to reference locations on a grid with values: so a green 'pine tree' square = *information *values = tree type / tree's hardness / tree's life ect...

假设没有对象,我也许是错误的?我是否应该将所有时间都花在学习如何使用字典功能上. 模拟每转变化的基于网格的拼贴游戏最有效的编码是什么.

I am perhaps wrong in the assumption there are no objects needed? should i focus all my time on learning how to use the dictionary's function.. what is the most efficient coding for a grid based tile game that simulates change per turn.

这样;一个蓝色方块会根据一组规则并在回合结束时根据相邻的图块展开.而且这些磁贴具有附加值...?甚至只是最佳可行技术的名称...一旦知道了我需要学习的东西,我就可以学习如何做...

So that; a blue square spreads according to sets of rules and according to the adjacent tiles at the end of a turn. And these tiles have values attached...? even just the name of the best feasible technique... i can learn how to do it once i know what i need to learn...

没有对象,任何大小的Python项目都将变得无法管理.

Any Python project of any size will become unmanageable without objects.

是否可以将模块用作您的对象而不是类?是的,如果您确实想要的话. (在Python中,模块就是您所谓的单个文件.)

Is it possible to use modules as your objects instead of classes? Yes, if you really want to. (In Python, a module is what you call a single file.)

但是,即使您没有创建用户定义的类,您仍然需要学习如何使用对象.

However, even if you aren't creating user-defined classes, you still need to learn how to use objects.

为什么?因为 一切是Python中的对象.您至少需要 知道如何使用对象来了解如何使用Python中的内置类型和函数.

Why? Because everything is an object in Python. You need to at least know how to use objects to understand how to use the built in types and functions in Python.

在Python中,字典对于内部实现事物非常重要,因此您直觉认为字典可以替代.

In Python, dictionaries are very important to how things are implemented internally, so your intuition that dictionaries would be an alternative is good.

但是词典也是对象,因此您仍然必须学习使用对象,而又不能从简单的字典中受益于它们的易用性.

But dictionaries are objects too, so you'd still have to learn to use objects, without getting the benefit of their ease of use for many things vs. a plain dictionary.

我的建议?编写一个Python教程(或三个). 整个事情.甚至是网络上的部件,或者您认为不会使用的其他任何部件.您将学到一些关于以后将要用到的语言的东西,这是您以后无法预料的.

My advice? Do a Python tutorial (or three). The whole thing. Even the parts on networking, or whatever else you don't think you'll be using. You'll learn things about the language that you'll end up using later in ways you'd never anticipate.

您需要了解元类吗?否.多处理?否.但是您需要学习所有核心语言功能,并且类和面向对象编程 核心语言功能.在几乎所有现代语言中,它是如此重要,以至于人们甚至不再提起它.

Do you need to learn about metaclasses? No. Multiprocessing? No. But you need to learn all of the core language features, and classes and object oriented programming are the core language feature. It's so central to nearly all modern languages that people don't even mention it any more.