Re: Track down SIGABRT

2015-01-13 Thread Paul Rubin
Israel Brewster writes: > when it again crashed with a SIGABRT. The crash dump the > system gave me doesn't tell me much, other than that it looks > like python is calling some C function when it crashes. I've > attached the crash report, in case it can mean somethi

Re: Trees

2015-01-20 Thread Paul Rubin
Marko Rauhamaa writes: > So in my Python software (both at work and at home) needs, I use a > Python AVL tree implementation of my own. My use case is timers. (GvR > uses heapq for the purpose.) Have you benchmarked your version against heapq or even the builtin sorting functions? -- https://mai

Re: Trees

2015-01-20 Thread Paul Rubin
Steven D'Aprano writes: > Possibly because they aren't needed? Under what circumstances would > you use a tree instead of a list or a dict or combination of both? I've sometimes wanted a functional tree in the sense of functional programming. That means the tree structure is immutable and you in

Re: Trees

2015-01-20 Thread Paul Rubin
Marko Rauhamaa writes: > As I said, I use ordered mappings to implement timers... The downside > of heapq is that canceled timers often flood the heapq structure..., > GvR mentioned a periodic "garbage collection" as a potentially > effective solution. You could look up the "timer wheel" approac

Re: Trees

2015-01-20 Thread Paul Rubin
Rustom Mody writes: > ## The depth first algorithm > dfs (L x) = [x] > dfs (B x lst rst) = [x] ++ dfs lst ++ dfs rst Cute. I can't resist posting the similar breadth first algorithm: bfs (L x) = [x] bfs (B x lst rst) = bfs lst ++ [x] ++ bfs rst > *Main> dfs t > [6,2,1,4,3,5,8,7,9] *

Re: Trees

2015-01-21 Thread Paul Rubin
Rustom Mody writes: > Thats not bfs. That's inorder traversal Oops, you're right. How's this: bfs x = go [x] where go [] = [] go (L x:ts) = x:go ts go (B x lst rst:ts) = x : go (ts ++ [lst, rst]) *Main> bfs t [6,2,8,1,4,7,9,3,5] -- https://mail.python.org/mailman/listinfo/python-list

Re: How to "wow" someone new to Python

2015-01-21 Thread Paul Rubin
Alan Bawden writes: > The language has changed. When I was a novice Lisp hacker, we were > comfortable saying that Lisp was "untyped". But nowadays we always say > that Lisp is "dynamically typed". I could write an essay about why... I'd be interested in seeing that. Lisp of course descends f

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Paul Rubin
Steven D'Aprano writes: > In 2009, Robert Martin gave a talk at RailsConf titled "What Killed > Smalltalk Could Kill Ruby"... http://www.youtube.com/watch?v=YX3iRjKj7C0 That's an hour-long video; could someone who's watched it give a brief summary? Meanwhile, there's this: http://prog21.dadgum

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Paul Rubin
Mario Figueiredo writes: > "I want to become a programmer so I can make games" is, on the vast > majority of cases, the quote of someone who will never become a > programmer. Why should teachers reward that kind of thought? I don't see what the problem is. Kids are interested in games and th

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Paul Rubin
Chris Angelico writes: > Either you pick up a super-restrictive "hey look, you can build a game > with just point and click" system, which isn't teaching programming at > all, or you end up getting bogged down in the massive details of what > it takes to write code. Code Hero ran into various obs

Re: Python is DOOMED! Again!

2015-01-21 Thread Paul Rubin
Steven D'Aprano writes: > def median_grouped(data:Iterable[Real], interval:Real=1)->Real: ... Wow, that's really nice. I had heard something about Python type hints but hadn't seen them before. > So how does Python's proposed type-hints compared to that used by other > languages? The most clo

Re: Python is DOOMED! Again!

2015-01-21 Thread Paul Rubin
Paul Rubin writes: > -spec median_grouped(iterable(real())) -> real(). Oops: -spec median_grouped(iterable(real()), real()) -> real(). -- https://mail.python.org/mailman/listinfo/python-list

Re: Python is DOOMED! Again!

2015-01-21 Thread Paul Rubin
Rick Johnson writes: >> def median_grouped(data:Iterable[Real], interval:Real=1)->Real: ... > > Nice! I like how the first "toy example" was less noisy, > and then way down here you show us the real butt-uglyness of > this "feature from hell"! It looks fine to me. I'm still using Python 2.7 beca

