FAQ
Excuse is: "bad programming style".


I don't need snot telling me how to program after 20 years of programming
experience.


This is so far the only thing pissing me off in python.


Now I have to declare "global" in front of these variables every where I
want to use em:


ShipAbilityDistributeShieldPower
ShipAbilityTargetWeaponsSubsystems
ShipAbilityTargetEnginesSubsystems
ShipAbilityTargetShieldsSubsystems
ShipAbilityTargetAuxiliarySubsystems


CapTactAbilityAttackPatternAlpha
CapTactAbilityFireOnMyMark
CapTactAbilityTacticalInitiative
CapTactAbilityGoDownFighting
CapTactAbilityTacticalFleet




CapEngAbilityRotateShieldFrequency
CapEngAbilityEPSPowerTransfer
CapEngAbilityNadionInversion
CapEngAbilityMiracleWorker
CapEngAbilityEngineeringFleet




CapSciAbilitySensorScan
CapSciAbilitySubnucleonicBeam
CapSciAbilityScatteringField
CapSciAbilityPhotonicFleet
CapSciAbilityScienceFleet




CapSharedAbilityEvasiveManeuvers
CapSharedAbilityBraceForImpact
CapSharedAbilityRammingSpeed
CapSharedAbilityAbandonShip
CapSharedAbilityFleetSupport


BoffTactAbilityBeamArrayFireAtWill
BoffTactAbilityBeamArrayOverload
BoffTactAbilityTacticalTeam
BoffTactAbilityTorpedoHighYield
BoffTactAbilityTorpedoSpread
BoffTactAbilityTargetWeaponsSubsystems
BoffTactAbilityTargetEnginesSubsystems
BoffTactAbilityTargetShieldsSubsystems
BoffTactAbilityTargetAuxiliarySubsystems
BoffTactAbilityAttackPatternBeta
BoffTactAbilityAttackPatternDelta
BoffTactAbilityCannonRapidFire
BoffTactAbilityCannonScatterVolley
BoffTactAbilityDispersalPatternAlpha
BoffTactAbilityDispersalPatternBeta
BoffTactAbilityAttackPatternOmega




BoffEngAbilityEmergencyPowerToAuxiliary
BoffEngAbilityEmergencyPowerToWeapons
BoffEngAbilityEmergencyPowerToEngines
BoffEngAbilityEmergencyPowerToShields
BoffEngAbilityEngineeringTeam
BoffEngAbilityAuxiliaryToBattery
BoffEngAbilityAuxiliaryToDampeners
BoffEngAbilityAuxiliaryToStructural
BoffEngAbilityBoardingParty
BoffEngAbilityDirectedEnergyModulation
BoffEngAbilityExtendShields
BoffEngAbilityReverseShieldPolarity
BoffEngAbilityAcetonBeam
BoffEngAbilityEjectWarpPlasma




BoffSciAbilityHazardEmitters
BoffSciAbilityJamSensors
BoffSciAbilityMaskEnergySignature
BoffSciAbilityPolarizeHull
BoffSciAbilityScienceTeam
BoffSciAbilityTachyonBeam
BoffSciAbilityTractorBeam
BoffSciAbilityTransferShieldStrength
BoffSciAbilityChargedParticleBurst
BoffSciAbilityEnergySiphon
BoffSciAbilityFeedbackPulse
BoffSciAbilityPhotonicOfficer
BoffSciAbilityTractorBeamRepulsors
BoffSciAbilityScrambleSensors
BoffSciAbilityTykensRift
BoffSciAbilityGravityWell
BoffSciAbilityPhotonicShockwave
BoffSciAbilityViralMatrix


SpaceSetAbilityAssimilatedBorgTechnologyTractorBeam
SpaceSetAbilityRomulanSingularityHarnessPlasmaHyperflux
SpaceSetAbilityNukaraStrikeforceTechnologiesUnstableTetryonLattice


UniConAbilityPhotonicShockwaveTorpedo
UniConAbilityTholianWeb
UniConAbilityBattleModule3000BattleMode
UniConAbilityBattleModule3000SwarmMissiles
UniConAbilitySubspaceRupture
UniConAbilityTholianTetryonGrid
UniConAbilityIsometricCharge
UniConAbilitySpatialChargeLauncher
UniConAbilityAcetonAssimilator
UniConAbilitySabotageProbeLauncher
UniConAbilityRepairPlatform
UniConAbilityProjectedSingularity


RepNukAbilityTetryonCascade


InvAbilitiesNimbusPirateDistressCall


CarrierAbilityPetAttackMode


PetAbilityLaunchEliteTholianMeshWeavers
PetAbilityLaunchAdvancedObeliskSwarmers
PetAbilityLaunchEliteScorpionFighters


SingCoreAbilityPlasmaShockwave
SingCoreAbilityQuantumAbsorption


WarpCoreShieldCapacitator


KlingonCaptAbilityBattleCloak

