On 12/02/2014 11:32 PM, Skybuck Flying wrote:
Some issues I'd like to address to you:

1. Structured programming requires more programming time.
2. Structured programming implies structure which might be less flexible.
3. Python objects require "self" keyword to be used everywhere, and
other akwardness wich leads to more typing/programming/writing time.

I used the list feature of python to dump these variable in a list so
that all variables can be processed by a while loop and so forth.

Care to share what you mean by "the list feature"? Perhaps you'd do better with "the dict feature", or "the attribute feature."


At first I wanted flexibility and all variables were individually
"logic-ed" / "processed" but this became too much code to work with.

No meaning without an example.


I was also under the impression using many ifs might be faster than
lists, but this was bogus information at best.

They do entirely different things. Without example code, this statement is also meaningless to me.


I wrote a simple short benchmark for if vs list and list performed fast
enough for my purposes, it could both handle 500k of items without
breaking a sweat, meaning within 1 to 3 seconds or so.

I am still new at python and definetly don't feel comfortable with the
object feature, though I did use it for these variables which are
actually objects.

Everything in Python is an object, from ints to functions. That makes lots of things easier and more symmetric.


I used to program in Delphi, there I would do everything OO and modular.

So why do you no longer want to do that?


Lastly I also don't like the module approach in python because the
sikuli ide doesn't really support working with multiple files that well.

So don't use modules. Nothing about the language forces you to. The main time you might need modules is when you write your second program. Of course, it's nice that somebody else wrote lots of modules for you, the standard library, and PIPI.


Python also comes with nice libaries/lists/dictionaries/file io etc..
all easy to use...

I haven't tried networking with python yet... that could be funny to try
next for my bots :)

Anyway this global thing made my doubt if python is a good thing... all
in all it wasn't too bad...

You still haven't figured out that declaring the occasional global is much less typing than declaring every local. If you're writing code that's mostly using globals, you probably should investigate the tens of thousands of other languages.


Though I do hope to see a programming language some day, that is aimed
at more mature programmers that know what they are doing.

Instead of a language aimed at noobs :) a noob language which forbids
certain styles of programming because it would be "bad".

That's ridiculous. Python is far from a "noob" language. But when you're a noob, and can still get things accomplished, that's a good thing. Then when you're ready to learn more about the language, asking non-confrontational questions might get you some help.

I suggest you learn enough about classes to understand how to make and utilize an object with arbitrary attributes. Even if you did something as crude as:

class Dummy(object):
    pass

global = Dummy()
global.ShipAbilityDistributeShieldPower = 42
global.ShipAbilityTargetWeaponsSubsystems = 12
...

You can then read and write those values inside functions with no global declarations at all.

def myfunc():
    if    something:
        global.ShipAbilityDistributeShieldPower = 2



--
DaveA
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to