Re: Trees

2015-01-21 Thread Paul Rubin
Ian Kelly writes: > How do you create a tree containing an even number of elements under > this constraint? That's a good point, I've usually seen different definitions of trees, e.g. data Tree a = Leaf | Branch a (Tree a) (Tree a) so a Leaf node doesn't have a value associated with it. h

Re: Python is DOOMED! Again!

2015-01-22 Thread Paul Rubin
Mario Figueiredo writes: > Strangely enough though I was taught from the early beginning that > once I start to care about types in Python, I strayed from the > pythonic way. That's a weird concept. You always have to care about types. It's just that with a bit of discipline combined with unit

Re: Python is DOOMED! Again!

2015-01-22 Thread Paul Rubin
Steven D'Aprano writes: > Since the "language wars" of the 1990s, dynamic languages have won. Are you kidding? Nothing has won, the wars are still going on, and dynamic and static typing both have their winning use cases and will be around forever. -- https://mail.python.org/mailman/listinfo/p

Re: Python is DOOMED! Again!

2015-01-22 Thread Paul Rubin
>> correctly https://www.python.org/dev/peps/pep-0484/#usage-patterns > That's not evidence, that's a prophecy. > What I'm seeing is a bad shift in the Python culture. What's next? > Unboxed objects? Unsafe objects? Micromanaged GC? Why are you freaking out so much? The "prophecy" is for somethin

Re: Python is DOOMED! Again!

2015-01-22 Thread Paul Rubin
Ian Kelly writes: > T = TypeVar('T') > def adder(a: T, b: T) -> T: ... > I'm not thrilled about having to actually declare T in this sort of > situation, but I don't have a better proposal. Oh man, that's ugly. Maybe a decorator would be a bit less awful: @-typevar T def adder(a: T, b:

Re: Python is DOOMED! Again!

2015-01-22 Thread Paul Rubin
Sturla Molden writes: > Type hinting will be mandatory because of bad managers. That's a pretty weird concept: I've worked for good managers and bad ones, but so far never one who imposed any low-level code style decisions without also being involved in writing the code. That was always left to

Re: Python is DOOMED! Again!

2015-01-23 Thread Paul Rubin
Rustom Mody writes: > However Peyton Jones is known to have said that for Haskell, > Haskell is on a Damas-Milner cusp He's talking about the hairy recent stuff that edge Haskell towards dependent types. E.g. type families (type-level functions) plus type-level numbers, etc. I don't think anyon

Re: Python Sanity Proposal: Type Hinting Solution

2015-01-24 Thread Paul Rubin
Steven D'Aprano writes: > versus any other decorator, but the STRING: > "@typehint(...)" > being used where a decorator would normally be expected. I didn't catch that either. I think if hints are to go in decorators, then it's best to extend the decorator mechanism to allow arbitrary syntax, e.

Re: [OT] fortran lib which provide python like data type

2015-01-30 Thread Paul Rubin
Michael Torrie writes: > Follow basic [C++] rules and 99% of segfaults will never happen and > the majority of leaks will not happen either. That is a safe and simple approach, but it works by copying data all over the place instead of passing pointers, resulting in performance loss. Alex Martel

Re: Python is DOOMED! Again!

2015-01-31 Thread Paul Rubin
Steven D'Aprano writes: > Some degree of weakness in a type system is not necessarily bad. Even the > strongest of languages usually allow a few exceptions, such as numeric > coercions. Haskell doesn't have automatic coercions of any sort. You have to call a conversion function if you want to tu

Re: [OT] fortran lib which provide python like data type

2015-01-31 Thread Paul Rubin
Marko Rauhamaa writes: > The guiding principle in C++ language development is to take static > type safety to the extreme. Heh, try Ada. > Stroustrup apparently has never had to deal with callbacks; his thick > books never made a mention of them last time I checked. C++ has function pointers

Re: Python is DOOMED! Again!

2015-02-01 Thread Paul Rubin
Steven D'Aprano writes: > C has a single nil pointer compatible with all pointer types. C++11 has a separate type just for the null pointer, which can be automatically coerced to other pointer types. I'm not sure but I think that means it is couthing up slightly. http://en.cppreference.com/w/cp

