Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Why Python does my head in #458

Why Python does my head in #458

Scheduled Pinned Locked Moved The Lounge
pythondata-structuresquestion
15 Posts 11 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Chris Maunder

    image_slice = numpy_image[150:220, 130:250]

    When slicing a numpy image, the bounds are inclusive and indexing starts from 1.

    array_slice = array[0:2]

    When slicing a Python array the end bound is exclusive and indexing starts from 0. What could possibly go wrong?

    cheers Chris Maunder

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #2

    Seems quite logical to me, Captain. :laugh:

    1 Reply Last reply
    0
    • C Chris Maunder

      image_slice = numpy_image[150:220, 130:250]

      When slicing a numpy image, the bounds are inclusive and indexing starts from 1.

      array_slice = array[0:2]

      When slicing a Python array the end bound is exclusive and indexing starts from 0. What could possibly go wrong?

      cheers Chris Maunder

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #3

      This is why a language needs to be designed by a committee. :D

      E 1 Reply Last reply
      0
      • C Chris Maunder

        image_slice = numpy_image[150:220, 130:250]

        When slicing a numpy image, the bounds are inclusive and indexing starts from 1.

        array_slice = array[0:2]

        When slicing a Python array the end bound is exclusive and indexing starts from 0. What could possibly go wrong?

        cheers Chris Maunder

        S Offline
        S Offline
        Single Step Debugger
        wrote on last edited by
        #4

        Exactly the same with the functions in Transact-SQL. These people don't know their zeroes. You need to be careful in the Muggle World.

        Advertise here – minimum three posts per day are guaranteed.

        P 1 Reply Last reply
        0
        • C Chris Maunder

          image_slice = numpy_image[150:220, 130:250]

          When slicing a numpy image, the bounds are inclusive and indexing starts from 1.

          array_slice = array[0:2]

          When slicing a Python array the end bound is exclusive and indexing starts from 0. What could possibly go wrong?

          cheers Chris Maunder

          R Offline
          R Offline
          RickZeeland
          wrote on last edited by
          #5

          Time for Police Python 357 (1976) - IMDb[^] :-\

          1 Reply Last reply
          0
          • C Chris Maunder

            image_slice = numpy_image[150:220, 130:250]

            When slicing a numpy image, the bounds are inclusive and indexing starts from 1.

            array_slice = array[0:2]

            When slicing a Python array the end bound is exclusive and indexing starts from 0. What could possibly go wrong?

            cheers Chris Maunder

            J Offline
            J Offline
            Jeremy Falcon
            wrote on last edited by
            #6

            VB's WithEvents is jealous.

            Jeremy Falcon

            1 Reply Last reply
            0
            • S Single Step Debugger

              Exactly the same with the functions in Transact-SQL. These people don't know their zeroes. You need to be careful in the Muggle World.

              Advertise here – minimum three posts per day are guaranteed.

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #7

              I think T-SQL is at least consistent. And any T-SQL functions which use an index of a character in a string should be avoided anyway, for performance reasons.

              1 Reply Last reply
              0
              • C Chris Maunder

                image_slice = numpy_image[150:220, 130:250]

                When slicing a numpy image, the bounds are inclusive and indexing starts from 1.

                array_slice = array[0:2]

                When slicing a Python array the end bound is exclusive and indexing starts from 0. What could possibly go wrong?

                cheers Chris Maunder

                J Offline
                J Offline
                jmaida
                wrote on last edited by
                #8

                It's off by 1 somewhere holds again. #458 what's that.

                "A little time, a little trouble, your better day" Badfinger

                1 Reply Last reply
                0
                • C Chris Maunder

                  image_slice = numpy_image[150:220, 130:250]

                  When slicing a numpy image, the bounds are inclusive and indexing starts from 1.

                  array_slice = array[0:2]

                  When slicing a Python array the end bound is exclusive and indexing starts from 0. What could possibly go wrong?

                  cheers Chris Maunder

                  M Offline
                  M Offline
                  megaadam
                  wrote on last edited by
                  #9

                  Only 1 thing can go wrong for 1 index! Could be much worse!

                  "If we don't change direction, we'll end up where we're going"

                  1 Reply Last reply
                  0
                  • C Chris Maunder

                    image_slice = numpy_image[150:220, 130:250]

                    When slicing a numpy image, the bounds are inclusive and indexing starts from 1.

                    array_slice = array[0:2]

                    When slicing a Python array the end bound is exclusive and indexing starts from 0. What could possibly go wrong?

                    cheers Chris Maunder

                    pkfoxP Offline
                    pkfoxP Offline
                    pkfox
                    wrote on last edited by
                    #10

                    I have to ask ! why are you using Python ?

                    Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP

                    C 1 Reply Last reply
                    0
                    • C Chris Maunder

                      image_slice = numpy_image[150:220, 130:250]

                      When slicing a numpy image, the bounds are inclusive and indexing starts from 1.

                      array_slice = array[0:2]

                      When slicing a Python array the end bound is exclusive and indexing starts from 0. What could possibly go wrong?

                      cheers Chris Maunder

                      B Offline
                      B Offline
                      BernardIE5317
                      wrote on last edited by
                      #11

                      You will recall the Mars Climate Orbital failed because engineers at JPL assumed the units provided by Lockheed Martin were metric when in fact they were "English" meaning USA . incredible . apparently the piece of paper w/ the data did not bother to include "inches" or "s" at the end of the numbers and apparently no one bothered to inquire is this bare naked number in meters or feet or squared pickles .

                      C 1 Reply Last reply
                      0
                      • B BernardIE5317

                        You will recall the Mars Climate Orbital failed because engineers at JPL assumed the units provided by Lockheed Martin were metric when in fact they were "English" meaning USA . incredible . apparently the piece of paper w/ the data did not bother to include "inches" or "s" at the end of the numbers and apparently no one bothered to inquire is this bare naked number in meters or feet or squared pickles .

                        C Offline
                        C Offline
                        Chris Maunder
                        wrote on last edited by
                        #12

                        I remember that well and I still find that incomprehensible. (a) that no engineer demanded to see units, or even questioned their omission, (b) that units weren't provided in the first place, and (c) that an international aerospace company (or any international engineering company) would not be using SI units. Still shaking my head after all these years

                        cheers Chris Maunder

                        1 Reply Last reply
                        0
                        • pkfoxP pkfox

                          I have to ask ! why are you using Python ?

                          Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP

                          C Offline
                          C Offline
                          Chris Maunder
                          wrote on last edited by
                          #13

                          Just a [small little project](https://www.codeproject.com/AI/docs/) we're playing with :)

                          cheers Chris Maunder

                          pkfoxP 1 Reply Last reply
                          0
                          • C Chris Maunder

                            Just a [small little project](https://www.codeproject.com/AI/docs/) we're playing with :)

                            cheers Chris Maunder

                            pkfoxP Offline
                            pkfoxP Offline
                            pkfox
                            wrote on last edited by
                            #14

                            I thought you were a C++ man - I'm not a Python fan.

                            Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP

                            1 Reply Last reply
                            0
                            • P PIEBALDconsult

                              This is why a language needs to be designed by a committee. :D

                              E Offline
                              E Offline
                              Edward Aymami
                              wrote on last edited by
                              #15

                              Yep. A Giraffe is a horse designed by a committee.

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups