Re: Trees

2015-01-21 Thread Ken Seehart
Hash Table, Christiania (a table with many kinds of hash) On 1/20/2015 12:19 PM, Devin Jeanpierre wrote: There are similarly many kinds of hash tables. For a given use case (e.g. a sorted dict, or a list with efficient removal, etc.), there's a few data structures that make sense, and a library

Re: Trees

2015-01-21 Thread Marko Rauhamaa
Stephen Hansen : > On Tue, Jan 20, 2015 at 1:45 AM, Marko Rauhamaa wrote: >> Terry Reedy : >> > Others have answered as to why other special-purpose >> > constrained-structure trees have not been added to the stdlib. >> >> Ordered O(log n) mappings are not special-purpose data structures. I'd >>

Re: Concerning Dictionaries and += in Python 2.x

2015-01-21 Thread Peter Otten
Denis McMahon wrote: > On Mon, 19 Jan 2015 16:12:57 -0800, Luke Tomaneng wrote: > >> I have been having a bit of trouble with the things mentioned in the >> title. > > I've uploaded a slightly different approach to your code at: > > http://www.sined.co.uk/tmp/shop.py.txt > > def compute_bill(s

Re: Concerning Dictionaries and += in Python 2.x

2015-01-21 Thread Peter Otten
Peter Otten wrote: > Denis McMahon wrote: >> sold = {k:0 for k in shopping.keys()} > > There is also dict.from_keys() Sorry, fromkeys(): >>> shopping = {'orange': 5, 'pear': 5, 'banana': 5, 'apple': 4} >>> dict.fromkeys(shopping, 0) {'banana': 0, 'orange': 0, 'apple': 0, 'pear': 0} -- h

Re: Trees

2015-01-21 Thread Rustom Mody
On Wednesday, January 21, 2015 at 1:27:39 PM UTC+5:30, Stephen Hansen wrote: > On Tue, Jan 20, 2015 at 1:45 AM, Marko Rauhamaa wrote: > Terry Reedy : > > > > > Others have answered as to why other special-purpose > > > constrained-structure trees have not been added to the stdlib. > > > > O

Re: Trees

2015-01-21 Thread Chris Angelico
On Wed, Jan 21, 2015 at 11:09 PM, Rustom Mody wrote: > I would like a set to be {1,2,3} or at worst ⦃1,2,3⦄ > and a bag to be ⟅1,2,3⟆ > > Apart from the unicode niceness that Ive described here > http://blog.languager.org/2014/04/unicoded-python.html > > Its a bit of a nuisance that we have to wri

Re: Trees

2015-01-21 Thread Tim Chase
On 2015-01-21 23:35, Chris Angelico wrote: > On Wed, Jan 21, 2015 at 11:09 PM, Rustom Mody wrote > > Its a bit of a nuisance that we have to write set([1,2,3]) for > > the first > > Wait, what? > > rosuav@sikorsky:~$ python > Python 2.7.3 (default, Mar 13 2014, 11:03:55) > [GCC 4.7.2] on linux2 >

Re: Trees

2015-01-21 Thread Chris Angelico
On Wed, Jan 21, 2015 at 11:55 PM, Tim Chase wrote: > On 2015-01-21 23:35, Chris Angelico wrote: >> On Wed, Jan 21, 2015 at 11:09 PM, Rustom Mody wrote >> > Its a bit of a nuisance that we have to write set([1,2,3]) for >> > the first >> >> Looks like {1,2,3} works for me. > > That hasn't always wo

Re: Trees

2015-01-21 Thread Mario Figueiredo
Hello Terry, It is not play with words. A tree is a recursive - nested - hierachical data structure with the restriction of no cycles or alternate pathways. Python collections whose members are general objects, including collections, can be nested. The resulting structures *are* tree structures

Re: Concerning Dictionaries and += in Python 2.x

2015-01-21 Thread Denis McMahon
On Wed, 21 Jan 2015 09:43:31 +0100, Peter Otten wrote: > There is also dict.from_keys() See, I learned something too. > The inner loop is not just inefficient for stock sold in large > quantities, Agreed, but as for: > it will fail for stock sold by weight, volume etc. I was trying to stay tr