Re: Python is DOOMED! Again!

2015-02-01 Thread Paul Rubin
Devin Jeanpierre writes: > That said, Haskell (and the rest) do have a sort of type coercion, of > literals at compile time (e.g. 3 can be an Integer or a Double > depending on how you use it.) That's polymorphism, not coercion. The compiler figures out at compile time what type of 3 you actuall

Re: Python is DOOMED! Again!

2015-02-01 Thread Paul Rubin
Chris Angelico writes: > So since you can set something to Nothing regardless of type, and > compare it against Nothing regardless of type, it doesn't really much > matter that there are different types of Nothing. Right? No that's not how type inference works. If you have x = Nothing and pass i

Re: Python is DOOMED! Again!

2015-02-01 Thread Paul Rubin
Steven D'Aprano writes: > if type(ptr) == A: > if ptr != Anil: ... > if type(ptr) == B: > if ptr != Bnil: ... > etc. That would be insane. So how does Haskell do this? That wouldn't make sense in Haskell: the types are known at compile time, so you wouldn't do that runtime switching on t

Re: Python is DOOMED! Again!

2015-02-01 Thread Paul Rubin
Chris Angelico writes: > If you say "x = 5" and pass it to a function that accepts "Int or > String", the compiler knows that it's actually an Int. If you then > also pass that x to something that takes "Int or List", is that legal? You'd have to do that with type classes, but yeah, the compiler

Re: Python is DOOMED! Again!

2015-02-01 Thread Paul Rubin
Steven D'Aprano writes: > No apples and no oranges aren't the same thing, but if somebody is expecting > no apples, and I give them no oranges instead, it would be churlish for them > to complain that none of them are the wrong kind of fruit. https://davedevine.wordpress.com/2011/01/20/the-sart

Re: Is there a cairo like surface for the screen without the window hassle

2015-02-02 Thread Paul Rubin
Antoon Pardon writes: > So does someone know of a package that provides a cairo like surface Not sure what a cairo like surface is, but maybe you want HTML5 Canvas that's built into recent browsers. So you'd just embed a web server in your application and interact with it through a browser. --

Re: Downloading videos (in flash applications) using python

2015-02-02 Thread Paul Rubin
Gabriel Ferreira writes: > I appreciate your help. I'm just afraid that Youtube-DL doesn't allow > me to record or download a LIVE STREAMING VIDEO. Do you guys think it > is possible, since I make some adjustments into the code of the > library? If the stream operator really wants stop you from d

Re: Downloading videos (in flash applications) using python

2015-02-02 Thread Paul Rubin
Gabriel Ferreira writes: > Hi Paul, I presume the stream operator doesn't want to prevent me from > downloading or recording the videos. It's hard to tell why anyone uses Flash anymore, but impeding (if not preventing) downloads is probably a common reason. > I just wanna know more about some

Re: Async/Concurrent HTTP Requests

2015-02-12 Thread Paul Rubin
Ari King writes: > I'd like to query two (or more) RESTful APIs concurrently. What is the > pythonic way of doing so? Is it better to use built in functions or > are third-party packages? Thanks. The two basic approaches are event-based asynchronous i/o (there are various packages for that) and t

Re: Async/Concurrent HTTP Requests

2015-02-12 Thread Paul Rubin
Marko Rauhamaa writes: > I have successfully done event-driven I/O using select.epoll() and > socket.socket(). Sure, but then you end up writing a lot of low-level machinery that packages like twisted take care of for you. -- https://mail.python.org/mailman/listinfo/python-list

Re: python implementation of a new integer encoding algorithm.

2015-02-17 Thread Paul Rubin
janhein.vanderb...@gmail.com writes: > The next step is the development of the python code that minimizes > processor requirements without compromising the algorithm. This is a reasonable place to ask specific python questions. The algorithm description itself is pretty confusing though, and it s

Re: What behavior would you expect?

2015-02-19 Thread Paul Rubin
Dan Sommers writes: > I'd still prefer an exception to None, and we agree on that an empty > string is bad because it's not a non-string and it could be too easily > mistaken for a filename. Empty string would be bad. Sometimes I like to simulate an option type, by returning the value as a 1-ele

Re: What behavior would you expect?

