Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102768
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | "Sven R. Kunze" <srkunze@mail.de> |
| Newsgroups | comp.lang.python |
| Subject | Re: Heap Implementation |
| Date | Wed, 10 Feb 2016 19:23:01 +0100 |
| Lines | 28 |
| Message-ID | <mailman.17.1455128587.22075.python-list@python.org> (permalink) |
| References | <56AD3D83.2050308@mail.de> <7C522D08-9D73-48D2-A71D-F1D1D34C02A5@gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de h7/xfel8t1VA1eGNCiE1WAOb39KKYEnt1ez/3vsW13Ag== |
| Return-Path | <srkunze@mail.de> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'attributes': 0.07; 'lately': 0.07; 'wrapper': 0.07; 'cc:addr:python-list': 0.09; 'called.': 0.09; 'deadline,': 0.09; 'it;': 0.09; 'pushed': 0.13; 'benefit.': 0.16; 'heap': 0.16; 'objects?': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'valid.': 0.16; 'wrote:': 0.16; 'comparing': 0.18; 'result,': 0.18; 'library': 0.20; 'cc:addr:python.org': 0.20; 'cc:2**1': 0.22; 'defined': 0.23; 'cc:addr:gmail.com': 0.24; 'header:In-Reply-To:1': 0.24; "i've": 0.25; 'handling': 0.27; 'function': 0.28; 'looks': 0.29; 'concern': 0.29; 'directly,': 0.29; 'queue': 0.29; 'push': 0.30; 'another': 0.32; 'useful': 0.33; 'problem': 0.33; "i'll": 0.33; 'equal': 0.34; 'handle': 0.34; 'received:10.0': 0.34; 'so,': 0.35; 'best,': 0.35; 'could': 0.35; 'fresh': 0.35; 'quite': 0.35; 'item': 0.35; 'but': 0.36; 'there': 0.36; '(and': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'being': 0.37; 'busy': 0.38; 'itself': 0.38; 'why': 0.39; 'well.': 0.40; 'received:de': 0.40; 'some': 0.40; 'future': 0.60; 'your': 0.60; 'here.': 0.62; 'charset:windows-1252': 0.62; 'more': 0.63; 'times': 0.63; 'talking': 0.67; 'client-side': 0.84; 'pondered': 0.84; 'why?': 0.91; 'good,': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mail201212; t=1455128585; bh=4A1IrKI3XAyYen9S9LIcj6AW02e81SIy05A+ild1x94=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From; b=BYT9hO6KRjEDTdKGlGrhBh6TZ1XILhVBUbsTVi7Hmxo9Qr9KRd7gw70F3yJUh7kcz E8fKKUVKmkFMLvsdSJW8CJwL2OAjGKZg5Ev0Y6MacAKipu8Pfh0hGI6rCgKRIDOoX0 em10MNCXkcQiAI5gPRniYSSqm3Qcv6HrTvad8bQo= |
| In-Reply-To | <7C522D08-9D73-48D2-A71D-F1D1D34C02A5@gmail.com> |
| X-purgate | clean |
| X-purgate | This mail is considered clean (visit http://www.eleven.de for further information) |
| X-purgate-type | clean |
| X-purgate-Ad | Categorized by eleven eXpurgate (R) http://www.eleven.de |
| X-purgate | This mail is considered clean (visit http://www.eleven.de for further information) |
| X-purgate | clean |
| X-purgate-size | 1400 |
| X-purgate-ID | 154282::1455128585-00004575-86845E08/0/0 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21rc2 |
| 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> |
| Xref | csiph.com comp.lang.python:102768 |
Show key headers only | View raw
Hi Cem, On 08.02.2016 02:37, Cem Karan wrote: > My apologies for not writing sooner, but work has been quite busy lately (and likely will be for some time to come). no problem here. :) > I read your approach, and it looks pretty good, but there may be one issue with it; how do you handle the same item being pushed into the heap more than once? In my simple simulator, I'll push the same object into my event queue multiple times in a row. The priority is the moment in the future when the object will be called. As a result, items don't have unique priorities. I know that there are methods of handling this from the client-side (tuples with unique counters come to mind), but if your library can handle it directly, then that could be useful to others as well. I've pondered about that in the early design phase. I considered it a slowdown for my use-case without benefit. Why? Because I always push a fresh object ALTHOUGH it might be equal comparing attributes (priority, deadline, etc.). That's the reason why I need to ask again: why pushing the same item on a heap? Are we talking about function objects? If so, then your concern is valid. Would you accept a solution that would involve wrapping the function in another object carrying the priority? Would you prefer a wrapper that's defined by xheap itself so you can just use it? Best, Sven
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Heap Implementation "Sven R. Kunze" <srkunze@mail.de> - 2016-02-10 19:23 +0100
csiph-web