Re: Trees

2015-01-21 Thread Tim Chase
On 2015-01-22 00:01, Chris Angelico wrote: > On Wed, Jan 21, 2015 at 11:55 PM, Tim Chase >>> Looks like {1,2,3} works for me. >> >> That hasn't always worked: > > the argument's still fairly weak when it's alongside a pipe-dream > desire to use specific mathematical Unicode characters in source >

Re: Trees

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 1:26 AM, Tim Chase wrote: > While 2.0 is certainly antiquated, Red Hat Enterprise Linux (RHEL) is > often considered the best definition of what's considered "oldest > supported production environment". RHEL v4 ships with Py2.3 and one > can still obtain extended support f

Re: Trees

2015-01-21 Thread Steven D'Aprano
Rustom Mody wrote: > On Wednesday, January 21, 2015 at 1:27:39 PM UTC+5:30, Stephen Hansen > wrote: [...] > Among my teachers of CS, there were two – both brilliant — one taught me > Numerical Analysis, the other taught me programming. I wonder just how brilliant the Numerical Analysis guy really

Re: Trees

2015-01-21 Thread Rustom Mody
On Wednesday, January 21, 2015 at 6:06:06 PM UTC+5:30, Chris Angelico wrote: > On Wed, Jan 21, 2015 at 11:09 PM, Rustom Mody wrote: > > I would like a set to be {1,2,3} or at worst ⦃1,2,3⦄ > > and a bag to be ⟅1,2,3⟆ > > > > Apart from the unicode niceness that Ive described here > > http://blog.l

Re: python traceroute

2015-01-21 Thread William Ray Wing
> On Jan 21, 2015, at 12:06 AM, Denis McMahon wrote: > > On Tue, 20 Jan 2015 19:37:26 -0800, Chandrakant Tiwari wrote: > >> in the program below i want it to make it work the same way as TRACERT >> command. > > As an observation, you're re-inventing a wheel that already works > perfectly we

Re: Trees

2015-01-21 Thread Ian Kelly
On Wed, Jan 21, 2015 at 7:47 AM, Steven D'Aprano wrote: >> More irksome that for the second we've to preface with >> >> from collections import Counter >> >> And still more a PITA that a straightforward standard name like bag (or >> multiset) is called by such an ungoogleable misleading name as co

What killed Smalltalk could kill Python

2015-01-21 Thread Steven D'Aprano
In 2009, Robert Martin gave a talk at RailsConf titled "What Killed Smalltalk Could Kill Ruby". (No cheering, that sort of attitude is one of the things that killed Smalltalk.) Although Martin discusses Ruby, the lessons could also apply to Python. Video is available here: http://www.youtube.com/

Re: Trees

2015-01-21 Thread Ian Kelly
On Wed, Jan 21, 2015 at 9:15 AM, Ian Kelly wrote: > class MultiSet(MutableSet): In retrospect this probably shouldn't derive from MutableSet, since that carries the expectation that all elements are unique (much like how bool shouldn't be subclassed). For instance, collections.Set includes some o

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Michiel Overtoom
Hi Steven, you wrote: > In 2009, Robert Martin gave a talk at RailsConf titled "What Killed > Smalltalk Could Kill Ruby". I've yet to watch the video, I'll do that later tonight, but I also remember what DHH said about Smalltalk in his FLOSS interview about Rails, with Randal Schwartz, in July

Re: How to "wow" someone new to Python

2015-01-21 Thread Steve Hayes
On Sat, 17 Jan 2015 02:03:57 +1100, Chris Angelico wrote: >Scenario: You're introducing someone to Python for the first time. >S/he may have some previous programming experience, or may be new to >the whole idea of giving a computer instructions. You have a couple of >minutes to show off how awes

Re: How to "wow" someone new to Python

