Re: Efficient Wrappers for Instance Methods

2016-02-03 Thread Sven R. Kunze
On 03.02.2016 22:15, Peter Otten wrote: The technical reason is that functions written in C don't implement the descriptor protocol. The bound method is created by invoking the __get__ method of the class attribute: Good to know. :-/ It's sad. These functions just look so method-like. Bes

Re: Efficient Wrappers for Instance Methods

2016-02-03 Thread Sven R. Kunze
On 03.02.2016 22:34, Bernardo Sulzbach wrote: Did Peter's suggestion work? Somewhat for a single Heap class. However, it breaks inheritance. -- https://mail.python.org/mailman/listinfo/python-list

Re: Efficient Wrappers for Instance Methods

2016-02-04 Thread Sven R. Kunze
On 04.02.2016 00:47, Random832 wrote: On Wed, Feb 3, 2016, at 16:43, Sven R. Kunze wrote: Actually a nice idea if there were no overhead of creating methods for all heap instances separately. I'll keep that in mind. :) What about changing the class of the object to one which is inherited

Re: Efficient Wrappers for Instance Methods

2016-02-04 Thread Sven R. Kunze
On 04.02.2016 19:35, Random832 wrote: On Thu, Feb 4, 2016, at 11:18, Sven R. Kunze wrote: On 04.02.2016 00:47, Random832 wrote: On Wed, Feb 3, 2016, at 16:43, Sven R. Kunze wrote: Actually a nice idea if there were no overhead of creating methods for all heap instances separately. I'll

Re: _siftup and _siftdown implementation

2016-02-04 Thread Sven R. Kunze
On 05.02.2016 01:12, Steven D'Aprano wrote: On Fri, 5 Feb 2016 07:50 am, srinivas devaki wrote: _siftdown function breaks out of the loop when the current pos has a valid parent. but _siftup function is not implemented in that fashion, if a valid subheap is given to the _siftup, it will bring

Re: _siftup and _siftdown implementation