2015-02-19 Thread Paul Rubin
Chris Angelico writes: >> if len(fs) == 0: ... # didn't get a filename > Bikeshedding: That could be written as simply "if not fs". :) Yeah, in that instance you could do that. It's an unsafe practice when None is used as the no-value marker, since the empty string is a perfectly good string

Re: 'Lite' Databases (Re: sqlite3 and dates)

2015-02-20 Thread Paul Rubin
Ben Finney writes: > I don't know of a free-software concurrent RDBMS which can be considered > lighter than that. (No, MySQL doesn't count; its concurrency is > *unreliable* and it commonly loses data silently. Don't use MySQL.) I thought they fixed MySQL transactions years ago, with the InnoDB

Re: 'Lite' Databases (Re: sqlite3 and dates)

2015-02-20 Thread Paul Rubin
Ned Deily writes: > (though I don't know why anyone would want to fork it). Same reason lots of people have forked Postgres. Or you might just want to customize it. > I imagine that is done as an incentive to help > finance the on-going development and maintenance of SQLite. It's a pretty un

Re: 'Lite' Databases (Re: sqlite3 and dates)

2015-02-21 Thread Paul Rubin
Ned Deily writes: >> Same reason lots of people have forked Postgres. Or you might just want >> to customize it. > Well, for whatever reason one might have, one can: it's public domain > software. Yes, but unlike with most FOSS software, your version has much lower quality assurance than the "o

Re: Best practice: Sharing object between different objects

2015-02-21 Thread Paul Rubin
pfranke...@gmail.com writes: > ADC, DAC components. As I said, I would like to derive the > corresponding classes from one common class, let's say I2CDevice, so > that they can share the same bus connection (I don't want to do a > import smbus, ..., self.bus = smbus.SMBus(1) all the time). I don'

Re: Future of Pypy?

2015-02-22 Thread Paul Rubin
Laura Creighton writes: > Because one thing we do know is that people who are completely and > utterly ignorant about whether having multiple cores will improve > their code still want to use a language that lets them use the > multiple processors. If the TM dream of having that just happen, > se

Re: Future of Pypy?

2015-02-22 Thread Paul Rubin
Laura Creighton writes: > The GIL isn't going away from PyPy any time real soon, alas. I thought the GIL's main purpose was to avoid having to lock all the CPython refcount updates, so if PyPy has tracing GC, why is there still a GIL? And how is TM going to help with parallelism if the GIL is st

Re: Future of Pypy?

2015-02-22 Thread Paul Rubin
Steven D'Aprano writes: > I'm sorry, but the instant somebody says "eliminate the GIL", they lose > credibility with me. Yes yes, I know that in *your* specific case you've > done your research and (1) multi-threaded code is the best solution for > your application and (2) alternatives aren't suit

Re: Future of Pypy?

2015-02-22 Thread Paul Rubin
Laura Creighton writes: > And given that Lennart is a friend, well really a good friend of my > lover and a something-better- than-an-acquaintance with me I > should make the effort to get these two under the same roof (mine, by > preference) for the fun of the experience. Oh cool, right, I

Re: Future of Pypy?

2015-02-22 Thread Paul Rubin
Ryan Stuart writes: > Many people have written at length about why it's bad. The most recent > example I have come across is here -> > https://glyph.twistedmatrix.com/2014/02/unyielding.html That article is about the hazards of mutable state shared between threads. The key to using threads safel

Re: Future of Pypy?

2015-02-22 Thread Paul Rubin
Ryan Stuart writes: > I think that is a pretty accurate summary. In fact, the article even > says that. So, just to iterate its point, if you are using > non-blocking Queues to communicate to these threads, then you just > have a communicating event loop. Given that Queues work perfectly with > wi

Re: Future of Pypy?

2015-02-23 Thread Paul Rubin
Chris Angelico writes: > So, you would have to pass code to the other process, probably. What > about this: > y = 4 > other_thread_queue.put(lambda x: x*y) the y in the lambda is a free variable that's a reference to the surrounding mutable context, so that's at best dubious. You could use:

Re: Are threads bad? - was: Future of Pypy?

2015-02-23 Thread Paul Rubin
Ryan Stuart writes: > I'm not sure what else to say really. It's just a fact of life that > Threads by definition run in the same memory space and hence always > have the possibility of nasty unforeseen problems. They are unforeseen > because it is extremely difficult (maybe impossible?) to try an