2015-01-21 Thread Irmen de Jong
On 21-1-2015 18:59, Steve Hayes wrote: > 3. When I started to look at it, I found that strings could be any length and > were not limited to swomething arbitrary, like 256 characters. Even more fun is that Python's primitive integer type (longs for older Python versions) has no arbitrary limita

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Tim Chase
On 2015-01-22 03:34, Steven D'Aprano wrote: > In 2009, Robert Martin gave a talk at RailsConf titled "What Killed > Smalltalk Could Kill Ruby". Holy pacing, Batman. Watching it at 2x leaves me wondering how much of the stage was worn off during the presentation. > And now it's all but dead. Why

Re: How to "wow" someone new to Python

2015-01-21 Thread André Roberge
On Friday, 16 January 2015 11:04:20 UTC-4, Chris Angelico wrote: > Scenario: You're introducing someone to Python for the first time. > S/he may have some previous programming experience, or may be new to > the whole idea of giving a computer instructions. You have a couple of > minutes to show of

Re: How to "wow" someone new to Python

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 5:20 AM, Irmen de Jong wrote: > On 21-1-2015 18:59, Steve Hayes wrote: > >> 3. When I started to look at it, I found that strings could be any length and >> were not limited to swomething arbitrary, like 256 characters. > > Even more fun is that Python's primitive integer t

Re: How to "wow" someone new to Python

2015-01-21 Thread Mario Figueiredo
Chris, Scenario: You're introducing someone to Python for the first time. S/he may have some previous programming experience, or may be new to the whole idea of giving a computer instructions. You have a couple of minutes to show off how awesome Python is. What do you do? Some ideas where give

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Grant Edwards
On 2015-01-21, Steven D'Aprano wrote: > In 2009, Robert Martin gave a talk at RailsConf titled "What Killed > Smalltalk Could Kill Ruby". But does he answer the more important question "and can we use it to kill PHP?". -- Grant Edwards grant.b.edwardsYow! What UNIVERSE is

Re: How to "wow" someone new to Python

2015-01-21 Thread André Roberge
On Wednesday, 21 January 2015 15:06:33 UTC-4, Chris Angelico wrote: > On Thu, Jan 22, 2015 at 5:20 AM, Irmen de Jong wrote: > > On 21-1-2015 18:59, Steve Hayes wrote: > > > >> 3. When I started to look at it, I found that strings could be any length > >> and > >> were not limited to swomething a

Re: How to "wow" someone new to Python

2015-01-21 Thread Matthew Ruffalo
On 01/21/2015 02:06 PM, Chris Angelico wrote: > On Thu, Jan 22, 2015 at 5:20 AM, Irmen de Jong wrote: >> On 21-1-2015 18:59, Steve Hayes wrote: >> >>> 3. When I started to look at it, I found that strings could be any length >>> and >>> were not limited to swomething arbitrary, like 256 character

Re: How to "wow" someone new to Python

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 8:20 AM, Matthew Ruffalo wrote: > Yes, length-unlimited strings are *extremely* useful in some > applications. I remember bitterly cursing Java's string length limit of > 2 ** 31 (maybe - 1) on multiple occasions. Python's strings seem to > behave like integers in that thei

Re: How to "wow" someone new to Python

2015-01-21 Thread Alan Bawden
Chris Angelico writes: > ..., and I would guess a 64-bit Java would > also raise the limit. Even in a 64-bit Java, the _type_ returned by String.length() is 'int', and is thus at most (2**31 - 1). This isn't a problem for strings, which never get that long in practice, but for some other Java da

Re: How to "wow" someone new to Python

2015-01-21 Thread Matthew Ruffalo
On 01/21/2015 04:26 PM, Chris Angelico wrote: > On Thu, Jan 22, 2015 at 8:20 AM, Matthew Ruffalo wrote: >> Yes, length-unlimited strings are *extremely* useful in some >> applications. I remember bitterly cursing Java's string length limit of >> 2 ** 31 (maybe - 1) on multiple occasions. Python's

Re: How to "wow" someone new to Python

2015-01-21 Thread Alan Bawden
Alan Bawden writes: > ... Score one for untyped languages. Drat. I should have writted "dynamically typed languages". 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