2016-02-05 Thread Sven R. Kunze
On 05.02.2016 02:26, srinivas devaki wrote: as I come to think of it again, it is not subheap, it actually heap cut at some level hope you get the idea from the usage of _siftup. so even though the `pos` children are valid the _siftup brings down the new element (i.e the element which is at first

Re: _siftup and _siftdown implementation

2016-02-05 Thread Sven R. Kunze
On 05.02.2016 15:48, Bernardo Sulzbach wrote: On 02/05/2016 12:42 PM, Sven R. Kunze wrote: PS: I do competitive programming, I use these modules every couple of days when compared to other modules. so didn't give much thought when posting to the mailing list. sorry for that. Compet

Re: _siftup and _siftdown implementation

2016-02-05 Thread Sven R. Kunze
Hi srinivas, I wrote this simple benchmark to measure comparisons: import random from xheapimport RemovalHeap class X(object): c =0 def __init__(self, x): self.x = x def __lt__(self, other): X.c +=1 return self.x < other.x n =10 for jjin range(5): items = [X(i

Re: _siftup and _siftdown implementation

2016-02-05 Thread Sven R. Kunze
r i in range(n)] random.shuffle(items) heap = RemovalHeap(items) random.shuffle(items) for i in items: heap.remove(i) print(X.c) X.c = 0 (note to myself: never copy PyCharm formatting strings to this list). On 05.02.2016 17:27, Sven R. Kunze wrote: Hi srinivas,

Re: Asyncio thought experiment

2016-02-10 Thread Sven R. Kunze
On 08.02.2016 23:13, Marko Rauhamaa wrote: As I stated in an earlier post, a normal subroutine may turn out to be blocking. To make it well-behaved under asyncio, you then dutifully tag the subroutine with "async" and adorn the blocking statement with "await". Consequently, you put "await" in fro

Re: Heap Implementation

2016-02-10 Thread Sven R. Kunze
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 s

Re: Make a unique filesystem path, without creating the file

2016-02-15 Thread Mario R. Osorio
I would create a RAM disk (http://www.cyberciti.biz/faq/howto-create-linux-ram-disk-filesystem/), generate all the path/files I want with any, or my own algorithm, run the tests, unmount it, destroy it, be happy ... Whats wrong with that?? AFAIK, RAM disks do not get logged, and even if they do

Re: Multiple Assignment a = b = c

2016-02-16 Thread Sven R. Kunze
Hi Srinivas, On 16.02.2016 13:46, srinivas devaki wrote: Hi, a = b = c as an assignment doesn't return anything, i ruled out a = b = c as chained assignment, like a = (b = c) SO i thought, a = b = c is resolved as a, b = [c, c] at-least i fixed in my mind that every assignment like operation

Re: Multiple Assignment a = b = c

2016-02-16 Thread Sven R. Kunze
On 16.02.2016 14:05, Sven R. Kunze wrote: Hi Srinivas, I think the tuple assignment you showed basically nails it. First, the rhs is evaluated. Second, the lhs is evaluated from left to right. Completely wrong? Best, Sven As you mentioned swapping. The following two statements do the same

Re: Guido on python3 for beginners

2016-02-18 Thread Sven R. Kunze
On 18.02.2016 07:59, Paul Rubin wrote: Steven D'Aprano writes: I suppose that it is objectively correct that it is harder to learn than Python 2. But I don't think the learning curve is any steeper. If anything, the learning curve is ever-so-slightly less steep. I think py3 has more learning c

benchmarking in general and using xheap

2016-02-19 Thread Sven R. Kunze
Hi everybody, I've finally had the time to do the benchmarks and here you go: http://srkunze.blogspot.com/2016/02/the-xheap-benchmark.html The benchmark compares heapq, Heap, OrderHeap, RemovalHeap and XHeap regarding their operation heapify, push and pop. As expected wrapping results in so

Re: How the heck does async/await work in Python 3.5

2016-02-22 Thread Sven R. Kunze
On 20.02.2016 07:53, Christian Gollwitzer wrote: If you have difficulties wit hthe overall concept, and if you are open to discussions in another language, take a look at this video: https://channel9.msdn.com/Shows/C9-GoingNative/GoingNative-39-await-co-routines MS has added coroutine suppo

Re: How the heck does async/await work in Python 3.5

2016-02-23 Thread Sven R. Kunze
On 23.02.2016 01:48, Ian Kelly wrote: On Mon, Feb 22, 2016 at 3:16 PM, Sven R. Kunze wrote: Is something like shown in 12:50 ( cout << tcp_reader(1000).get() ) possible with asyncio? (tcp_reader would be async def) loop = asyncio.get_event_loop() print(loop.run_until_complete(tcp_reade

Re: How the heck does async/await work in Python 3.5

2016-02-23 Thread Sven R. Kunze
On 23.02.2016 18:37, Ian Kelly wrote: It's not entirely clear to me what the C++ is actually doing. With Python we have an explicit event loop that has to be started to manage resuming the coroutines. Since it's explicit, you could easily drop in a different event loop, such as Tornado or curio,

Re: How the heck does async/await work in Python 3.5

2016-02-23 Thread Sven R. Kunze
On 20.02.2016 07:53, Christian Gollwitzer wrote: If you have difficulties wit hthe overall concept, and if you are open to discussions in another language, take a look at this video: https://channel9.msdn.com/Shows/C9-GoingNative/GoingNative-39-await-co-routines MS has added coroutine suppo

Bug in Python?

2016-02-26 Thread Sven R. Kunze
Hi everybody, I recognized the following oddity (background story: http://srkunze.blogspot.com/2016/02/lets-go-down-rabbit-hole.html). Python sometimes seems not to hop back and forth between C and Python code. Can somebody explain this? class MyList(list): count = 0 def __setitem__

Re: Bug in Python?

2016-02-28 Thread Sven R. Kunze
On 26.02.2016 23:37, Ian Kelly wrote: On Fri, Feb 26, 2016 at 3:08 PM, Sven R. Kunze wrote: Python sometimes seems not to hop back and forth between C and Python code. C code as a rule tends to ignore dunder methods. Those are used to implement Python operations, not C operations. Ah, good

Re: Bug in Python?

2016-02-28 Thread Sven R. Kunze
On 27.02.2016 00:07, eryk sun wrote: On Fri, Feb 26, 2016 at 4:08 PM, Sven R. Kunze wrote: Python sometimes seems not to hop back and forth between C and Python code. Can somebody explain this? Normally a C extension would call PySequence_SetItem, which would call the type's sq_ass

Re: Bug in Python?

2016-02-28 Thread Sven R. Kunze
On 27.02.2016 12:48, Terry Reedy wrote: On 2/27/2016 4:44 AM, Steven D'Aprano wrote: On Sat, 27 Feb 2016 07:55 pm, Terry Reedy wrote: In other words, when that doc says *list*, it means a *list*. "To create a heap, use a list initialized to [], or you can transform a populated list into a hea

Re: Everything good about Python except GUI IDE?

2016-02-28 Thread Sven R. Kunze
On 28.02.2016 07:34, Steven D'Aprano wrote: I think that's out-and-out wrong, and harmful to the developer community. I think that we're stuck in the equivalent of the pre-WYSIWYG days of word processing: you can format documents as nicely as you like, but you have to use a separate mode to see i

Re: [Off-topic] Requests author discusses MentalHealthError exception

2016-02-29 Thread Mario R. Osorio
On Saturday, February 27, 2016 at 4:39:12 AM UTC-5, Steven D'Aprano wrote: > The author of Requests, Kenneth Reitz, discusses his recent recovery from a > MentalHealthError exception. > > http://www.kennethreitz.org/essays/mentalhealtherror-an-exception-occurred > > Although the connection to Pyt

Re: [Off-topic] Requests author discusses MentalHealthError exception

2016-03-01 Thread Sven R. Kunze
On 01.03.2016 13:13, Steven D'Aprano wrote: On Tue, 1 Mar 2016 09:38 am, Larry Martell wrote: But what is reality? Reality is that which, when you stop believing in it, doesn't go away. Just like that. -- https://mail.python.org/mailman/listinfo/python-list

Re: The Real-Time Use of Python in Data Science World!

2016-03-04 Thread Mario R. Osorio
On Friday, February 26, 2016 at 2:36:26 PM UTC-5, Anita Goyal wrote: > This course will help you to expertise the usage of Python in Data Science > world. > > Carter your Python Knowledge so that it can be utilized to get the Insights > of Data using Methodologies and Techniques of Data Science.

Re: ANN: Wing IDE 5.1.10 released

2016-03-04 Thread Mario R. Osorio
On Friday, February 26, 2016 at 9:57:21 AM UTC-5, Wingware wrote: > Hi, > > Wingware has released version 5.1.10 of Wing IDE, our cross-platform > integrated development environment for the Python programming language. > > Wing IDE features a professional code editor with vi, emacs, visual > st

even faster heaps

2016-03-06 Thread Sven R. Kunze
Hi python-list, hi Srinivas, I managed to implement the mark&sweep approach for fast removal from heaps. This way, I got three pleasant results: 1) a substantial speed up! 2) an improved testsuite 3) discovery and fixing of several bugs @Srinivas I would be honored if you could have a look at

reversed(zip(...)) not working as intended

2016-03-06 Thread Sven R. Kunze
Hi, what's the reason that reversed(zip(...)) raises as a TypeError? Would allowing reversed to handle zip and related functions lead to strange errors? Best, Sven -- https://mail.python.org/mailman/listinfo/python-list

Re: reversed(zip(...)) not working as intended

2016-03-06 Thread Sven R. Kunze
On 06.03.2016 19:53, Peter Otten wrote: Sven R. Kunze wrote: what's the reason that reversed(zip(...)) raises as a TypeError? Would allowing reversed to handle zip and related functions lead to strange errors? In Python 3 zip() can deal with infinite iterables -- what would you expect

Re: reversed(zip(...)) not working as intended

2016-03-06 Thread Sven R. Kunze
On 06.03.2016 19:51, Tim Chase wrote: So it looks like one needs to either results = reversed(list(zip(...))) or, more efficiently (doing it with one less duplication of the list) results = list(zip(...)) results.reverse() Nice idea. :) Unfortunately, I used it while drafting som

Re: even faster heaps

2016-03-09 Thread Sven R. Kunze
.80x) 4.41 ( 0.78x) 43.86 ( 0.77x)') So as the results are not much effected apart of __init__, i think you should consider this. Looks promising. I will

Re: even faster heaps

2016-03-09 Thread Sven R. Kunze
On 06.03.2016 14:59, Sven R. Kunze wrote: Using the original xheap benchmark <http://srkunze.blogspot.de/2016/02/the-xheap-benchmark.html>, I could see huge speedups: from 50x/25x down to 3x/2x compared to heapq. That's a massive improvement. I will publish an update soon. An

Re: even faster heaps

2016-03-09 Thread Sven R. Kunze
On 09.03.2016 19:19, Sven R. Kunze wrote: ps: there are two error's when i ran tests with test_xheap. Damn. I see this is Python 2 and Python 3 related. Thanks for bringing this to my attention. I am going to fix this soon. Fixed. -- https://mail.python.org/mailman/listinfo/python-list

Re: argparse

2016-03-12 Thread Sven R. Kunze
On 12.03.2016 00:18, Fillmore wrote: Playing with ArgumentParser. I can't find a way to override the -h and --help options so that it provides my custom help message. I remember everything being a lot easier using argh instead of argparse. https://pypi.python.org/pypi/argh#examples The doc

Re: Case Statements

2016-03-15 Thread Mario R. Osorio
On Tuesday, March 15, 2016 at 9:55:27 PM UTC-4, jj0ge...@gmail.com wrote: > You have apparently mistaken me for someone who's worried. I don't use > Python, I was just curious as to why a construct that is found, not only to > be useful in 95% of other languages, but is generally considered more

empty clause of for loops

2016-03-16 Thread Sven R. Kunze
Hi, a colleague of mine (I write this mail because I am on the list) has the following issue: for x in my_iterable: # do empty: # do something else What's the most Pythonic way of doing this? Best, Sven -- https://mail.python.org/mailman/listinfo/python-list

Re: empty clause of for loops

2016-03-16 Thread Sven R. Kunze
On 16.03.2016 11:28, Joaquin Alzola wrote: If len(my_iterable) is not 0: for x in my_iterable: # do else: # do something else I am sorry, I should have been more precise here. my_iterable is an iterator that's exhausted after a complete iteration and cannot be restored. I

monkey patching __code__

2016-03-18 Thread Sven R. Kunze
Hi, we got an interesting problem. We need to monkeypatch Django's reverse function: First approach: urlresolvers.reverse = patched_reverse Problem: some of Django's internal modules import urlresolvers.reverse before we can patch it for some reasons. Second approach: urlresolvers.rev

Re: Bash-like pipes in Python

2016-03-18 Thread Sven R. Kunze
On 16.03.2016 16:09, Joel Goldstick wrote: symbol '|' in python. Can you elaborate bitwise or -- https://mail.python.org/mailman/listinfo/python-list

Re: empty clause of for loops

2016-03-18 Thread Sven R. Kunze
On 17.03.2016 01:27, Steven D'Aprano wrote: That post describes the motivating use-case for the introduction of "if...else", and why break skips the "else" clause: for x in data: if meets_condition(x): break else: # raise error or do additional processing It might help to r

Re: monkey patching __code__

2016-03-18 Thread Sven R. Kunze
On 18.03.2016 15:33, Sven R. Kunze wrote: On 18.03.2016 15:23, Ian Kelly wrote: On Fri, Mar 18, 2016 at 7:47 AM, Ian Kelly wrote: Your patched version takes two extra arguments. Did you add the defaults for those to the function's __defaults__ attribute? And as an afterthought, you'

Re: empty clause of for loops

2016-03-18 Thread Sven R. Kunze
On 16.03.2016 17:56, Sven R. Kunze wrote: On 16.03.2016 17:37, Random832 wrote: On Wed, Mar 16, 2016, at 11:17, Sven R. Kunze wrote: I can imagine that. Could you describe the general use-case? From what I know, "else" is executed when you don't "break" the loop. W

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 17:20, Terry Reedy wrote: On 3/16/2016 11:17 AM, Sven R. Kunze wrote: On 16.03.2016 16:02, Tim Chase wrote: Does it annoy me when I have to work in other languages that lack Python's {for/while}/else functionality? You bet. I can imagine that. Could you describ

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 14:09, Tim Chase wrote: If you can len() on it, then the obvious way is if my_iterable: for x in my_iterable: do_something(x) else: something_else() However, based on your follow-up that it's an exhaustible iterator rather than something you can len(), I'd u

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 14:58, alister wrote: no , i just typed it, while trying to hold a conversation with swmbo :-( apologies to the op if e could not see where i was intending to go with this. No problem, I perform quite well at guessing folk's intention. So, yes, I can extrapolate what you meant.

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 15:29, Sven R. Kunze wrote: On 16.03.2016 13:57, Peter Otten wrote: I'd put that the other way round: syntactical support for every pattern would make for a rather unwieldy language. You have to choose carefully, and this requirement could easily be fulfilled by a fun

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 13:08, Steven D'Aprano wrote: Doing what? What is the code supposed to do? What's "empty" mean as a keyword? If you explain what your friends wants, then perhaps we can suggest something. Otherwise we're just guessing. I can think of at least two different meanings: * run the "emp

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 17:37, Random832 wrote: On Wed, Mar 16, 2016, at 11:17, Sven R. Kunze wrote: I can imagine that. Could you describe the general use-case? From what I know, "else" is executed when you don't "break" the loop. When is this useful? for item in col

Re: monkey patching __code__

2016-03-19 Thread Sven R. Kunze
On 18.03.2016 15:23, Ian Kelly wrote: On Fri, Mar 18, 2016 at 7:47 AM, Ian Kelly wrote: Your patched version takes two extra arguments. Did you add the defaults for those to the function's __defaults__ attribute? And as an afterthought, you'll likely need to replace the function's __globals__

Re: Replace weird error message?

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 19:53, Ben Finney wrote: Do you think some better error message should be used? Yes, I think that error message needs to be improved. Please file a bug report in Python's issue tracker https://bugs.python.org/>. For example a hint that "0" does work for the given argument. I sug

Re: monkey patching __code__

2016-03-19 Thread Sven R. Kunze
On 18.03.2016 15:48, Ian Kelly wrote: Well I didn't design it, so I'm not really sure. But it could be argued that the defaults are intrinsic to the function declaration, not the code object, as not all code objects even have arguments. It also makes it straight-forward to create a new function t

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 13:57, Peter Otten wrote: I'd put that the other way round: syntactical support for every pattern would make for a rather unwieldy language. You have to choose carefully, and this requirement could easily be fulfilled by a function, first in your personal toolbox, then in a public

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 18.03.2016 20:10, Palpandi wrote: You can do like this. if not my_iterable: for x in my_iterable: Thanks for you help here, however as already pointed out, my_iterable is not necessarily a list but more likely an exhaustible iterator/generator. Best, Sven -- https://mail.pyth

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 11:47, Peter Otten wrote: What would you expect? A keyword filling the missing functionality? Some Python magic, I haven't seen before. ;-) class Empty(Exception): pass ... def check_empty(items): ... items = iter(items) ... try: ... yield next(items) ...

Re: monkey patching __code__

2016-03-19 Thread Sven R. Kunze
On 18.03.2016 14:47, Ian Kelly wrote: Your patched version takes two extra arguments. Did you add the defaults for those to the function's __defaults__ attribute? That's it! :-) Thanks a lot. Just to understand this better: why is that not part of the code object but part of the function?

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 18:08, Random832 wrote: Yeah, well, you can *almost* get there with: try: thing = next(item for item in collection if good(item)) except StopIteration: thing = default But the for/else thing seems like a more natural way to do it. Plus, this is a toy example, if the body

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 16:02, Tim Chase wrote: On 2016-03-16 15:29, Sven R. Kunze wrote: I would re-use the "for-else" for this. Everything I thought I could make use of the "-else" clause, I was disappointed I couldn't. Hmm...this must be a mind-set thing. I use the "els

Re: monkey patching __code__

2016-03-20 Thread Sven R. Kunze
On 19.03.2016 00:58, Matt Wheeler wrote: I know you have a working solution now with updating the code & defaults of the function, but what about just injecting your function into the modules that had already imported it after the monkeypatching? Seems perhaps cleaner, unless you'd end up having

Re: monkey patching __code__

2016-03-22 Thread Sven R. Kunze
On 21.03.2016 21:42, Matt Wheeler wrote: On 20 March 2016 at 16:46, Sven R. Kunze wrote: On 19.03.2016 00:58, Matt Wheeler wrote: I know you have a working solution now with updating the code & defaults of the function, but what about just injecting your function into the modules that

how to cache invalidation

2016-03-22 Thread Sven R. Kunze
Hi everybody, I got another module up and running: xcache Background described here: http://srkunze.blogspot.com/2016/03/safe-cache-invalidation.html We needed a way to safely invalidate rlu_caches once a Web request has been finished. So, we came up with a solution using garbage collection

Re: monkey patching __code__

2016-03-23 Thread Sven R. Kunze
On 23.03.2016 09:24, dieter wrote: But you have observed that you cannot do everything with a code substitution: a function call does not only depend on the code but also on other properties of the function object: e.g. the parameter processing. Yep, that's because Python is very flexible and p

Re: newbie question

2016-03-24 Thread Sven R. Kunze
On 24.03.2016 11:57, Matt Wheeler wrote: import ast s = "(1, 2, 3, 4)" t = ast.literal_eval(s) t (1, 2, 3, 4) I suppose that's the better solution in terms of safety. -- https://mail.python.org/mailman/listinfo/python-list

Re: newbie question

2016-03-24 Thread Sven R. Kunze
On 24.03.2016 14:22, Matt Wheeler wrote: On Thu, 24 Mar 2016 11:10 Sven R. Kunze, wrote: On 24.03.2016 11:57, Matt Wheeler wrote: import ast s = "(1, 2, 3, 4)" t = ast.literal_eval(s) t (1, 2, 3, 4) I suppose that's the better solution in terms of safety. It has the added

Re: Interpretation

2016-03-26 Thread Mario R. Osorio
On Saturday, March 26, 2016 at 5:59:04 AM UTC-4, Dennis Ngeno wrote: > My programs have never combile, they keep telling me , systax error even > after copy pasting No pun intended, but I hope you are not typing your code like you typed your message. OTOH, python code is not supposed to be compi

Re: Anyone know the solution

2014-10-28 Thread Mario R. Osorio
On Tuesday, October 28, 2014 12:25:13 AM UTC-4, Terry Reedy wrote: > On 10/27/2014 11:10 AM, emmanuel...@gmail.com wrote: > > > THIS IS THE LIST OF BOY NAMES > > Jacob > > ... > > Writing hundreds of unnecessary lines at minimum inconsiderate. Please > don't do it. > > -- > Terry Jan Reedy

Help needed

2014-11-29 Thread Gautam R Bharadwaj
Here is the code in python, this code arranges the alphabets in descending order and now I want to encode each alphabet with 0 and next alphabet with 1, then 00,01,10,11,000,001 and so on. Please help me with that. // //CODE

Re: Dynamically reference member of array

2014-03-29 Thread R. Michael Weylandt
On Wed, Mar 26, 2014 at 7:43 AM, Ben Collier wrote: > Hi all, > > I know that I can dynamically reference a variable with locals()["i"], for > instance, but I'd like to know how to do this with a variable in an object. > > If I have an object called "device", with variables called attr1, attr2 ..

Help wanted: Writing a PMI Project Management system

2013-10-04 Thread john . r . moser
I'm looking for anyone who has an interest in project management; workable Python design and programming skills; and wants to code for an open source Project Management system. Having used Redmine, Launchpad, Trak, OpenProj, and so on, I've found there's no good PM tools. Microsoft Project and

Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-07 Thread R. Michael Weylandt
On Nov 7, 2013, at 21:25, jonas.thornv...@gmail.com wrote: > Den fredagen den 8:e november 2013 kl. 03:17:36 UTC+1 skrev Chris Angelico: >> On Fri, Nov 8, 2013 at 1:05 PM, wrote: >> >>> I guess what matter is how fast an algorithm can encode and decode a big >>> number, at least if you want

Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-07 Thread R. Michael Weylandt
On Nov 7, 2013, at 22:24, Chris Angelico wrote: > On Fri, Nov 8, 2013 at 1:43 PM, R. Michael Weylandt > wrote: >> Chris's point is more subtle: the typical computer will store the number >> 65536 in a single byte, but it will also store 4 and 8 in one byte. > &g

seek operation in python

2015-04-29 Thread siva sankari R
file=open("input","r") line=file.seek(7) print line The above code is supposed to print a line but it prints "none". I don't know where the mistake is. Help.! -- https://mail.python.org/mailman/listinfo/python-list

Re: seek operation in python

2015-04-29 Thread siva sankari R
There is a file named "input.cpp"(c++ file) that contains some 80 lines of code. -- https://mail.python.org/mailman/listinfo/python-list

Multi-threaded TCP server class for general use

2015-05-07 Thread mark . r . bannister
Hi, I needed to develop a highly scalable multi-threaded TCP server in Python and when I started writing it in 2013 I could not find a suitable library that would scale the way I needed but also easy to use. So I invented one - it's called Pyloom. If you want to take a look, it's part of my D

Re: Best approach to create humongous amount of files

2015-05-21 Thread Mario R. Osorio
On Wednesday, May 20, 2015 at 2:09:59 PM UTC-4, Denis McMahon wrote: > On Wed, 20 May 2015 17:14:15 +0530, Parul Mogra wrote: > > > Hello everyone, > > My objective is to create large amount of data files (say a million > > *.json files), using a pre-existing template file (*.json). Each file > >

Re:

2015-05-28 Thread Mario R. Osorio
Chris. Este grupo es en Ingles. La verdad no se si existen grupos en español, pero juraria que si. Entiendo que quieres enseñarle python a tu hijo. Aca te envio algunos recursos. Espero que te sirvan: https://silvercorp.wordpress.com/2012/05/27/pasos-de-instalacion-de-python-en-windows/ http:/

Re:

2015-05-29 Thread Mario R. Osorio
?Quien es Usted y por que pregunta? Dtb/Gby === Mario R. Osorio “If I had asked people what they wanted, they would have said faster horses.” ― Henry Ford On Fri, May 29, 2015 at 1:33 AM, Laura Creighton wrote: > Sabe usted acerca de estas páginas? > https://mail.python.org/m

Re: Pandas SQL Update

2015-06-16 Thread Mario R. Osorio
You are not specifying how are you doing the comparison, but here is my 2 cents: Import the foxpro tables into the MySQL database and then you'll be able to do your update in a single SQL statement, which, even for that many records would take some only a few seconds, then delete th imported da

Hooking Mechanism when Entering and Leaving a Try Block

2015-08-11 Thread Sven R. Kunze
Hi everybody, is there something like a hook that a Python module could register to in order to 'trace' the entering and leaving of arbitrary try blocks? What is this good for? I am the maintainer of https://pypi.python.org/pypi/xfork . A package for converting a classic sequential program

Re: Hooking Mechanism when Entering and Leaving a Try Block

2015-08-12 Thread Sven R. Kunze
Unfortunately, no. :( It should work out of the box with no "let me replace all my try-except statements in my 10 million line code base". On 12.08.2015 17:32, Ian Kelly wrote: On Tue, Aug 11, 2015 at 3:47 PM, Sven R. Kunze wrote: is there something like a hook that a Python mo

Re: Hooking Mechanism when Entering and Leaving a Try Block

2015-08-12 Thread Sven R. Kunze
On 12.08.2015 18:11, Chris Angelico wrote: On Thu, Aug 13, 2015 at 2:05 AM, Sven R. Kunze wrote: Unfortunately, no. :( It should work out of the box with no "let me replace all my try-except statements in my 10 million line code base". (Please don't top-post.) Is this so

Re: Hooking Mechanism when Entering and Leaving a Try Block

2015-08-12 Thread Sven R. Kunze
On 13.08.2015 02:45, Chris Angelico wrote: On Thu, Aug 13, 2015 at 6:54 AM, Mark Lawrence wrote: On 12/08/2015 19:44, Sven R. Kunze wrote: On 12.08.2015 18:11, Chris Angelico wrote: (Please don't top-post.) Is this some guideline? I actually quite dislike pick somebody's mail to

Re: Hooking Mechanism when Entering and Leaving a Try Block

2015-08-12 Thread Sven R. Kunze
On 12.08.2015 20:44, Sven R. Kunze wrote: On 12.08.2015 18:11, Chris Angelico wrote: Sounds to me like you want some sort of AST transform, possibly in an import hook. Check out something like MacroPy for an idea of how powerful this sort of thing can be. Sounds like I MacroPy would enable me

Re: [Back off topic] - Hooking Mechanism when Entering and Leaving a Try Block

2015-08-14 Thread Sven R . Kunze
Am 14-Aug-2015 03:00:05 +0200 schrieb torr...@gmail.com: > But I digress. We get sidetracked rather easily around here. You don't say. ;) - FreeMail powered by mail.de - MEHR SICHERHEIT, SERIOSITÄT UN

Python Import Hooks and __main__

2015-08-17 Thread Sven R. Kunze
Hi, following up on this thread on StackOverflow http://stackoverflow.com/questions/16515347/python-import-hooks-and-main does somebody has a great idea how to manage this? The issue at hand is, that I would like to apply a specific import hook right from the beginning of the interpreter run

Re: asyncio, coroutines, etc. and simultaneous execution

2015-08-24 Thread Sven R. Kunze
On 23.08.2015 23:43, Charles Hixson wrote: If I understand correctly asyncio, coroutines, etc. (and, of course, Threads) are not simultaneously executed, and that if one wants that one must still use multiprocessing. But I'm not sure. The note is still there at the start of threading, so I'm p

Re: Casting to a "number" (both int and float)?

2015-08-28 Thread Sven R. Kunze
Hey Victor, for proper parsing into native Python types, I would recommend YAML. Also also supports (besides int vs. float) dates and datetimes. Cheers, Sven On 28.08.2015 07:04, Victor Hooi wrote: Actually, I've just realised, if I just test for numeric or try to cast to ints, this will bre

Re: Casting to a "number" (both int and float)?

2015-08-30 Thread Sven R. Kunze
28.08.2015 um 18:09 schrieb Sven R. Kunze: >> I'm reading JSON output from an input file, and extracting values. > for proper parsing into native Python types, I would recommend YAML. "What's the best way to get from A to B?" "I recommend starting at C." - E

Re: packing unpacking depends on order.

2015-09-02 Thread Sven R. Kunze
I agree as well. First evaluate the right side, then assign it to the left side at once. On 02.09.2015 12:22, Nick Sarbicki wrote: That's interesting. I agree with you, I'd prefer the second result in both cases. But makes sense as it evaluates left to right and seems to break up the unpacki

Re: Python handles globals badly.

2015-09-02 Thread Sven R. Kunze
On 02.09.2015 20:47, t...@freenet.de wrote: 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 r

Re: packing unpacking depends on order.

2015-09-02 Thread Sven R. Kunze
On 02.09.2015 19:42, Terry Reedy wrote: On 9/2/2015 6:01 AM, Antoon Pardon wrote: a = [1, 2, 3, 4, 5] b = 1 b, a[b] = a[b], b a [1, 2, 1, 4, 5] a = [1, 2, 3, 4, 5] b = 1 a[b], b = b, a[b] a [1, 1, 3, 4, 5] I think I understand how it gets these results but I'm not really happy with them. I

Re: Strange location for a comma

2015-09-03 Thread Sven R. Kunze
On 03.09.2015 14:20, ast wrote: Hello, At the end of the last line of the following program, there is a comma, I dont understand why ? Thx from cx_Freeze import setup, Executable # On appelle la fonction setup setup( name = "salut", version = "0.1", description = "Ce programme vous d

Re: Python handles globals badly.

2015-09-03 Thread Sven R. Kunze
On 03.09.2015 00:25, t...@freenet.de wrote: It is the good idea of Python about modules which are singletons and therefore have already its state (so in some way they are already somehow like classes - except the bad annoying thing with the "global" statement). So, what you really want is a bet

Re: packing unpacking depends on order.

2015-09-03 Thread Sven R. Kunze
On 03.09.2015 03:17, random...@fastmail.us wrote: The question is what does "assign it to the left side at once" even *mean* in the presence of subscripts? Build up a list of object-subscript pairs (evaluating all the subscripts, including if any may have side effects) before executing any __set

Re: packing unpacking depends on order.

2015-09-04 Thread Sven R. Kunze
On 04.09.2015 05:36, random...@fastmail.us wrote: You haven't demonstrated that the RHS is affected by anything. The sample code in the original post of this thread behaves identically if the RHS is a simple tuple of (2, 1) [or (1, 2)] respectively. If you have another sample that shows differe

Re: Python handles globals badly.

2015-09-04 Thread Sven R. Kunze
On 04.09.2015 18:55, t...@freenet.de wrote: From knowing e.g Java as OO language I had no need to set such a keyword "global" to get write access to class members. It is true and I really dislike Java for having this. Please consider this class MyClass: @classmethod def method(cls):at

Wheels For ...

2015-09-06 Thread Sven R. Kunze
Hi folks, currently, I came across http://pythonwheels.com/ during researching how to make a proper Python distribution for PyPI. I thought it would be great idea to tell other maintainers to upload their content as wheels so I approached a couple of them. Some of them already provided wheels.

Re: Wheels For ...

2015-09-08 Thread Sven R. Kunze
On 06.09.2015 22:06, Ned Batchelder wrote: As a developer of a Python package, I don't see how this would be better. The developer would still have to get their software into some kind of uniform configuration, so the central authority could package it. You've moved the problem from, "everyone h

<    4   5   6   7   8   9   10   11   12   >