Re: Can tuples be replaced with lists all the time?

2014-02-22 Thread Paul Rubin
Sam writes: > My understanding of Python tuples is that they are like immutable > lists. If this is the cause, why can't we replace tuples with lists > all the time (just don't reassign the lists)? You can do that a lot of the time but not always. For example, you can use a tuple as a dictionar

Re: threading

2014-04-06 Thread Paul Rubin
Marko Rauhamaa writes: > Since then both Windows and Java have come up with their own I/O > multiplexing facilities. Now we see Python follow suit with asyncio. That all happened because threads in those systems are rather expensive. GHC and Erlang have fast lightweight threads/processes and prog

Re: threading

2014-04-08 Thread Paul Rubin
Sturla Molden writes: > As it turns out, if you try hard enough, you can always construct a race > condition, deadlock or a livelock. If you need to guard against it, there > is paradigms like BSP, but not everything fits in. a BSP design. Software transactional memory (STM) may also be of intere

Re: threading

2014-04-08 Thread Paul Rubin
Sturla Molden writes: > When should we use C++ or Fortran instead of Python? Ever? When performance matters? > There is a reason scientists are running Python on even the biggest > supercomputers today. They use Python as a scripting wrapper around numerics libraries written in compiled langua

Re: Why Python 3?

2014-04-18 Thread Paul Rubin
Anthony Papillion writes: > Some say 'Python 3 is the future, use it for everything now' and other > say 'Python 3 is the future but you can't do everything in it now so > use Python 2'. Python 3 is generally better than Python 2, except for a few packages that haven't been ported. That said, I

Re: Why Python 3?

2014-04-19 Thread Paul Rubin
Terry Reedy writes: > LibreOffice bundles 3.3. So anyone who does Python scripting in > LibreOffice is using Python 3. Actually, I believe LO uses Python > internally for some of its scripting. If so, everyone using LO is > indirectly using 3.3. I didn't even know LO supported Python scripting, b

Re: Significant digits in a float?

2014-04-30 Thread Paul Rubin
Mark H Harris writes: >I received my Pickett Model N4-T Vector-Type Log Log Dual-Base > Speed Rule as a graduation | birthday gift... There is a nice Javascript simulation of the N4-ES here: http://www.antiquark.com/sliderule/sim/n4es/virtual-n4es.html Some other models are also on that sit

Re: Loop thru the dictionary with tuples

2014-05-25 Thread Paul Rubin
Igor Korot writes: > for (key,value) in my_dict: > #Do some stuff > > but I'm getting an error "Too many values to unpack". Use for (key,value) in mydict.iteritems(): ... otherwise you loop through just the keys, whicn in your dictionary happens to be 3-tuples. So you try to unpack a 3

Re: Python 3 is killing Python

2014-05-28 Thread Paul Rubin
Larry Martell writes: > Somthing I came across in my travels through the ether: > [1]https://medium.com/@deliciousrobots/5d2ad703365d/ "Python 3 can revive Python" https://medium.com/p/2a7af4788b10 long HN comment thread: https://news.ycombinator.com/item?id=7801834 "Python 3 is fine" http://s

Re: Python 3 is killing Python

2014-05-28 Thread Paul Rubin
Ben Finney writes: > There are many large companies still using FORTRAN and COBOL because of > a large investment in those languages, which are far more outdated than > Python 2. What's your point? I think some of us see Python 2 as perfectly fine--we've looked into Python 3 and found some minor

Re: Python 3 is killing Python

2014-05-28 Thread Paul Rubin
Steven D'Aprano writes: > The Python core developers have recent committed to providing security > updates for 2.7 until 2020. And Redhat have paid support for 2.7 until > 2023. So there's no rush. Perhaps Python 4 will be out by then and the Python 2 holdouts can skip over Python 3. > - over

Re: Benefits of asyncio

2014-06-02 Thread Paul Rubin
Marko Rauhamaa writes: > - Thread programming assumes each thread is waiting for precisely > one external stimulus in any given state -- in practice, each > state must be prepared to handle quite a few possible stimuli. Eh? Threads typically have their own event loop dispatching

Re: Benefits of asyncio

2014-06-04 Thread Paul Rubin
Marko Rauhamaa writes: > That's a good reason to avoid threads. Once you realize you would have > been better off with an async approach, you'll have to start over. That just hasn't happened to me yet, at least in terms of program organization. Python threads get too slow once there are too many