Re: How to "wow" someone new to Python

2015-01-21 Thread Mario Figueiredo
In article , alan@scooby- doo.csail.mit.edu says... > Even in a 64-bit Java, the _type_ returned by String.length() is > 'int', and is thus at most (2**31 - 1). This isn't a problem for > strings, which never get that long in practice, but for some other > Java datatypes (e.g., Buffer) it is a rea

Re: How to "wow" someone new to Python

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 8:46 AM, Matthew Ruffalo wrote: > No, Java's String.length returns an int and Strings are limited to ~2 ** > 31 characters even in 64-bit Java. Huh, annoying. In Python, the length of a string (in characters) is stored in a Py_ssize_t (if I recall correctly), which is, I b

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: What killed Smalltalk could kill Python

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 6:18 AM, Grant Edwards wrote: > On 2015-01-21, Steven D'Aprano wrote: >> In 2009, Robert Martin gave a talk at RailsConf titled "What Killed >> Smalltalk Could Kill Ruby". > > But does he answer the more important question "and can we use it to > kill PHP?". PHP won't die

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: Trees

2015-01-21 Thread Ian Kelly
On Tue, Jan 20, 2015 at 6:23 PM, Rustom Mody wrote: > The Haskell is bullseye¹ in capturing the essense of a tree because > conceptually a tree of type t is recursive in the sense that it can contain > 2 subtrees -- (B x lst rst) -- or its a base case -- L x. How do you create a tree containing a

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Grant Edwards
On 2015-01-21, Chris Angelico wrote: > On Thu, Jan 22, 2015 at 6:18 AM, Grant Edwards > wrote: >> On 2015-01-21, Steven D'Aprano wrote: >>> In 2009, Robert Martin gave a talk at RailsConf titled "What Killed >>> Smalltalk Could Kill Ruby". >> >> But does he answer the more important question "a

Check for running DHCP daemon?

2015-01-21 Thread Jason Bailey
So I've got this python 3 script that needs to know if there is a running DHCP daemon (ISC DHCP server) on the local system. Is there a clean way to do this that (1) doesn't require me to do syscalls to local utilities (like ps, top, etc), and (2) doesn't require any custom modules (stock only)

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Anthony Papillion
On 01/21/2015 04:35 PM, Chris Angelico wrote: > On Thu, Jan 22, 2015 at 6:18 AM, Grant Edwards > wrote: >> On 2015-01-21, Steven D'Aprano wrote: >>> In 2009, Robert Martin gave a talk at RailsConf titled "What Killed >>> Smalltalk Could Kill Ruby". >> >> But does he answer the more important que