Search Discussions

  • Chris Angelico at Dec 3, 2014 at 2:35 am

    On Wed, Dec 3, 2014 at 1:27 PM, Skybuck Flying wrote:
    I don't need snot telling me how to program after 20 years of programming
    experience.

    This is so far the only thing pissing me off in python.

    Now I have to declare "global" in front of these variables every where I
    want to use em:

    Well, I'm not snot, and I also have 20+ years' programming
    experience... and I'm telling you that using that many globals is a
    poor way to write code. Especially having so many separate, but
    related, variables. If your two decades' experience were at all like
    mine, you'll have worked with quite a lot of languages, and you'll
    know to code to a language's strengths rather than fighting against
    it. On the other hand, if you've been working with one language for
    twenty years, then maybe you'd do better to stick to it than to try to
    learn something new. But either way, don't expect Python to behave
    like <insert other language here>, because if it did, what would be
    the point of having both?


    ChrisA
  • Clayton Kirkwood at Dec 3, 2014 at 2:53 am
    You're still young, enjoy your youth while you can.

    -----Original Message-----
    From: Python-list [mailto:python-list-
    bounces+crk=godblessthe.us at python.org] On Behalf Of Skybuck Flying
    Sent: Tuesday, December 02, 2014 6:28 PM
    To: python-list at python.org
    Subject: Python handles globals badly.

    Excuse is: "bad programming style".

    I don't need snot telling me how to program after 20 years of
    programming experience.

    This is so far the only thing pissing me off in python.

    Now I have to declare "global" in front of these variables every where I
    want to use em:

    ShipAbilityDistributeShieldPower
    ShipAbilityTargetWeaponsSubsystems
    ShipAbilityTargetEnginesSubsystems
    ShipAbilityTargetShieldsSubsystems
    ShipAbilityTargetAuxiliarySubsystems

    CapTactAbilityAttackPatternAlpha
    CapTactAbilityFireOnMyMark
    CapTactAbilityTacticalInitiative
    CapTactAbilityGoDownFighting
    CapTactAbilityTacticalFleet


    CapEngAbilityRotateShieldFrequency
    CapEngAbilityEPSPowerTransfer
    CapEngAbilityNadionInversion
    CapEngAbilityMiracleWorker
    CapEngAbilityEngineeringFleet


    CapSciAbilitySensorScan
    CapSciAbilitySubnucleonicBeam
    CapSciAbilityScatteringField
    CapSciAbilityPhotonicFleet
    CapSciAbilityScienceFleet


    CapSharedAbilityEvasiveManeuvers
    CapSharedAbilityBraceForImpact
    CapSharedAbilityRammingSpeed
    CapSharedAbilityAbandonShip
    CapSharedAbilityFleetSupport

    BoffTactAbilityBeamArrayFireAtWill
    BoffTactAbilityBeamArrayOverload
    BoffTactAbilityTacticalTeam
    BoffTactAbilityTorpedoHighYield
    BoffTactAbilityTorpedoSpread
    BoffTactAbilityTargetWeaponsSubsystems
    BoffTactAbilityTargetEnginesSubsystems
    BoffTactAbilityTargetShieldsSubsystems
    BoffTactAbilityTargetAuxiliarySubsystems
    BoffTactAbilityAttackPatternBeta
    BoffTactAbilityAttackPatternDelta
    BoffTactAbilityCannonRapidFire
    BoffTactAbilityCannonScatterVolley
    BoffTactAbilityDispersalPatternAlpha
    BoffTactAbilityDispersalPatternBeta
    BoffTactAbilityAttackPatternOmega


    BoffEngAbilityEmergencyPowerToAuxiliary
    BoffEngAbilityEmergencyPowerToWeapons
    BoffEngAbilityEmergencyPowerToEngines
    BoffEngAbilityEmergencyPowerToShields
    BoffEngAbilityEngineeringTeam
    BoffEngAbilityAuxiliaryToBattery
    BoffEngAbilityAuxiliaryToDampeners
    BoffEngAbilityAuxiliaryToStructural
    BoffEngAbilityBoardingParty
    BoffEngAbilityDirectedEnergyModulation
    BoffEngAbilityExtendShields
    BoffEngAbilityReverseShieldPolarity
    BoffEngAbilityAcetonBeam
    BoffEngAbilityEjectWarpPlasma


    BoffSciAbilityHazardEmitters
    BoffSciAbilityJamSensors
    BoffSciAbilityMaskEnergySignature
    BoffSciAbilityPolarizeHull
    BoffSciAbilityScienceTeam
    BoffSciAbilityTachyonBeam
    BoffSciAbilityTractorBeam
    BoffSciAbilityTransferShieldStrength
    BoffSciAbilityChargedParticleBurst
    BoffSciAbilityEnergySiphon
    BoffSciAbilityFeedbackPulse
    BoffSciAbilityPhotonicOfficer
    BoffSciAbilityTractorBeamRepulsors
    BoffSciAbilityScrambleSensors
    BoffSciAbilityTykensRift
    BoffSciAbilityGravityWell
    BoffSciAbilityPhotonicShockwave
    BoffSciAbilityViralMatrix

    SpaceSetAbilityAssimilatedBorgTechnologyTractorBeam
    SpaceSetAbilityRomulanSingularityHarnessPlasmaHyperflux
    SpaceSetAbilityNukaraStrikeforceTechnologiesUnstableTetryonLattice

    UniConAbilityPhotonicShockwaveTorpedo
    UniConAbilityTholianWeb
    UniConAbilityBattleModule3000BattleMode
    UniConAbilityBattleModule3000SwarmMissiles
    UniConAbilitySubspaceRupture
    UniConAbilityTholianTetryonGrid
    UniConAbilityIsometricCharge
    UniConAbilitySpatialChargeLauncher
    UniConAbilityAcetonAssimilator
    UniConAbilitySabotageProbeLauncher
    UniConAbilityRepairPlatform
    UniConAbilityProjectedSingularity

    RepNukAbilityTetryonCascade

    InvAbilitiesNimbusPirateDistressCall

    CarrierAbilityPetAttackMode

    PetAbilityLaunchEliteTholianMeshWeavers
    PetAbilityLaunchAdvancedObeliskSwarmers
    PetAbilityLaunchEliteScorpionFighters

    SingCoreAbilityPlasmaShockwave
    SingCoreAbilityQuantumAbsorption

    WarpCoreShieldCapacitator

    KlingonCaptAbilityBattleCloak

    --
    https://mail.python.org/mailman/listinfo/python-list
  • Michael Torrie at Dec 3, 2014 at 3:13 am

    On 12/02/2014 07:27 PM, Skybuck Flying wrote:
    Excuse is: "bad programming style".

    I don't need snot telling me how to program after 20 years of programming
    experience.

    This is so far the only thing pissing me off in python.

    Now I have to declare "global" in front of these variables every where I
    want to use em:

    Only if you want to overwrite them, though. Python has support for any
    number of programming paradigms. That many global variables is
    screaming for some kind of organization and Python has good mechanisms
    for doing this in a much neater way. Might I suggest you use a namespace
    instead? Put all your "globals" in a module, and refer to them via the
    module. For example (converting to pep8 which looks better to me):


    import globals as g


    def some_func():
        g.ship_ability_distribute_shield_power = 5


    A whole lot cleaner than trying to use the global keyword everywhere.


    If you've really been programming for 20 years, surely you're familiar
    with programming patterns. The fact that you have 6 variables all
    prefixed with "ShipAbility" should suggest something to you. Like maybe
    all of these attributes could be encapsulated in one "ship" object.
    Python is very flexible in how you use objects. You can program in
    strict java-style if you want, or adopt a more freeform approach:


    ship = object()
    ship.ability = object()
    ship.ability.distribute_shield_power = 5
    etc.
  • Ben Finney at Dec 3, 2014 at 3:21 am

    "Skybuck Flying" <skybuck2000@hotmail.com> writes:


    I don't need snot telling me how to program after 20 years of
    programming experience.

    If you've already determined what advice you do or do not need, then
    you're welcome to solve your problems by yourself.


    We'll be here when you decide it's time to humble yourself to the point
    where you can ask for advice without assuming you already know best.


    --
      \ ?But Marge, what if we chose the wrong religion? Each week we |
       `\ just make God madder and madder.? ?Homer, _The Simpsons_ |
    _o__) |
    Ben Finney
  • Skybuck Flying at Dec 3, 2014 at 4:17 am
    Meanwhile...


    I modified my code, and added these globals in front of it.


    It didn't take too long to do.


    But it did add something like 300 "unnecessary" lines of code, which is what
    kinda annoys me.


    I'd like to keep my code compact.


    Anyway I double checked to make sure other routines had global for other
    variables as well.


    Perhaps I made some programming mistakes which went unnoticed because of
    smart code handling optimizations and such.


    But because the global was omitted perhaps those optimizations never kicked
    in.


    I am not completely sure, but so far my bot seems to run real fast.


    Personally I do not like the way "global" works in python... it sucks quite
    bad, because it's confusing and inconsistent as hell and it doesn't do
    anything usefull example:


    a = 1


    def Test()
         if a == 1:
             print "hello"
         return


    "a" can still be accessed by Test, so this makes it highly confusing ?!


    Should global be added to a or not ?!


    This creates doubts among the programmers.


    Was "a" perhaps maybe initialized or not ?


    What is it's contents ?


    The lack of a debugger in Sikuli makes this problem much worse.


    Only way to know for sure would be to print debug logs of variables which
    would get a bit excessive to do always, but I guess in case of doubt perhaps
    it could be done temporarely, however this additional "paranoid" checking
    does waste some programmer time.


    Therefore enough reasons for me not to like this... it's weird/akward.


    I hope python one day gets rid of it;


    1. To stop the confusion.
    2. To stop the doubt.
    3. To stop the wasted lines.
    4. To program with more confidence.
    5. To stop to have to inspect what's going on if one wants to know for sure.
    6. To stop any weird programming mistakes because a global declaration was
    not used somewhere in a function, it's probably easier to miss, cause in the
    programmers mind he's thinking: "it's global".


    Now it's just some
    half-ass-fucked-up-not-really-global-variable-unless-you-specify-it-local-to-be-global-holy-shit-batman-feel-the-brain-pain
    ?!


    Bye,
       Skybuck.
  • Chris Angelico at Dec 3, 2014 at 4:36 am

    On Wed, Dec 3, 2014 at 3:17 PM, Skybuck Flying wrote:
    I hope python one day gets rid of it;

    1. To stop the confusion.
    2. To stop the doubt.
    3. To stop the wasted lines.
    4. To program with more confidence.
    5. To stop to have to inspect what's going on if one wants to know for sure.
    6. To stop any weird programming mistakes because a global declaration was
    not used somewhere in a function, it's probably easier to miss, cause in the
    programmers mind he's thinking: "it's global".

    Now it's just some
    half-ass-fucked-up-not-really-global-variable-unless-you-specify-it-local-to-be-global-holy-shit-batman-feel-the-brain-pain
    ?!

    If you want C-like infinitely nested scopes, you basically have to
    have declared variables, which Python doesn't want. There are other
    languages which are very Python-like but do have declared variables
    and infinitely-nested scopes, but I'm not sure I want to deal with
    this kind of anger on another mailing list, so I won't name one. Once
    again, though, you need to (a) learn the language before getting
    irate, and (b) play to its strengths, not its weaknesses. Python's
    requirement to declare all globals is a major weakness when you have
    hundreds of globals, so don't do that (or don't complain about how
    your code looks when you do).


    ChrisA
  • Skybuck Flying at Dec 3, 2014 at 4:32 am
    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.


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


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


    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.


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


    However python feels more like a script language and I am enjoying it quite
    a lot.


    I try not to get "entangled" into all kinds of structuring which leads to
    much time wasted.


    Though sometimes it can also gain some time.


    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.


    Even if it did, having all code in one big file is a pretty big adventage.


    This allow me to see the code every day I work on it, and think about how to
    improve the code further, making it faster, more reliable, shorter, and so
    forth.


    And it also offers a lot of flexibility and time savings.


    No need to search in what file, what was located.


    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...


    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".


    There is a word for it in dutch: "beteutelend" I am not sure what the word
    is in english but it's a bit like "childesh"


    So features I miss in python are: "labels" "goto statements" and "repeat
    until".


    Funny thing is these goto statements would be very handy for bot
    programming, so it's a painfull feature to miss.


    Also as already pointed out above structure programming has disadventages as
    well. I'd like to see other languages which focus at more flexibility
    instead of structure.


    Python is already a nice step towards more flexiblity, for example it's
    auto-type feature is nice, it can detect if a variable is an integer, string
    or object.


    Bye,
       Skybuck.
  • Chris Angelico at Dec 3, 2014 at 4:42 am

    On Wed, Dec 3, 2014 at 3:32 PM, Skybuck Flying wrote:
    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".

    If you want assembly language, you know where to find it.


    ChrisA
  • Dave Angel at Dec 3, 2014 at 5:02 am

    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
  • Michael Torrie at Dec 3, 2014 at 5:23 am

    On 12/02/2014 09: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.

    You forgot to mention that horrible white-space being syntax! Surely
    that is inflexible and awkward!

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

    Python allows you to explicitly use an OO paradigm if you wish, or use a
    more procedural form, or functional form (to a degree anyway). All the
    while using and exploiting object-oriented characteristics (modules,
    attributes, etc) throughout. It's really the best of both worlds.

    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.

    A poor craftsman blames his tools for his own shortcomings. I suggest
    you change tools to something a little more flexible (just about
    anything really)

    Even if it did, having all code in one big file is a pretty big adventage.

    Not really. Keeping things as simple as possible and modular is easier
    to debug, easier to test, add features to, and easier to understand
    three months from now. I can tell by your opinions that you've never
    done any medium to large-scale development before.

    So features I miss in python are: "labels" "goto statements" and "repeat
    until".

    Python is newbie friendly (mostly), but it is a far, far more powerful,
    capable, and expressive language than Delphi ever was. Take a theory of
    computer languages class some time (create your own language even...
    Scheme is a good place to start). It might open your eyes a lot.
    Python is not just a scripting language, it's a powerful application
    development language that allows me to create code rapidly that actually
    works. I'm far more productive in Python than in any language I've used
    to date.

    Funny thing is these goto statements would be very handy for bot
    programming, so it's a painfull feature to miss.

    Haven't heard that argued in many years. And I don't see how. Python
    has very powerful ways of dispatching execution including dictionaries
    of functions, callable objects, etc. Sounds like you're programming in
    a very primitive way, reinventing many structures that Python already
    has. I know that some low-level C programming does rely on and use
    goto, but in Python I've never needed it.


    You're not the first person to not grasp Python fundamentals (such as
    how variables work with name binding vs the Delphi idea of named boxes
    that can actually be change; python variables can only be rebound to new
    objects, unless you call a method on a mutable object), who ends up
    fighting the language and being really frustrated with it. Sounds like
    you're trying to code Pascal (or some other language) in Python. This
    is going to be frustrating. I suggest you learn what it means to code
    in a "Pythonic" way and you'll find you are really productive and having
    a lot of fun.
  • Marko Rauhamaa at Dec 3, 2014 at 6:52 am

    On 12/02/2014 09: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.
    You forgot to mention that horrible white-space being syntax! Surely
    that is inflexible and awkward!

    Hook...

    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.
    A poor craftsman blames his tools for his own shortcomings.

    ... line...

    Funny thing is these goto statements would be very handy for bot
    programming, so it's a painfull feature to miss.
    Haven't heard that argued in many years. And I don't see how.

    ... and sinker.




    Marko
  • Joel Goldstick at Dec 3, 2014 at 7:17 am
    troll

    On Wed, Dec 3, 2014 at 1:52 AM, Marko Rauhamaa wrote:
    On 12/02/2014 09: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.
    You forgot to mention that horrible white-space being syntax! Surely
    that is inflexible and awkward!
    Hook...
    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.
    A poor craftsman blames his tools for his own shortcomings.
    ... line...
    Funny thing is these goto statements would be very handy for bot
    programming, so it's a painfull feature to miss.
    Haven't heard that argued in many years. And I don't see how.
    ... and sinker.


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





    --
    Joel Goldstick
    http://joelgoldstick.com
  • Joshua Landau at Dec 3, 2014 at 1:07 pm

    On 3 December 2014 at 04:32, Skybuck Flying wrote:
    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.

    If you are being serious, please take into consideration that there is
    no way you are going to convince anyone on this list with the way you
    are asking. For the most part, people will be convinced when you show
    them something that would improve *their* life, not something that
    would improve yours. Being an open-source project lead largely by
    volunteers, either you convince people on their terms or you go fork
    the project.


    To do the former, find an example in the standard library or some
    popular codebase and show how what you're suggesting could improve the
    code. If your example is good, you'll get support for the idea. If the
    example is bad, people will point out how better to approach this.
  • Mm0fmf at Dec 3, 2014 at 6:04 pm

    On 03/12/2014 04:32, 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.

    Hmm, I smell trolling!


    *plonk*
  • Sohcahtoa82 at Dec 3, 2014 at 6:16 pm

    On Wednesday, December 3, 2014 10:05:06 AM UTC-8, mm0fmf wrote:
    On 03/12/2014 04:32, 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.
    Hmm, I smell trolling!

    *plonk*

    I'm surprised other people haven't picked up on how obvious of a troll this "Skybuck Flying" guy is. He claims 20 years programming experience, then uses an absurd amount of globals, many of which are related, without using a data structure of some kind.

    I am still new at python and definetly don't feel comfortable with the
    object feature,


    Someone with 20 years of programming shouldn't have any problems understanding objects in Python.


    20 years experience? Probably more like 20 minutes.
  • Steven D'Aprano at Dec 4, 2014 at 12:57 am

    sohcahtoa82 at gmail.com wrote:

    On Wednesday, December 3, 2014 10:05:06 AM UTC-8, mm0fmf wrote:
    On 03/12/2014 04:32, 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.
    Hmm, I smell trolling!

    *plonk*
    I'm surprised other people haven't picked up on how obvious of a troll
    this "Skybuck Flying" guy is. He claims 20 years programming experience,
    then uses an absurd amount of globals, many of which are related, without
    using a data structure of some kind.

    20 years of maintaining COBOL code first written in 1967 perhaps?


    Or more likely, VisualBasic. Skybuck Flying has posted here before:


    https://mail.python.org/pipermail/python-list/2013-October/657648.html


    Judging from what he considers good style and essential features of a
    programming language, I expect that he learned to program in BASIC back in
    the days of line numbers and GOTOs, and has barely adapted to a *slightly*
    more structured approach in VB.



    I am still new at python and definetly don't feel comfortable with the
    object feature,

    Someone with 20 years of programming shouldn't have any problems
    understanding objects in Python.

    Oh if that were only the case. It is amazing how long some people can work
    in a profession and still avoid learning anything new.






    --
    Steven
  • Chris Angelico at Dec 4, 2014 at 1:10 am

    On Thu, Dec 4, 2014 at 11:57 AM, Steven D'Aprano wrote:
    Someone with 20 years of programming shouldn't have any problems
    understanding objects in Python.
    Oh if that were only the case. It is amazing how long some people can work
    in a profession and still avoid learning anything new.

    I heard that described as "1 year's experience gained 20 times".
    Sadly, some people have gained their first year of experience even
    more times than that.


    ChrisA
  • Joel Goldstick at Dec 4, 2014 at 1:23 am

    On Wed, Dec 3, 2014 at 8:10 PM, Chris Angelico wrote:
    On Thu, Dec 4, 2014 at 11:57 AM, Steven D'Aprano
    wrote:
    Someone with 20 years of programming shouldn't have any problems
    understanding objects in Python.
    Oh if that were only the case. It is amazing how long some people can work
    in a profession and still avoid learning anything new.
    I heard that described as "1 year's experience gained 20 times".
    Sadly, some people have gained their first year of experience even
    more times than that.

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

    I especially liked the 'phython' reference in his post from 2013!


    --
    Joel Goldstick
    http://joelgoldstick.com
  • Michael Torrie at Dec 4, 2014 at 4:11 am

    On 12/03/2014 08:57 PM, Dennis Lee Bieber wrote:
    On Wed, 3 Dec 2014 10:16:18 -0800 (PST), sohcahtoa82 at gmail.com declaimed
    the following:

    I'm surprised other people haven't picked up on how obvious of a troll this "Skybuck Flying" guy is. He claims 20 years programming experience, then uses an absurd amount of globals, many of which are related, without using a data structure of some kind.
    My initial impression is of 20 years of Kemeny&Kurtz BASIC... Of the
    70s... with everything global.

    BASIC was slow in changing, that's for sure. I have used BASIC a lot
    over the years, and it's been highly structured with modern scoping
    rules since about the mid 80s. Certainly Borland's Turbo BASIC provided
    real functions and subroutines, private variables, block structures,
    etc. Sadly BASIC dialects tended to try to maintain backwards
    compatibility so even modern dialects like FreeBASIC can be coerced into
    executing spaghetti code. Sad that the OP is stuck in this style of
    programming. Whatever works for him. Maybe instead of Python he should
    use FreeBASIC with the -lang qb flag. Actually, more appropriate might
    be PC Basic [1] which is a GW BASIC clone actually written in Python.
    Nothing better than executing spaghetti code in an interpreter written
    in an interpreted language! Python indeed must be powerful indeed.


    [1] http://sourceforge.net/projects/pcbasic
  • Mark Lawrence at Dec 3, 2014 at 12:35 pm

    On 03/12/2014 02:27, Skybuck Flying wrote:
    Excuse is: "bad programming style".

    I don't need snot telling me how to program after 20 years of
    programming experience.

    This is so far the only thing pissing me off in python.

    Now I have to declare "global" in front of these variables every where I
    want to use em:

    Another example of a bad workman always blames his tools.


    --
    My fellow Pythonistas, ask not what our language can do for you, ask
    what you can do for our language.


    Mark Lawrence
  • Peter Pearson at Dec 3, 2014 at 8:31 pm

    On Wed, 3 Dec 2014 03:27:45 +0100, Skybuck Flying wrote:
    I don't need snot telling me how to program after 20 years of programming
    experience.
    [snip]


    After 20 years of programming, I had a lot to learn about programming.
    That was 29 years ago, and I *still* have a lot to learn about
    programming. That's why I greatly enjoy this particular newsgroup.


    The last time I saw a stack of globals like that was in 1973. Program
    for driving a lathe. Didn't work. Best of luck to you.


    --
    To email me, substitute nowhere->runbox, invalid->com.
  • Skybuck Flying at Dec 3, 2014 at 11:02 pm
    "Mark Lawrence" wrote in message
    news:mailman.16534.1417610132.18130.python-list at python.org...

    On 03/12/2014 02:27, Skybuck Flying wrote:
    Excuse is: "bad programming style".

    I don't need snot telling me how to program after 20 years of
    programming experience.

    This is so far the only thing pissing me off in python.

    Now I have to declare "global" in front of these variables every where I
    want to use em:

    "
    Another example of a bad workman always blames his tools.
    "


    Euhm, so why don't you program with just 0 and 1's then ? ;)


    Bye,
       Skybuck :)
  • Mark Lawrence at Dec 4, 2014 at 1:32 am

    On 03/12/2014 23:02, Skybuck Flying wrote:

    "Mark Lawrence" wrote in message
    news:mailman.16534.1417610132.18130.python-list at python.org...
    On 03/12/2014 02:27, Skybuck Flying wrote:
    Excuse is: "bad programming style".

    I don't need snot telling me how to program after 20 years of
    programming experience.

    This is so far the only thing pissing me off in python.

    Now I have to declare "global" in front of these variables every where I
    want to use em:

    This reminds of of a quote from a colleague some 25 years ago "Real time
    programming is easy, you just make all the data global". Perhaps you
    attended the same school?

    "
    Another example of a bad workman always blames his tools.
    "

    Euhm, so why don't you program with just 0 and 1's then ? ;)

    I did with the M6800 in the late 70s. Thankfully maybe 12 years ago I
    came across Python and it was love at first sight. I've never looked back.


    --
    My fellow Pythonistas, ask not what our language can do for you, ask
    what you can do for our language.


    Mark Lawrence
  • Jtan at Dec 4, 2014 at 5:03 am
    How can Skybuck use so much globals. Wouldn't that introduce a lot of
    thread safety problems?


    On Thu, Dec 4, 2014 at 9:32 AM, Mark Lawrence wrote:

    On 03/12/2014 23:02, Skybuck Flying wrote:



    "Mark Lawrence" wrote in message
    news:mailman.16534.1417610132.18130.python-list at python.org...
    On 03/12/2014 02:27, Skybuck Flying wrote:

    Excuse is: "bad programming style".

    I don't need snot telling me how to program after 20 years of
    programming experience.

    This is so far the only thing pissing me off in python.

    Now I have to declare "global" in front of these variables every where I
    want to use em:
    This reminds of of a quote from a colleague some 25 years ago "Real time
    programming is easy, you just make all the data global". Perhaps you
    attended the same school?

    "
    Another example of a bad workman always blames his tools.
    "

    Euhm, so why don't you program with just 0 and 1's then ? ;)
    I did with the M6800 in the late 70s. Thankfully maybe 12 years ago I
    came across Python and it was love at first sight. I've never looked back.

    --
    My fellow Pythonistas, ask not what our language can do for you, ask
    what you can do for our language.

    Mark Lawrence

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





    --
    Freelance Grails <http://grails.asia/> and Java <http://javadevnotes.com/>
      developer
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/python-list/attachments/20141204/505c9db1/attachment.html>
  • Mark Lawrence at Dec 4, 2014 at 10:24 am

    On 04/12/2014 05:03, jtan wrote:
    How can Skybuck use so much globals. Wouldn't that introduce a lot of
    thread safety problems?

    I actually don't know. However buying very strong thread from your
    local store and making sure that you have a very sharp needle does help
    alleviate threading safety problems. I do know that using globals is
    almost as bad as top posting on this list.


    --
    My fellow Pythonistas, ask not what our language can do for you, ask
    what you can do for our language.


    Mark Lawrence
  • Chris Angelico at Dec 4, 2014 at 10:29 am

    On Thu, Dec 4, 2014 at 4:03 PM, jtan wrote:
    How can Skybuck use so much globals. Wouldn't that introduce a lot of thread
    safety problems?

    A lot of programs don't use threads, and therefore cannot have thread
    safety problems - or, looking at it the other way, do not care about
    thread safetiness. It's like having Neil Armstrong wear water wings to
    make sure he won't drown in the Sea of Tranquility.


    ChrisA
  • Marko Rauhamaa at Dec 4, 2014 at 12:51 pm

    Chris Angelico <rosuav@gmail.com>:


    A lot of programs don't use threads, and therefore cannot have thread
    safety problems - or, looking at it the other way, do not care about
    thread safetiness. It's like having Neil Armstrong wear water wings to
    make sure he won't drown in the Sea of Tranquility.

    The water wings would be too unwieldy since they'd have to be six times
    as large on the moon. It's all about risk/benefit analysis.




    Marko
  • William Ray Wing at Dec 5, 2014 at 4:17 am

    On Dec 4, 2014, at 8:56 PM, Dennis Lee Bieber wrote:

    On Thu, 04 Dec 2014 14:51:14 +0200, Marko Rauhamaa <marko@pacujo.net>
    declaimed the following:
    Chris Angelico <rosuav@gmail.com>:
    A lot of programs don't use threads, and therefore cannot have thread
    safety problems - or, looking at it the other way, do not care about
    thread safetiness. It's like having Neil Armstrong wear water wings to
    make sure he won't drown in the Sea of Tranquility.
    The water wings would be too unwieldy since they'd have to be six times
    as large on the moon. It's all about risk/benefit analysis.
    Actually, since the pull of gravity is 1/6th that of earth, but the
    density of the "water" is the Sea is the same, the water wings should be
    smaller to provide the same degree of lift.

    Of course, the lack of atmospheric pressure is going to result in the
    water wings expanding, perhaps to the bursting point...
    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed at ix.netcom.com HTTP://wlfraed.home.netcom.com/

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

    Wrong, again I?m afraid. Assume for a moment you are under a dome pressurized to one standard atmosphere in some future moon colony and are in a swimming pool. Both you AND the water are under 1/6th as much gravitational pull. Neither your density nor the water?s density has changed. Density is a function of the atomic weight of the elements making up both you and the water and the inter-atomic/molecular spacing of those elements. Neither has changed. Therefore the volume of buoyant material (in the case of water wings, air) necessary to keep you above water is the same on earth as it would be on the moon.


    -Bill
  • Steven D'Aprano at Dec 4, 2014 at 11:35 am

    jtan wrote:


    How can Skybuck use so much globals. Wouldn't that introduce a lot of
    thread safety problems?

    Of course it would. But I expect that Skybuck probably doesn't even know
    what threads are. Or if he does, he probably doesn't believe that they
    should be used.


    Thread safety is just the start of the problems with global variables:


    http://c2.com/cgi/wiki?GlobalVariablesAreBad


    Globals in Python are less bad than in many other languages, since they are
    localised to a single module only. And the use of a few globals here and
    there as needed is perfectly fine for small scripts. But using dozens of
    them to avoid passing arguments to functions, that's just awful code.




    --
    Steven
  • Jtan at Dec 4, 2014 at 2:38 pm
    I wish him all the luck while having sleep deprivation trying to solve
    production issues :)


    On Thu, Dec 4, 2014 at 7:35 PM, Steven D'Aprano wrote:

    jtan wrote:
    How can Skybuck use so much globals. Wouldn't that introduce a lot of
    thread safety problems?
    Of course it would. But I expect that Skybuck probably doesn't even know
    what threads are. Or if he does, he probably doesn't believe that they
    should be used.

    Thread safety is just the start of the problems with global variables:

    http://c2.com/cgi/wiki?GlobalVariablesAreBad

    Globals in Python are less bad than in many other languages, since they are
    localised to a single module only. And the use of a few globals here and
    there as needed is perfectly fine for small scripts. But using dozens of
    them to avoid passing arguments to functions, that's just awful code.


    --
    Steven

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





    --
    Freelance Grails <http://grails.asia/> and Java <http://javadevnotes.com/>
      developer
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/python-list/attachments/20141204/068d1738/attachment.html>
  • Alister at Dec 4, 2014 at 7:54 pm

    On Thu, 04 Dec 2014 00:02:25 +0100, Skybuck Flying wrote:


    "Mark Lawrence" wrote in message
    news:mailman.16534.1417610132.18130.python-list at python.org...
    On 03/12/2014 02:27, Skybuck Flying wrote:
    Excuse is: "bad programming style".

    I don't need snot telling me how to program after 20 years of
    programming experience.

    This is so far the only thing pissing me off in python.

    Now I have to declare "global" in front of these variables every where
    I want to use em:
    "
    Another example of a bad workman always blames his tools.
    "

    Euhm, so why don't you program with just 0 and 1's then ? ;)

    Bye,
    Skybuck :)

    Because I DO know how to use my tools.






    --
    God isn't dead. He just doesn't want to get involved.
  • Tdev at Sep 2, 2015 at 6:47 pm
    I agree with Skybuck Flying.
    I am aware if a var is a module function var or a module global var.
    If I want read or write a global var.


    Using the keyword global inside each(!) function only
    to mark the global var writeable in each of the functions
    is really an over-regulation and very annoying from my point of view.


    Especially cause a module is a singleton.
    And globals are only module aware vars.
    Even Java (type-safe language) need not such things for its static or member vars.
    I have disliked this already in PHP where one has to do
    exact the same thing as in Python (and hoped Python does it better, but not).
    And using an import here is no solution, cause this is
    something which relates only to the scope and state of a module itself.


    I therefore would like to see a PEP which allows also writing
    global module vars inside module functions without the need
    for explicit setting the keyword "global" in more or less each(!)
    module function as the first line of code.




    I hope a lot can/will agree and a new PEP will arise
    to give this small responsibility back to the developer.




    Thanks.
  • Tdev at Sep 2, 2015 at 7:32 pm
    And to clarify: I have not spoken about sharing constants global (spanning over modules), where the solution provided here using imports is the solution. I have spoken from module vars which are named or are "globals" and its read/write access constraints inside module functions. So even the naming "globals" is something what I dislike, cause it is about module scope. With all other I can agree with Skybuck Flying too: "There is so far nothing else annoying!" (Maybe a missing switch statement). Thanks.
  • Emile van Sebille at Sep 2, 2015 at 7:34 pm
    On 9/2/2015 11:47 AM, tdev at freenet.de wrote:
    <snip>
    I therefore would like to see a PEP which allows also writing
    global module vars inside module functions without the need
    for explicit setting the keyword "global" in more or less each(!)
    module function as the first line of code.

    If you're feeling like you need to add global statements to a lot of
    functions to enable variable sharing/access, it may be codesmell
    indicating it's time to make a class of things.


    Emile
  • Ian Kelly at Sep 2, 2015 at 7:38 pm

    On Wed, Sep 2, 2015 at 12:47 PM, wrote:
    Using the keyword global inside each(!) function only
    to mark the global var writeable in each of the functions
    is really an over-regulation and very annoying from my point of view.

    To me, marking a variable as global in a large number of functions is
    a code smell that indicates that you're probably overusing globals.
    Lua is an example of a language that takes the opposite approach: in
    Lua, every variable is global unless you explicitly mark it as local.
    Lua is a fine language overall, but that is one of my pet peeves with
    it as it is all too easy to fall into the trap of neglecting to mark
    your local variables, and then you end up with too many global
    variables and a disaster of a code base.

    Especially cause a module is a singleton.
    And globals are only module aware vars.
    Even Java (type-safe language) need not such things for its static or member vars.

    Because Java has static typing. It can determine that a variable is
    static simply by observing that the variable is declared as such in
    the class and isn't declared in the function.


    Would you prefer to have to declare all your local variables as
    "local" just so that you don't have to explicitly declare the (few, I
    hope) global ones?
  • Vladimir Ignatov at Sep 5, 2015 at 12:05 am

    To me, marking a variable as global in a large number of functions is
    a code smell that indicates that you're probably overusing globals.
    Lua is an example of a language that takes the opposite approach: in
    Lua, every variable is global unless you explicitly mark it as local.
    Lua is a fine language overall, but that is one of my pet peeves with

    I had some experience programming in Lua and I'd say - that language
    is bad example to follow.
    Indexes start with 1 (I am not kidding)
    Single data type ("table") which could suddenly flip from "list" to
    "map" because you deleted one item.
    Has objects but has no classes.
    and so on...


    Vladimir


    http://itunes.apple.com/us/app/python-code-samples/id1025613117
  • Antoon Pardon at Sep 8, 2015 at 8:40 am

    Op 05-09-15 om 02:05 schreef Vladimir Ignatov:
    To me, marking a variable as global in a large number of functions is
    a code smell that indicates that you're probably overusing globals.
    Lua is an example of a language that takes the opposite approach: in
    Lua, every variable is global unless you explicitly mark it as local.
    Lua is a fine language overall, but that is one of my pet peeves with
    I had some experience programming in Lua and I'd say - that language
    is bad example to follow.
    Indexes start with 1 (I am not kidding)

    What is so bad about that?
  • Vladimir Ignatov at Sep 8, 2015 at 11:55 am

    I had some experience programming in Lua and I'd say - that language
    is bad example to follow.
    Indexes start with 1 (I am not kidding)
    What is so bad about that?

    It's different from the rest 99.9% of languages for no particular reason.


    ( => perfect example of "design smell" => not a good example to follow)




    Vladimir


    http://itunes.apple.com/us/app/python-code-samples/id1025613117
  • Akira Li at Sep 8, 2015 at 12:35 pm

    Vladimir Ignatov <kmisoft@gmail.com> writes:


    I had some experience programming in Lua and I'd say - that language
    is bad example to follow.
    Indexes start with 1 (I am not kidding)
    What is so bad about that?
    It's different from the rest 99.9% of languages for no particular reason.

    ( => perfect example of "design smell" => not a good example to follow)

    It is not just a matter of tradition. Even if you were to invent the
    very first programming language; there are reasons to prefer the
    zero-based indexing. See "Why numbering should start at zero"
    https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
  • Mario Figueiredo at Sep 8, 2015 at 1:05 pm

    On 08-09-2015 12:55, Vladimir Ignatov wrote:
    I had some experience programming in Lua and I'd say - that language
    is bad example to follow.
    Indexes start with 1 (I am not kidding)
    What is so bad about that?
    It's different from the rest 99.9% of languages for no particular reason.

    ( => perfect example of "design smell" => not a good example to follow)

    Assuming that some programming language makes design choices "for no
    apparent reason" is your first hint you should probably reevaluate your
    position. People who design programming languages don't tend to throw
    coins to the air.


    Lua was based of a scientific language with a strong mathematical core,
    where 1-index arrays make more sense and are standard. The authors
    didn't expect for the language to become successful and by the time it
    did, you couldn't just change anymore such a core aspect of your language.


    1-index arrays tend to be a problem in Lua, only for those people that
    don't normally program in Lua. Those that do, quickly learn to use them
    and they are not more difficult or easy to use than 0-index arrays.
    There is nothing inherently bad about 1-index arrays. They are just
    different, with some of the disadvantages being balanced by some of its
    advantages.


    And there either no design smell here. From the perspective of the
    language user (the programmer), the choice of the starting index of an
    array should have no impact on their ability to code. It's just another
    semantic aspect of the language they should learn. No different than
    having to learn other semantic nuances of each particular language. In
    fact, a great language is the one that offers the ability for the user
    to decide what starting index they want to use. Depending on the data
    structure a user sometimes is better served by a 0-index array, others
    by a 1-index array, and if you are doing an array with the letters of
    the alphabet you would love to have an array starting at 'a'.
  • Mario Figueiredo at Sep 9, 2015 at 1:09 am

    On 09-09-2015 01:25, Vladimir Ignatov wrote:
    It's different from the rest 99.9% of languages for no particular reason.

    ( => perfect example of "design smell" => not a good example to follow)
    Assuming that some programming language makes design choices "for no
    apparent reason" is your first hint you should probably reevaluate your
    position. People who design programming languages don't tend to throw coins
    to the air.
    Okay, I reevaluated my position and suddenly found that 1-based
    indexes is such a honking great idea! Now I have another difficulty
    though. How to justify absence of built-in unicode support in a
    language carefully designed in 1993 ?

    Sarcasm noted.


    Because:


    a) In 1993, ANSI C (C89) of which Lua had been developed had poor
    multibyte and wide character support. It was only with C95 that this
    stabilized.


    b) It didn't needed Unicode support for what it was initially designed
    for; a scripting language to provide programming capabilities to
    data-descriptive and configuration languages.


    c) As the years moved Lua eventually implemented support for the storage
    of unicode strings, but doesn't provide any higher level functions
    (including character traversing or searching). This is so because by
    that time, that task had already fallen to the unicode libraries that
    had been developed in the meantime.


    Note:
    You know, it is a pointless exercise to try and downplay programming
    languages (any programming language) that has proven its worth by being
    generally adopted by the programming community. Adoption is the sign of
    a respected and well designed language. You are just wasting your time.
    Even if you can find here and there some apparent flaw of arguable
    design choice, that will be true of any programming language.
  • Ben Finney at Sep 9, 2015 at 1:26 am

    Mario Figueiredo <marfig@gmx.com> writes:


    Note:
    You know, it is a pointless exercise to try and downplay programming
    languages (any programming language) that has proven its worth by
    being generally adopted by the programming community. Adoption is the
    sign of a respected and well designed language.

    I can think of numerous widely-adpoted languages that disprove that
    assertion, by nevertheless being poorly-designed languages that are
    loathed by the vast majority of programmers who use them.


    On the other hand, I think there is merit in an argument that runs the
    other way: the quality of languages that a community adopts are
    predictive of the quality of programs that community will produce.


    --
      \ ?It's up to the masses to distribute [music] however they want |
       `\ ? The laws don't matter at that point. People sharing music in |
    _o__) their bedrooms is the new radio.? ?Neil Young, 2008-05-06 |
    Ben Finney
  • Chris Angelico at Sep 9, 2015 at 1:41 am

    On Wed, Sep 9, 2015 at 11:26 AM, Ben Finney wrote:
    On the other hand, I think there is merit in an argument that runs the
    other way: the quality of languages that a community adopts are
    predictive of the quality of programs that community will produce.

    Broadly, yes. But regardless of its flaws, a language can be used
    because of a unique position; for instance, JavaScript/ECMAScript is
    going to continue to be the primary language of client-side web
    browser scripting for a long time, unless the major browsers all start
    supporting a new language (and until they all do, the benefit to one
    of them is low). ECMAScript isn't an abysmal language by any means,
    but it certainly has detectable flaws that come up fairly
    consistently. (Easy example: Find any fill-out form that says "Maximum
    X characters" and has a little counter that ticks down as you type.
    Now key in some astral characters. The odds are fairly good that
    they'll decrement the counter by 2 each.) If Apple declares that the
    iPhone 9 will be programmed exclusively in Even Swiftier, then it
    won't matter how terrible a language it is, people who want to say
    "Our app works on the iPhone 9" will write it in Even Swiftier. That's
    how PHP got to its position of being the default web scripting
    language for so many people - if you got yourself some cheap hosting,
    you could confidently expect PHP support, but until relatively
    recently, you couldn't depend on Ruby or Python (and certainly
    couldn't install your own); which, in turn, means that anyone who's
    building something for other people to deploy (a wiki, a forum, a
    blogging system, etc) will write it in PHP. And in all of these cases,
    a competent programmer can turn out good quality code.


    But if you take the average of all PHP programs, it'll tend toward a
    level that much better follows your estimate. A poorer language will
    generally have an overall poorer codebase.


    ChrisA
  • Mario Figueiredo at Sep 9, 2015 at 2:43 am

    On 09-09-2015 02:26, Ben Finney wrote:
    Mario Figueiredo <marfig@gmx.com> writes:
    Note:
    You know, it is a pointless exercise to try and downplay programming
    languages (any programming language) that has proven its worth by
    being generally adopted by the programming community. Adoption is the
    sign of a respected and well designed language.
    I can think of numerous widely-adpoted languages that disprove that
    assertion, by nevertheless being poorly-designed languages that are
    loathed by the vast majority of programmers who use them.

    On the other hand, I think there is merit in an argument that runs the
    other way: the quality of languages that a community adopts are
    predictive of the quality of programs that community will produce.

    I'll have to agree to an extent. And you did remind me of PHP. So
    there's that.


    But in a way PHP served an important purpose in its time. Despite its
    flaws, it was once an important language that helped solve programming
    problems. And for that it served the purpose. Many of us went through it
    for the lack of a better fast-and-dirty alternative to server-side
    scripting. I remember others, like Cold Fusion or ASP. (Can't recall
    exactly why Cold Fusion didn't experience a wider support. But, truth be
    told I barely touched it).


    In any case, it stands that, unless a programming language is so ruined
    by bad design choices it is unusable, there is some kind of merit to its
    ability to solve computational problems. And Lua, Java, Python, C++, C,
    let me stop naming some popular or mildly popular languages, aren't
    nowhere close to being in that game. They are superior choices, despite
    our personal dislikes.


    I can't stand Java. I just don't think calling it a mistake. It's worth
    has been proven by its level of adoption and by the usable software that
    has been made with it. Javascript/ECMAScript is criticized by so many
    and yet there's no denying of its importance. Even today we struggle to
    find a better alternative to client-side scripting. Python is criticized
    by so many. And yet I don't think calling on Python developers as an
    inferior breed of programmers.
  • Chris Angelico at Sep 9, 2015 at 3:03 am

    On Wed, Sep 9, 2015 at 12:43 PM, Mario Figueiredo wrote:
    I can't stand Java. I just don't think calling it a mistake. It's worth has
    been proven by its level of adoption and by the usable software that has
    been made with it. Javascript/ECMAScript is criticized by so many and yet
    there's no denying of its importance. Even today we struggle to find a
    better alternative to client-side scripting.

    Yeah, the reason for that is simple: anything else adds (sometimes
    massive) overhead. Would you suggest creating a client/server
    architecture, a RESTful API, and a triple-redundant HTTPS+SSL+Blowfish
    security system, to enumerate files on your hard drive? No, you'd just
    use ls(1). In the same way, there's not a lot of point downloading
    megs and megs of PyPyJS engine before running a single line of code,
    when you could skip that and just write in JS. Before Python can be "a
    better alternative", it has to overcome this massive hump.


    If Python 3.x were as well supported by web browsers as ECMAScript 5.x
    is, I think we'd see a dramatic shift in usage. But it ain't, so we
    won't.


    ChrisA
  • Ben Finney at Sep 9, 2015 at 5:53 am

    Mario Figueiredo <marfig@gmx.com> writes:

    On 09-09-2015 02:26, Ben Finney wrote:
    Mario Figueiredo <marfig@gmx.com> writes:
    You know, it is a pointless exercise to try and downplay
    programming languages (any programming language) that has proven
    its worth by being generally adopted by the programming community.
    Adoption is the sign of a respected and well designed language.
    I can think of numerous widely-adpoted languages that disprove that
    assertion, by nevertheless being poorly-designed languages that are
    loathed by the vast majority of programmers who use them.
    I'll have to agree to an extent. And you did remind me of PHP. So
    there's that.

    But in a way PHP served an important purpose in its time.

    Important, yes.

    In any case, it stands that, unless a programming language is so
    ruined by bad design choices it is unusable, there is some kind of
    merit to its ability to solve computational problems.

    That's a *very much* lower bar than your earlier claim I responded to:
    that ?[widespread] adoption is the sign of a respected and well designed
    language?.

    I can't stand Java. I just don't think calling it a mistake. It's
    worth has been proven by its level of adoption and by the usable
    software that has been made with it. Javascript/ECMAScript is
    criticized by so many and yet there's no denying of its importance.

    You're making the case for importance, and capability to implement
    programs that solve problems.


    Maybe it's true, but it's irrelevant to the earlier point. It is quite
    separate from the language being well designed, and it is quite separate
    from the language being respectable. Many languages ? some of which
    you've named ? are poorly-designed, are not deserving of respect,
    despite being widely-adopted.

    Even today we struggle to find a better alternative to client-side
    scripting. Python is criticized by so many. And yet I don't think
    calling on Python developers as an inferior breed of programmers.

    Glad to know that :-)


    --
      \ ?I have the simplest tastes. I am always satisfied with the |
       `\ best.? ?Oscar Wilde |
    _o__) |
    Ben Finney
  • Steven D'Aprano at Sep 9, 2015 at 5:55 pm

    On Wed, 9 Sep 2015 11:09 am, Mario Figueiredo wrote:


    You know, it is a pointless exercise to try and downplay programming
    languages (any programming language) that has proven its worth by being
    generally adopted by the programming community. Adoption is the sign of
    a respected and well designed language.

    Counter-examples: PHP and C.


    Adoption of programming languages is driven by many things, technical
    excellence and careful design are not even in the top 10. Most of them are
    social in nature, particularly "what is everyone else using?". Network
    effects dominate: you could design the perfect language, but if nobody else
    uses it, nobody will use it.


    Sometimes a language will actually gain a kind of technical excellence
    despite some really shitty design decisions -- but usually at great cost
    elsewhere. C is a good example of that. Due to lousy decisions made by the
    designers of C, it is a language really well suited for writing fast,
    incorrect code. Since programmers benefit from writing fast code, but
    rarely suffer from writing incorrect code (it's mostly users who suffer the
    consequences of security holes), we have ended up in the situation we live
    in now, where compilers compete to write faster and faster code that has
    less and less relation to what the programmer intended.


    (I wanted to link to the "Everything Is Broken" essay on The Medium, but the
    page appears to be gone. This makes me sad. BTW, what's the point of
    Google's cache when it just redirects to the original, missing, page?)


    In fairness to the C creators, I'm sure that nobody back in the early
    seventies imagined that malware and security vulnerabilities would be as
    widespread as they have become. But still, the fundamental decisions made
    by C are lousy. Assignment is an expression? Lack of first-class arrays?
    The C pre-processor? They're pretty awful, but *nothing* in the entire
    history of computing, not even Intercal and the COMEFROM command, comes
    even close to the evil that is C "undefined behaviour".


    I believe that the computing industry may never recover from the harm done
    to it by the widespread use of C.






    --
    Steven
  • Laura Creighton at Sep 9, 2015 at 6:05 pm

    In a message of Thu, 10 Sep 2015 03:55:54 +1000, "Steven D'Aprano" writes:
    (I wanted to link to the "Everything Is Broken" essay on The Medium, but the
    page appears to be gone. This makes me sad. BTW, what's the point of
    Google's cache when it just redirects to the original, missing, page?)

    Working for me:
    https://medium.com/message/everything-is-broken-81e5f33a24e1


    Laura
  • Emile van Sebille at Sep 9, 2015 at 6:23 pm

    On 9/9/2015 10:55 AM, Steven D'Aprano wrote:


    (I wanted to link to the "Everything Is Broken" essay on The Medium, but the
    page appears to be gone.

    Is this it?
    http://www.sott.net/article/280956-Everything-is-broken-on-the-Internet
  • Sven R. Kunze at Sep 9, 2015 at 6:26 pm

    On 09.09.2015 19:55, Steven D'Aprano wrote:
    On Wed, 9 Sep 2015 11:09 am, Mario Figueiredo wrote:

    You know, it is a pointless exercise to try and downplay programming
    languages (any programming language) that has proven its worth by being
    generally adopted by the programming community. Adoption is the sign of
    a respected and well designed language.
    Counter-examples: PHP and C.

    Adoption of programming languages is driven by many things, technical
    excellence and careful design are not even in the top 10. Most of them are
    social in nature, particularly "what is everyone else using?". Network
    effects dominate: you could design the perfect language, but if nobody else
    uses it, nobody will use it.
    Just to understand it the way you want it to be understood: what do you
    mean by "technical excellence"?
    Sometimes a language will actually gain a kind of technical excellence
    despite some really shitty design decisions -- but usually at great cost
    elsewhere. C is a good example of that. Due to lousy decisions made by the
    designers of C, it is a language really well suited for writing fast,
    incorrect code. Since programmers benefit from writing fast code, but
    rarely suffer from writing incorrect code (it's mostly users who suffer the
    consequences of security holes), we have ended up in the situation we live
    in now, where compilers compete to write faster and faster code that has
    less and less relation to what the programmer intended.

    (I wanted to link to the "Everything Is Broken" essay on The Medium, but the
    page appears to be gone. This makes me sad. BTW, what's the point of
    Google's cache when it just redirects to the original, missing, page?)
    Do you mean https://medium.com/message/everything-is-broken-81e5f33a24e1 ?
    In fairness to the C creators, I'm sure that nobody back in the early
    seventies imagined that malware and security vulnerabilities would be as
    widespread as they have become. But still, the fundamental decisions made
    by C are lousy. Assignment is an expression? Lack of first-class arrays?
    The C pre-processor? They're pretty awful, but *nothing* in the entire
    history of computing, not even Intercal and the COMEFROM command, comes
    even close to the evil that is C "undefined behaviour".

    I believe that the computing industry may never recover from the harm done
    to it by the widespread use of C.
    It'll take some time.

Related Discussions

People

Translate

site design / logo © 2018 Grokbase