Re: Benefits of asyncio

2014-06-04 Thread Paul Rubin
Marko Rauhamaa writes: > Mostly asyncio is a way to deal with anything you throw at it. What do > you do if you need to exit the application immediately and your threads > are stuck in a 2-minute timeout? Eh? When the main thread exits, all the child threads go with it. Sometimes there is some

Re: Micro Python -- a lean and efficient implementation of Python 3

2014-06-04 Thread Paul Rubin
Steven D'Aprano writes: >> Maybe there's a use-case for a microcontroller that works in ISO-8859-5 >> natively, thus using only eight bits per character, > That won't even make the Russians happy, since in Russia there are > multiple incompatible legacy encodings. I've never understood why not

Re: Missing stack frames?

2014-06-04 Thread Paul Rubin
Nikolaus Rath writes: > Is there a way to produce a stacktrace without using the interactive > debugger? Yes, use the traceback module. -- https://mail.python.org/mailman/listinfo/python-list

Re: Micro Python -- a lean and efficient implementation of Python 3

2014-06-04 Thread Paul Rubin
Tim Chase writes: > As mentioned elsewhere, I've got a LOT of code that expects that > string indexing is O(1) and rarely are those strings/offsets reused > I'm streaming through customer/provider data files, so caching > wouldn't do much good other than waste space and the time to maintain > them

Re: A Pragmatic Case for Static Typing

2013-09-02 Thread Paul Rubin
"Russ P." writes: > I just stumbled across this video and found it interesting: > http://vimeo.com/72870631 > My apologies if it has been posted here already. The slides for it are here, so I didn't bother watching the 1 hour video: http://gbaz.github.io/slides/hurt-statictyping-07-2013.pdf I

Re: Monitor key presses in Python?

2013-09-14 Thread Paul Rubin
eamonn...@gmail.com writes: > I'd need this to run without the user knowing. You are asking for programming advice when you should probably be asking for legal advice instead, about interception of electronic communications. We are not qualified to give legal advice here. -- https://mail.python.

Re: automated unit test generation

2013-09-28 Thread Paul Rubin
skunkwerk writes: > - how difficult/tedious is writing unit tests, and why? The important thing is to write the tests at the same time as the code. If you do that, it's not too bad. It means the code is then organized around the tests and vice versa. Keeping tests in sync with changes to code c

Re: Maintaining a backported module

2013-10-23 Thread Paul Rubin
Steven D'Aprano writes: > As some of you are aware, I have a module accepted into the standard > library: > http://docs.python.org/3.4/library/statistics.html Wow, neat, I had seen something about the module and thought it looked great, but I didn't realize you were the author. Awesome! > Any

Re: Python was designed

2013-10-26 Thread Paul Rubin
Peter Cacioppi writes: >> Challenge: give some examples of things which you can do in Python, but >> cannot do *at all* in C, C++, C#, Java? > Please. No exceptions is huge. No garbage collection is huge. > But you can do anything with a Turing machine. ... Lumping C, C++, C#, and Java together

Re: my favorite line of py code so far

2013-11-09 Thread Paul Rubin
Peter Cacioppi writes: [P(*args) for args in zip([1,2,3], [6, 5, 4])] [P(x,y) for x,y in zip(...)] > Are you saying it's always preferable to avoid map? Not always. Depends on context, partly subjective. > I sometimes use map, sometimes comprehensions. I suspect other people > do the sam

python operational semantics paper

2013-11-09 Thread Paul Rubin
This looks kind of interesting. http://cs.brown.edu/~sk/Publications/Papers/Published/pmmwplck-python-full-monty/ Abstract We present a small-step operational semantics for the Python programming language. We present both a core language for Python, suitable for tools and proofs, and a translati

Re: Are threads bad? - was: Future of Pypy?

2015-02-26 Thread Paul Rubin
Ryan Stuart writes: > My point is malloc, something further up (down?) the stack, is making > modifications to shared state when threads are involved. Modifying > shared state makes it infinitely more difficult to reason about the > correctness of your software. If you're saying the libc malloc

Re: Future of Pypy?