Re: Check for running DHCP daemon?

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 10:06 AM, Jason Bailey wrote: > So I've got this python 3 script that needs to know if there is a running > DHCP daemon (ISC DHCP server) on the local system. Is there a clean way to > do this that (1) doesn't require me to do syscalls to local utilities (like > ps, top, et

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Tim Daneliuk
On 01/21/2015 10:34 AM, Steven D'Aprano wrote: > In 2009, Robert Martin gave a talk at RailsConf titled "What Killed > Smalltalk Could Kill Ruby". (No cheering, that sort of attitude is one of > the things that killed Smalltalk.) Although Martin discusses Ruby, the > lessons could also apply to Pyt

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 10:19 AM, Anthony Papillion wrote: > To be fair, PHP has come a long way in the last few years and, I hear, > there's movements within the community to make it better. Namespaces > were a bit deal as were a few other things. Personally, while I am > LOVING Python, I'd be sa

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: How to "wow" someone new to Python

2015-01-21 Thread Irmen de Jong
On 21-1-2015 20:06, Chris Angelico wrote: > On Thu, Jan 22, 2015 at 5:20 AM, Irmen de Jong wrote: >> On 21-1-2015 18:59, Steve Hayes wrote: >> >>> 3. When I started to look at it, I found that strings could be any length >>> and >>> were not limited to swomething arbitrary, like 256 characters. >

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 10:37 AM, Tim Daneliuk wrote: > I find these kinds of discussions sort of silly. Once there is a critical > mass of installed base, no language EVER dies. Not sure about that. Back in the 1990s, I wrote most of my code in REXX, either command-line or using a GUI toolkit l

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 10:46 AM, Paul Rubin wrote: > Meanwhile, there's this: http://prog21.dadgum.com/203.html > "Retiring Python as a Teaching Language" > > tl;dr: he's switched to recommending Javascript as a first language > instead of Python, since JS makes it easier to write graphics and g

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Michael Torrie
On 01/21/2015 04:37 PM, Tim Daneliuk wrote: > On 01/21/2015 10:34 AM, Steven D'Aprano wrote: >> In 2009, Robert Martin gave a talk at RailsConf titled "What Killed >> Smalltalk Could Kill Ruby". (No cheering, that sort of attitude is one of >> the things that killed Smalltalk.) Although Martin disc

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Mario Figueiredo
In article , ros...@gmail.com says... > > Bad idea. Better to pick a language that makes it easy to get things > right, and then work on the fun side with third-party libraries, than > to tempt people in with "hey look how easy it is to do X" and then > have them stuck with an inferior or flawed

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Mario Figueiredo
In article <873873ae91@jester.gateway.sonic.net>, no.email@nospam.invalid says... > > 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;

Re: What killed Smalltalk could kill Python

2015-01-21 Thread John Ladasky
On Wednesday, January 21, 2015 at 11:18:54 AM UTC-8, Grant Edwards wrote: > On 2015-01-21, Steven D'Aprano wrote: > > In 2009, Robert Martin gave a talk at RailsConf titled "What Killed > > Smalltalk Could Kill Ruby". > > But does he answer the more important question "and can we use it to > kill

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Marko Rauhamaa
Grant Edwards : > [At the time, a couple of us could stumble around with HTML enough to > generate web pages that looked fresh out of 1995, but that was about > it. The web pages in our older devices looked rather "retro" and had > pretty limited functionality.] I miss that plain old look of web

Re: What killed Smalltalk could kill Python

2015-01-21 Thread sohcahtoa82
On Wednesday, January 21, 2015 at 4:10:08 PM UTC-8, Mario Figueiredo wrote: > In article , > ros...@gmail.com says... > > > > Bad idea. Better to pick a language that makes it easy to get things > > right, and then work on the fun side with third-party libraries, than > > to tempt people in with

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 11:09 AM, Mario Figueiredo wrote: > "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? How about "I want to become a programmer

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 Ethan Furman
On 01/21/2015 05:36 PM, Chris Angelico wrote: > On Thu, Jan 22, 2015 at 11:09 AM, Mario Figueiredo wrote: >> "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

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 12:38 PM, Paul Rubin wrote: > 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

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Rick Johnson
On Wednesday, January 21, 2015 at 10:34:40 AM UTC-6, Steven D'Aprano wrote: > In 2009, Robert Martin gave a talk at RailsConf titled > "What Killed Smalltalk Could Kill Ruby". (No cheering, > that sort of attitude is one of the things that killed > Smalltalk.) Although Martin discusses Ruby, the le

Re: Check for running DHCP daemon?

2015-01-21 Thread Dan Stromberg
On Wed, Jan 21, 2015 at 3:06 PM, Jason Bailey wrote: > So I've got this python 3 script that needs to know if there is a running > DHCP daemon (ISC DHCP server) on the local system. Is there a clean way to > do this that (1) doesn't require me to do syscalls to local utilities (like > ps, top, etc

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: What killed Smalltalk could kill Python

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 1:53 PM, Paul Rubin wrote: >> If someone's unfazed by the "it'll take you years before you can >> actually write a saleable game" consideration, > > Wanting to write games is a completely different topic than wanting to > sell them. It's just like any other creative outlet

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 1:59 PM, Dennis Lee Bieber wrote: > To my mind, what killed REXX is that most operating systems just don't > support its key feature well: ADDRESS targets! > > When the only target turns ADDRESS into the equivalent of os.system() > (or some variant of popen(

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Tim Chase
On 2015-01-21 23:10, Grant Edwards wrote: > I happily ignored PHP until a couple years back when we decided to > use PHP for the web site on a small embedded Linux system. [snip] > I briefly considered trying to switch to Python, but the Python > footprint is just too big... Interesting that your

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Steven D'Aprano
Mario Figueiredo wrote: > In article , > ros...@gmail.com says... >> >> Bad idea. Better to pick a language that makes it easy to get things >> right, and then work on the fun side with third-party libraries, than >> to tempt people in with "hey look how easy it is to do X" and then >> have them

Re: Check for running DHCP daemon?

2015-01-21 Thread Jason Bailey
How would I get a list of running processes with the subprocess module? The documentation wasn't clear to me. On Jan 21, 2015 7:21 PM, Dan Stromberg wrote: On Wed, Jan 21, 2015 at 3:06 PM, Jason Bailey wrote: > So I've got this python 3 script that needs to know if there is a running > DHCP dae

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 2:23 PM, Steven D'Aprano wrote: > What we need is more programmers with a passion for their job, and if that > means learning to write games, then so be it. One of the problems with "9 to > 5 code monkeys" is that programming is just a job for them. They do the > absolute m

Python is DOOMED! Again!

2015-01-21 Thread Steven D'Aprano
Occasionally you find people spreading Fear, Uncertainty, Doubt about Python. Python is now over 20 years old and one of the most popular languages in the world no matter how you measure popularity: http://import-that.dreamwidth.org/1388.html so you don't often get FUD these days. When you do,

Re: Check for running DHCP daemon?

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 2:58 PM, Jason Bailey wrote: > How would I get a list of running processes with the subprocess module? The > documentation wasn't clear to me. Using the ps command. :) rosuav@dewey:~$ python3 Python 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1] on linux Type "help",

Re: How to "wow" someone new to Python

2015-01-21 Thread Steven D'Aprano
Mario Figueiredo wrote: > But speaking about impressing more experient programmers, I personally > don't think Python has a wow factor in any of its features and syntax. At > least in the way I understand the word "wow". Quote: I've seen Python criticized as "ugly" precisely because it doesn

Re: Python is DOOMED! Again!

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 3:30 PM, Steven D'Aprano wrote: > C: > > double > median_grouped (IterableOfReal data, double interval) > > > (I may have taken some very slight liberties with the syntax, corrections or > more idiomatic forms are very welcome.) C doesn't really have iterables, so this

Re: How to "wow" someone new to Python

2015-01-21 Thread Steven D'Aprano
Alan Bawden wrote: > Alan Bawden writes: >> ... Score one for untyped languages. > > Drat. I should have writted "dynamically typed languages". > > The language has changed. When I was a novice Lisp hacker, we were > comfortable saying that Lisp was "untyped". But nowadays we always say > t

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Emil Oppeln-Bronikowski
On Thu, Jan 22, 2015 at 10:55:27AM +1100, Chris Angelico wrote: > Where's REXX today? Still (somehow) alive in neo-Amiga platforms like AmigaOS4.x, MorphOS and AROS. I know that's as good as dead but there are still people writing AREXX glue code. -- vag·a·bond adjective \ˈva-gə-ˌbänd\ a : 

Re: Trees

2015-01-21 Thread Rustom Mody
On Thursday, January 22, 2015 at 3:57:50 AM UTC+5:30, Paul Rubin wrote: > 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]) >

