Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #91016
| Path | csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'static': 0.03; 'compiler': 0.05; 'needed,': 0.05; '(using': 0.07; 'alignment': 0.07; 'assignment': 0.07; 'caller': 0.07; 'convention,': 0.09; 'immutable': 0.09; 'integer,': 0.09; 'integers': 0.09; 'mutable': 0.09; 'win64': 0.09; 'python': 0.11; 'stack': 0.13; 'thursday,': 0.13; '(but': 0.15; 'argument': 0.15; 'value.': 0.15; '(eg.': 0.16; 'descriptors,': 0.16; 'distinction': 0.16; 'expecting': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'function.)': 0.16; 'lisp': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'modified.': 0.16; 'passed.': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'sees': 0.16; 'still,': 0.16; 'variations': 0.16; 'zero,': 0.16; 'wrote:': 0.16; 'looked': 0.16; 'memory': 0.17; 'element': 0.18; 'integer': 0.18; 'wednesday': 0.18; 'language': 0.19; 'machine': 0.21; '(or': 0.21; "aren't": 0.22; 'fine,': 0.22; 'function,': 0.22; 'logical': 0.22; 'parameter': 0.22; 'pass': 0.22; 'code.': 0.23; 'bit': 0.23; '2015': 0.23; 'passing': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'equivalent': 0.27; "doesn't": 0.28; "i'm": 0.29; '32-bit': 0.29; 'barbara': 0.29; 'does,': 0.29; 'python).': 0.29; 'reduced': 0.29; 'weak': 0.29; 'function': 0.30; 'values': 0.30; 'convention': 0.31; 'subject:time': 0.31; 'trouble': 0.31; "can't": 0.32; 'included': 0.32; 'implement': 0.32; 'addresses': 0.32; 'received:84': 0.32; "d'aprano": 0.33; 'shift': 0.33; 'steven': 0.33; 'another': 0.34; 'everyone': 0.34; 'that,': 0.34; 'changed': 0.35; 'could': 0.35; 'to:addr:python- list': 0.35; 'functions.': 0.35; 'i.e.': 0.35; 'really': 0.35; 'but': 0.36; 'being': 0.36; 'too': 0.36; '(and': 0.36; 'two': 0.37; 'subject:: ': 0.37; 'level': 0.37; 'version': 0.38; 'community': 0.38; 'goes': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'area': 0.39; 'received:192': 0.39; 'some': 0.40; 'easy': 0.60; 'your': 0.60; 'back': 0.61; 'even': 0.61; 'more.': 0.62; 'making': 0.64; 'sharing': 0.64; 'between': 0.65; 'user,': 0.67; 'foreign': 0.69; 'million': 0.73; 'address,': 0.77; '100': 0.79; '1970s,': 0.84; 'x64': 0.84; 'technically': 0.91 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.1 cv=dZcO3Bne c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=QrohdLjRRo4A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=R4Y_H_aUsiTFJwcqepkA:9 a=j3IjEnnwpLOyJky7:21 a=dnImvJOghOxAVmo7:21 a=QEXdDO2ut3YA:10 |
| X-AUTH | mrabarnett@:2500 |
| Date | Thu, 21 May 2015 17:50:32 +0100 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Slices time complexity |
| References | <9ceklad15llnv3npejq9iuh91soci8aeqo@4ax.com> <mailman.114.1431978628.17265.python-list@python.org> <7ea01590-a559-46e5-abf5-29622e39aae7@googlegroups.com> <555ac697$0$12910$c3e8da3$5496439d@news.astraweb.com> <862693ca-42cf-4f5b-ac12-133e43e7606b@googlegroups.com> <878uclf3bt.fsf@elektro.pacujo.net> <555af171$0$12995$c3e8da3$5496439d@news.astraweb.com> <874mn9ezaw.fsf@elektro.pacujo.net> <mailman.124.1432025439.17265.python-list@python.org> <555b2fa9$0$12996$c3e8da3$5496439d@news.astraweb.com> <cs22vbFnd69U1@mid.individual.net> <mailman.156.1432082566.17265.python-list@python.org> <87oalfooz7.fsf@elektro.pacujo.net> <92992653-d511-4e33-a21d-541eeda4799b@googlegroups.com> <555c225b$0$2769$c3e8da3$76491128@news.astraweb.com> <mjhi5a$4pa$1@dont-email.me> <555d6ad8$0$2763$c3e8da3$76491128@news.astraweb.com> <755415ac-25c8-40db-b3c2-78111ed25621@googlegroups.com> |
| In-Reply-To | <755415ac-25c8-40db-b3c2-78111ed25621@googlegroups.com> |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.204.1432227041.17265.python-list@python.org> (permalink) |
| Lines | 56 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1432227041 news.xs4all.nl 2922 [2001:888:2000:d::a6]:51577 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:91016 |
Show key headers only | View raw
On 2015-05-21 14:34, bartc wrote: > On Thursday, 21 May 2015 06:19:39 UTC+1, Steven D'Aprano wrote: >> On Wednesday 20 May 2015 19:56, Bartc wrote: > >> What you *shouldn't* do is implement your own argument convention, > > (That's exactly what I did for my static language compiler which > generates x64 code. The Win64 calling convention was far too > complicated, and required 16-byte stack alignment which was another > headache. My private calling convention works fine! But I have to use > the official one for calling foreign (eg. C) functions. > > This is at a lower level than the logical or language view of > parameter passing, but still, you don't always have to do what > everyone else does.) > >> Don't do what the Lua community does, which is invent a stupid >> distinction between "reference types" and "value types" so they too >> can misuse terminology: > > But in the mind of the user, such a distinction can be intuitive. If > I'm passing a 32-bit integer, it is easy to think of the value being > passed. With a 100 million element array, it harder to think of it > being passed by value than by reference. > >> This calling convention has been known as pass by sharing (or >> variations of that, like "pass by object sharing") since it was >> named by Barbara Liskov in the 1970s, for the language CLU, but the >> convention itself goes back to Lisp in the 1950s. > > I looked it up expecting a new convention to solve all my problems. > But it's just a re-statement of how Python works anyway! > > So a mutable object passed to a function can be changed by that > function, so that the caller sees the change. An immutable object > can't be changed in the same way, but only because Python doesn't > allow it to be modified. (But it does allow assignment to the version > in the function.) > > Using what is really pass-by-reference for everything is fine, but > I'm having some trouble with making it efficient for small integer > values (I think this is a weak area of Python). Even with my clunky > system of passing descriptors, the equivalent of BINARY_ADD for two > small integers can be reduced to perhaps 10 or 12 machine > instructions, byte-code dispatch *and* double type-dispatch overheads > included (using ASM that is; and technically the type-dispatching is > by-passed). > > If small integers need to be heap-allocated and managed, then it > might need a few more. (And then Python will auto-range these to > arbitrary precision as needed, another difference.) > If memory addresses aren't byte-aligned, you could use the least- significant bit to indicate whether it's a small integer, i.e. if it's zero, then it's an address, else shift right by 1 bit arithmetically for the integer value.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Slices time complexity Mario Figueiredo <marfig@gmail.com> - 2015-05-18 20:23 +0100
Re: Slices time complexity Chris Angelico <rosuav@gmail.com> - 2015-05-19 05:36 +1000
Re: Slices time complexity Mario Figueiredo <marfig@gmail.com> - 2015-05-18 20:49 +0100
Re: Slices time complexity Chris Angelico <rosuav@gmail.com> - 2015-05-19 06:04 +1000
Re: Slices time complexity Todd <toddrjen@gmail.com> - 2015-05-18 21:42 +0200
Re: Slices time complexity Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-18 13:49 -0600
Re: Slices time complexity Fabien <fabien.maussion@gmail.com> - 2015-05-18 21:54 +0200
Re: Slices time complexity Todd <toddrjen@gmail.com> - 2015-05-18 22:23 +0200
Re: Slices time complexity Mario Figueiredo <marfig@gmail.com> - 2015-05-18 22:04 +0100
Re: Slices time complexity Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-18 22:38 +0100
Re: Slices time complexity Terry Reedy <tjreedy@udel.edu> - 2015-05-18 19:04 -0400
Re: Slices time complexity Rustom Mody <rustompmody@gmail.com> - 2015-05-18 19:20 -0700
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-19 15:13 +1000
Re: Slices time complexity Rustom Mody <rustompmody@gmail.com> - 2015-05-18 22:33 -0700
Re: Slices time complexity Marko Rauhamaa <marko@pacujo.net> - 2015-05-19 10:12 +0300
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-19 18:16 +1000
Re: Slices time complexity Marko Rauhamaa <marko@pacujo.net> - 2015-05-19 11:39 +0300
Re: Slices time complexity Chris Angelico <rosuav@gmail.com> - 2015-05-19 18:50 +1000
Re: Slices time complexity Marko Rauhamaa <marko@pacujo.net> - 2015-05-19 12:35 +0300
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-19 23:44 +1000
Re: Slices time complexity Christian Gollwitzer <auriocus@gmx.de> - 2015-05-20 23:54 +0200
Re: Slices time complexity Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-05-19 23:00 +1200
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-20 11:47 +1000
Re: Slices time complexity Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-05-20 08:07 -0400
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-19 22:42 +1000
Re: Slices time complexity Chris Angelico <rosuav@gmail.com> - 2015-05-19 23:24 +1000
Re: Slices time complexity Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-05-20 12:31 +1200
Re: Slices time complexity Ben Finney <ben+python@benfinney.id.au> - 2015-05-20 10:42 +1000
Re: Slices time complexity Marko Rauhamaa <marko@pacujo.net> - 2015-05-20 07:24 +0300
Re: Slices time complexity Rustom Mody <rustompmody@gmail.com> - 2015-05-19 21:30 -0700
Re: Slices time complexity Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-20 06:06 +0100
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-20 15:57 +1000
Re: Slices time complexity Marko Rauhamaa <marko@pacujo.net> - 2015-05-20 09:17 +0300
Re: Slices time complexity Rustom Mody <rustompmody@gmail.com> - 2015-05-19 23:23 -0700
Re: Slices time complexity Marko Rauhamaa <marko@pacujo.net> - 2015-05-20 09:46 +0300
Re: Slices time complexity Rustom Mody <rustompmody@gmail.com> - 2015-05-20 00:03 -0700
Re: Slices time complexity Marko Rauhamaa <marko@pacujo.net> - 2015-05-20 10:45 +0300
List semantics [was Re: Slices time complexity] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-20 17:23 +1000
Re: List semantics [was Re: Slices time complexity] Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-05-20 20:54 +1200
Re: List semantics [was Re: Slices time complexity] Ned Batchelder <ned@nedbatchelder.com> - 2015-05-20 04:08 -0700
Re: List semantics [was Re: Slices time complexity] Terry Reedy <tjreedy@udel.edu> - 2015-05-20 14:42 -0400
Re: List semantics [was Re: Slices time complexity] Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-05-21 11:06 +1200
Re: List semantics [was Re: Slices time complexity] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-21 12:10 +1000
Re: Slices time complexity "Bartc" <bartc@freeuk.com> - 2015-05-20 10:56 +0100
Re: Slices time complexity Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2015-05-20 10:16 +0100
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-21 15:19 +1000
Re: Slices time complexity Marko Rauhamaa <marko@pacujo.net> - 2015-05-21 09:20 +0300
Re: Slices time complexity bartc <bart4858@gmail.com> - 2015-05-21 06:34 -0700
Re: Slices time complexity MRAB <python@mrabarnett.plus.com> - 2015-05-21 17:50 +0100
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-22 03:16 +1000
Re: Slices time complexity bart4858@gmail.com - 2015-05-21 12:48 -0700
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-20 12:26 +1000
Re: Slices time complexity Chris Angelico <rosuav@gmail.com> - 2015-05-20 12:36 +1000
Re: Slices time complexity Rustom Mody <rustompmody@gmail.com> - 2015-05-19 20:02 -0700
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-19 21:43 +1000
Re: Slices time complexity Marko Rauhamaa <marko@pacujo.net> - 2015-05-19 18:59 +0300
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-20 03:46 +1000
Re: Slices time complexity Chris Angelico <rosuav@gmail.com> - 2015-05-20 04:12 +1000
Re: Slices time complexity Marko Rauhamaa <marko@pacujo.net> - 2015-05-19 21:19 +0300
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-20 10:43 +1000
Re: Slices time complexity Marko Rauhamaa <marko@pacujo.net> - 2015-05-20 07:30 +0300
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-20 15:33 +1000
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-20 15:58 +1000
Re: Slices time complexity Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2015-05-19 15:18 +0100
Re: Slices time complexity Rustom Mody <rustompmody@gmail.com> - 2015-05-19 04:46 -0700
Re: Slices time complexity Rustom Mody <rustompmody@gmail.com> - 2015-05-19 05:14 -0700
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-19 18:19 +1000
Re: Slices time complexity Rustom Mody <rustompmody@gmail.com> - 2015-05-19 04:41 -0700
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-19 19:45 +1000
Re: Slices time complexity Serhiy Storchaka <storchaka@gmail.com> - 2015-05-19 13:15 +0300
Re: Slices time complexity Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2015-05-19 12:09 +0100
Re: Slices time complexity "Bartc" <bartc@freeuk.com> - 2015-05-19 15:52 +0100
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-20 03:07 +1000
Re: Slices time complexity Chris Angelico <rosuav@gmail.com> - 2015-05-20 03:19 +1000
Re: Slices time complexity Mario Figueiredo <marfig@gmail.com> - 2015-05-20 20:51 +0100
Re: Slices time complexity Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-20 14:33 -0600
Re: Slices time complexity Chris Angelico <rosuav@gmail.com> - 2015-05-21 06:35 +1000
Re: Slices time complexity Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-20 21:47 +0100
Re: Slices time complexity Mario Figueiredo <marfig@gmail.com> - 2015-05-20 22:23 +0100
Re: Slices time complexity Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-21 17:35 +1000
Re: Slices time complexity Chris Angelico <rosuav@gmail.com> - 2015-05-21 18:25 +1000
Re: Slices time complexity Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-19 09:15 -0600
Re: Slices time complexity Serhiy Storchaka <storchaka@gmail.com> - 2015-05-19 22:51 +0300
csiph-web