2015-02-27 Thread Paul Rubin
Steven D'Aprano writes: > An interesting point of view: threading is harmful because it removes > determinism from your program. > http://radar.oreilly.com/2007/01/threads-considered-harmful.html Concurrent programs are inherently nondeterministic because they respond to i/o events that can happ

Re: suggestions for functional style (singleton pattern?)

2015-02-28 Thread Paul Rubin
y...@zioup.com writes: > Are there better ways to address this? Any suggestion on this style? I guess I don't completely understand the question. But one way to do a singleton in python is put the initialization code into a separate module. Then the first time you import the module, the code run

Re: (Still OT) It's not the size of the vocabulary that matters, but what you do with it [was Re: Python Worst Practices]

2015-03-01 Thread Paul Rubin
Steven D'Aprano writes: > The Aussie replies “Ah yes, I had a car like that once. American-made, is > it?” Is it true that in Australia, the number of the beast is 999? -- https://mail.python.org/mailman/listinfo/python-list

Re: Code hosting providers

2015-03-12 Thread Paul Rubin
Ben Finney writes: > Any service which doesn't run their service on free software is one to > avoid http://mako.cc/writing/hill-free_tools.html>; free software > projects need free tools to remain that way. > > GitLab https://about.gitlab.com/> is a good option: they provide > VCS, file hosting, w

Re: Code hosting providers

2015-03-13 Thread Paul Rubin
Chris Angelico writes: > In the meantime, I get zero-dollar hosting of my repos, including zip > download and such ... You're welcome to shun them. There is > definitely benefit to encouraging a multiplicity of hosting > services. But I'm not bothered by the GitHub non-free-ness, because I > take

Re: Code hosting providers