Re: Trees

2015-01-21 Thread Rustom Mody
On Thursday, January 22, 2015 at 4:25:03 AM UTC+5:30, Ian wrote: > On Tue, Jan 20, 2015 at 6:23 PM, Rustom Mody wrote: > > The Haskell is bullseye¹ in capturing the essense of a tree because > > conceptually a tree of type t is recursive in the sense that it can contain > > 2 subtrees -- (B x lst r

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: What killed Smalltalk could kill Python

2015-01-21 Thread Terry Reedy
On 1/21/2015 7:16 PM, Mario Figueiredo wrote: In article <873873ae91@jester.gateway.sonic.net>, no.email@nospam.invalid says... 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=YX3iRjK

Re: Python is DOOMED! Again!

2015-01-21 Thread Nicholas Cole
I don't think that Python is doomed. I *do* think that type-hinting is useful, and Python has borrowed a syntax that is similar to that used in other languages, so that it is a familiar one to many developers. It is a stretch to call it intuitive though, either to write or to read. Personally, I w

Re: Python is DOOMED! Again!

2015-01-21 Thread Chris Angelico
On Thu, Jan 22, 2015 at 4:50 PM, Nicholas Cole wrote: > I would have preferred Python to mimic: > > Define function add taking price1, the price2, print_error equals true. > Price1 is a float. Price2 is a float. The function returns a float. > > But now this is sounding a little like something fro

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 Ethan Furman
On 01/21/2015 08:30 PM, Steven D'Aprano wrote: > > So what is this unspeakable, nightmarish, cryptic abomination going to look > like? Here's an example from PEP 484: > > def greeting(name: str) -> str: > return 'Hello ' + name > > > I don't know about you, but I think anyone who cannot re

Re: Python is DOOMED! Again!

2015-01-21 Thread Mark Lawrence
On 22/01/2015 05:35, Paul Rubin wrote: 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. Currently flying here http://code.activestate.com/lists/py

Re: Python is DOOMED! Again!

2015-01-21 Thread Mark Lawrence
On 22/01/2015 05:56, Chris Angelico wrote: On Thu, Jan 22, 2015 at 4:50 PM, Nicholas Cole wrote: I would have preferred Python to mimic: Define function add taking price1, the price2, print_error equals true. Price1 is a float. Price2 is a float. The function returns a float. But now this is

Re: Python is DOOMED! Again!

2015-01-21 Thread Rick Johnson
On Wednesday, January 21, 2015 at 10:31:12 PM UTC-6, Steven D'Aprano wrote: > Occasionally you find people spreading Fear, Uncertainty, Doubt about > Python. Python is now over 20 years old and one of the most popular > languages in the world no matter how you measure popularity: What's next, ar

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Mark Lawrence
On 22/01/2015 02:11, Rick Johnson wrote: On Wednesday, January 21, 2015 at 10:34:40 AM UTC-6, Steven D'Aprano wrote: In 2009, Robert Martin gave a talk at RailsConf titled "What Killed Smalltalk Could Kill Ruby". (No cheering, that sort of attitude is one of the things that killed Smalltalk.) Al

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 Ian Kelly
On Wed, Jan 21, 2015 at 11:56 PM, Ian Kelly wrote: > Since each element is associated with a node, the question could > equally be phrased as "How do you create a tree containing an even > number of elements under this constraint?" Of course I meant to write "nodes" there, not "elements". -- htt

Re: Trees

2015-01-21 Thread Ian Kelly
On Wed, Jan 21, 2015 at 10:20 PM, Rustom Mody wrote: > On Thursday, January 22, 2015 at 4:25:03 AM UTC+5:30, Ian wrote: >> On Tue, Jan 20, 2015 at 6:23 PM, Rustom Mody wrote: >> > The Haskell is bullseye¹ in capturing the essense of a tree because >> > conceptually a tree of type t is recursive in

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-21 Thread Steven D'Aprano
Ethan Furman wrote: > On 01/21/2015 08:30 PM, Steven D'Aprano wrote: >> >> So what is this unspeakable, nightmarish, cryptic abomination going to >> look like? Here's an example from PEP 484: >> >> def greeting(name: str) -> str: >> return 'Hello ' + name >> >> >> I don't know about you, b

Re: Python is DOOMED! Again!

2015-01-21 Thread Nicholas Cole
On Thu, Jan 22, 2015 at 5:56 AM, Chris Angelico wrote: > On Thu, Jan 22, 2015 at 4:50 PM, Nicholas Cole > wrote: >> I would have preferred Python to mimic: >> >> Define function add taking price1, the price2, print_error equals true. >> Price1 is a float. Price2 is a float. The function returns