2015-03-13 Thread Paul Rubin
Ben Finney writes: > Also worth watching is Kallithea, a new federated code hosting service ... > Good hunting in finding a free-software code hosting provider for your > projects! Should also put in a mention for Savannah (savannah.gnu.org for GNU projects and savannah.nongnu.org for non-GNU fre

Re: Odd ValueError using float

2015-03-13 Thread Paul Rubin
emile writes: > *** NameError: name 'val' is not defined > (Pdb) l > 139 try: > 140 val = round(float(decval),1) > 141 except: > 142 import pdb; pdb.set_trace() If 'float' or 'round' throw an exception, the assignment to 'val' never happens, so 'val' is und

Re: Code hosting providers

2015-03-13 Thread Paul Rubin
Mario Figueiredo writes: > That's taking things too far. And when people speak of hosting your > own server, they don't necessarily mean hosting in your home computer. > Speaking for myself, I refuse to collaborate on any project that is > hosted on some dude's personal computer. Meh, you don't

Re: Code hosting providers

2015-03-13 Thread Paul Rubin
Mario Figueiredo writes: >>Question: How much money is this group, taken as the whole of the python >>world, spending on remote hosting per month? > I'd wager very little, since most options are completely free. Oh come on, if you count all forms of hosting, some of us are spending a lot (megab

Micropython?

2015-03-13 Thread Paul Rubin
http://www.micropython.org/ Has anyone used this? Know anything about it? I don't remember seeing any mention of it here. I remember there was a stripped down Python some years back that didn't work very well, but I think this is different. I just came across it by accident. Thanks. -- https

Re: Module/lib for controlling a terminal program using redrawing?

2015-03-14 Thread Paul Rubin
Dave Angel writes: >> Is there a module/library that can help me with this? > https://docs.python.org/3/howto/curses.html That's the opposite of what the OP wanted. Curses generates the escape codes and so on to draw your desired stuff on the terminal. The OP wants a screen scraper, something t

Re: More or less code in python?

2015-03-15 Thread Paul Rubin
jonas.thornv...@gmail.com writes: > I though it would be interesting doing comparissons in timing adding > massive digits in different bases. Especially in Python. Python has built-in bignums. Try "print 2**500". -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 2 to 3 conversion - embrace the pain

2015-03-15 Thread Paul Rubin
Chris Angelico writes: >>> Solution: Use it! Do the port to Python 3, and file those upstream >>> bug reports. >> One should mention that John did all of that. > Yep. I'm not saying that John did the wrong thing; what I'm saying is > that, sometimes, this kind of pain is the exact thing that makes

Re: Python 2 to 3 conversion - embrace the pain

2015-03-15 Thread Paul Rubin
Chris Angelico writes: > Ah but it isn't Py3 that's all about being first - it's the latest > version of some third-party module. You know, one of the attractions of Python used to be that it came with a powerful enough standard library that you didn't really need third party modules very often.

Re: Dict comprehensions - improvement to docs?

2015-03-15 Thread Paul Rubin
"Frank Millman" writes: > I like dict comprehensions, but I don't use them very often, so when I do I > need to look up the format. I never felt a need for them. Do they generate better code than d = dict((k,v) for k,v in [('name','paul'),('language','python')]) ? Anyway, since they are s

Re: Dict comprehensions - improvement to docs?

2015-03-16 Thread Paul Rubin
"Frank Millman" writes: > If you did not know about dict comprehensions, there is nothing to tell you > that they even exist. I feel that it should be mentioned. Yeah, the library reference should treat list and dict comprehensions the same way. I would have thought neither of them belongs in t

Re: Python 2 to 3 conversion - embrace the pain

2015-03-16 Thread Paul Rubin
Steven D'Aprano writes: > It may, or may not, turn out that in hindsight there might have been better > ways to manage the Python2-3 transaction. Let's be honest, a lot of the > changes could have been introduced incrementally... Why did the changes have to be introduced at all? > I suspect th

Re: Python 2 to 3 conversion - embrace the pain

2015-03-16 Thread Paul Rubin
Steven D'Aprano writes: > The std lib is *batteries* included. If you need a nuclear reactor, you turn > to third-party frameworks and libraries like Twisted, Zope, numpy, PLY, etc. I always thought twisted and zope were monstrosities. I've used threads instead of twisted and various other pos

Re: Dict comprehensions - improvement to docs?

2015-03-16 Thread Paul Rubin
"Frank Millman" writes: > dict((a, b) for a, b in zip(x, y)) > 10 loops, best of 3: 16.1 usec per loop > {a: b for a, b in zip(x, y)}" > 10 loops, best of 3: 6.38 usec per loop Hmm, I bet the difference is from the (a,b) consing all those tuples. Can you try just dict(zip(x,y)) ? -- ht

Re: Python 2 to 3 conversion - embrace the pain

2015-03-16 Thread Paul Rubin
Terry Reedy writes: > Every change potentially breaks something. (How would you have > changed 1/2 from 0 to .5 without breaking anything?) I would not have changed that. It was an ill-advised change that broke things unnecessarily. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 2 to 3 conversion - embrace the pain

2015-03-16 Thread Paul Rubin
Steven D'Aprano writes: >> Why did the changes have to be introduced at all? > For the same reason any improvement and functional update is > introduced. To make a better language. There comes a point when you decide that maintaining existing code is important enough that you have to stop breakin

Re: Dict comprehensions - improvement to docs?

2015-03-16 Thread Paul Rubin
Ian Kelly writes: > Since the setup code is only run once, the generator expression used > for y is only iterated over once. Ah, thanks, I'd been wondering what was going on with Frank's example but hadn't gotten around to trying to analyze it. -- https://mail.python.org/mailman/listinfo/python

Re: [OT] Weaknesses of distro package managers - was Re: Python 2 to 3 conversion - embrace the pain

2015-03-16 Thread Paul Rubin
Chris Angelico writes: > On Tue, Mar 17, 2015 at 12:46 PM, Michael Torrie wrote: >> But after 20 years, the package manager idea certain has revealed many >> shortcomings (in short, it sucks in many ways). ... > The hardest part is managing library versions, and that's always going > to be a prob

Re: Python 2 to 3 conversion - embrace the pain

2015-03-18 Thread Paul Rubin
Steven D'Aprano writes: > The two weeks we lost upgrading from Python 2.6 to 2.7 is just the > normal upgrade pains you always have to expect from any major project, Wait, what happened between 2.6 and 2.7 that took you two weeks of upgrading? -- https://mail.python.org/mailman/listinfo/python-l

Re: Python 2 to 3 conversion - embrace the pain

2015-03-19 Thread Paul Rubin
Steven D'Aprano writes: >> better to make a fork of the language > You mean like Python 3? No I mean like C to C++, or Lisp to Clojure, etc. Or if you prefer, C to OpenCL or maybe even C++ to Java or C to Go. If you're going to break old code, go big or go home ;-). > There are still people us

<    10   11   12   13   14   15   16   17   18   19   >