Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Chris Angelico
On Tue, Apr 1, 2014 at 5:13 PM, Ian Kelly wrote: > Then your computation is incorrect and will systematically > underestimate the stopping distance. Assuming for simplicity that the > acceleration actually increases linearly until it reaches maximum, > picture the velocity graph between, say, t=0

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Ian Kelly
On Tue, Apr 1, 2014 at 12:24 AM, David Hutto wrote: >> >> >> (1) v = u + at >> >> (2) s = 1/2(u + v)t >> >> (3) s = ut + 1/2(at^2) >> >> (4) v^2 = u^2 + 2as >> >> >> >> Only (1) and (3) are needed. >> > >> > Okay, what's u here? Heh. >> >> u is the initial velocity; v is the velocity after acceler

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Ian Kelly
On Mon, Mar 31, 2014 at 11:45 PM, Rustom Mody wrote: > On Tue, Apr 1, 2014 at 3:26 PM, Steven D'Aprano wrote: > >> Haskell has nifty pattern-matching syntax for this that looks quite close >> to the mathematical hybrid function syntax, but in Python, we're limited >> to explicitly using an if. If

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread David Hutto
> > > >> (1) v = u + at > >> (2) s = 1/2(u + v)t > >> (3) s = ut + 1/2(at^2) > >> (4) v^2 = u^2 + 2as > >> > >> Only (1) and (3) are needed. > > > > Okay, what's u here? Heh. > > u is the initial velocity; v is the velocity after accelerating at a for > time t. > This assumes that the viscosity is

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Ian Kelly
On Mon, Mar 31, 2014 at 11:01 PM, Chris Angelico wrote: > On Tue, Apr 1, 2014 at 3:26 PM, Steven D'Aprano wrote: >> The scenario you describe has (effectively) infinite rate-of-change-of- >> acceleration, often called "jerk". (A jerk is a rapid change in >> acceleration.) Human comfort is (within

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread David Hutto
On Tue, Apr 1, 2014 at 1:45 AM, Rustom Mody wrote: > On Tue, Apr 1, 2014 at 3:26 PM, Steven D'Aprano wrote: > > > Haskell has nifty pattern-matching syntax for this that looks quite close > > to the mathematical hybrid function syntax, but in Python, we're limited > > to explicitly using an if.

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Rustom Mody
On Tue, Apr 1, 2014 at 3:26 PM, Steven D'Aprano wrote: > Haskell has nifty pattern-matching syntax for this that looks quite close > to the mathematical hybrid function syntax, but in Python, we're limited > to explicitly using an if. If I were coding this, and I'm not, I'd wrap > it in a functio

Re: Python IM server

2014-03-31 Thread David Hutto
hint: Tkinter server db update the tkinter apps, with the new data, after moving a line down On Tue, Apr 1, 2014 at 1:06 AM, Miki Tebeka wrote: > > I want to develop a instant message server, simply has user and group > entity. > > Is there any better existing open-source one? > > Thus I can

Re: Examples of modern GUI python programms

2014-03-31 Thread CM
On Sunday, March 30, 2014 7:16:07 PM UTC-4, D. Xenakis wrote: > Id like to ask.. do you know any modern looking GUI examples of windows > software written in python? Something like this maybe: > http://techreport.com/r.x/asus-x79deluxe/software-oc.jpg (or hopefully > something like this android

Re: Python IM server

2014-03-31 Thread Miki Tebeka
> I want to develop a instant message server, simply has user and group > entity. > Is there any better existing open-source one? > Thus I can download and have a look. You can take a look at Twisted Words (https://twistedmatrix.com/trac/wiki/TwistedWords). -- https://mail.python.org/mailman/l

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Chris Angelico
On Tue, Apr 1, 2014 at 3:26 PM, Steven D'Aprano wrote: > On Tue, 01 Apr 2014 01:33:09 +1100, Chris Angelico wrote: > >> Call this a code review request, if you like. I'm wondering how you'd go >> about coding something like this. > > I wouldn't. I'd start off by analysing the problem, and putting

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Steven D'Aprano
On Tue, 01 Apr 2014 01:33:09 +1100, Chris Angelico wrote: > Call this a code review request, if you like. I'm wondering how you'd go > about coding something like this. I wouldn't. I'd start off by analysing the problem, and putting it into the simplest format possible, and *then* start writing

Re: Examples of modern GUI python programms

2014-03-31 Thread David Hutto
Caveat emptor(I have a copy of Latin For Idiots). When you get through with refining, in whatever language, the open source/proprietary app you're developing, is there anyway you can say for sure how many people's work went into things under different licenses accompanying what you may have copy a

Re: unicode as valid naming symbols

2014-03-31 Thread David Hutto
This brings us into a juxtaposition between how cultures have tried to hybridize their mentalities, into more of an empathic means of communication via a formulatic set of coding, and the philosophy thereof, and, 3D renderings of what we visualize, and how we come to the conclusions of these philos

Re: unicode as valid naming symbols

2014-03-31 Thread David Hutto
I personally believe that it becomes hard to have even a programming language overcome cultural learning styles, and programmatic differences, because of nurture vs nature. We can all program something which results in a similar return value, but overcoming the nurturing the internet provides, bec

Re: Examples of modern GUI python programms

2014-03-31 Thread Metallicow
On Monday, March 31, 2014 3:16:16 PM UTC-5, Sturla Molden wrote: > > According to their web page, PySide is only LGPL. Qt is LGPL or commercial. """ Licensing PySide has been published as a response to the lack of suitably licensed Qt bindings for Python. PySide is licensed under the LGPL vers

Re: Python IM server

2014-03-31 Thread Wesley
在 2014年3月31日星期一UTC+8下午8时37分32秒,Lutz Horn写道: > Hi, > > > > > I want to develop a instant message server, simply has user and > > > group entity. > > > > > > Is there any better existing open-source one? > > > > Take a look at XMPP[0]. There are some Python libraries[1]. > > > > [0] h

Re: Line of best fit

2014-03-31 Thread Steven D'Aprano
On Mon, 31 Mar 2014 04:29:15 -0700, Jamie Mitchell wrote: > I am new to python so apologies for the ignorance with this question. > > How would I apply a line of best fit to a plot? That depends on what software you are using to generate the plot. I see you have this line of code: > plt.plot(h

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Steven D'Aprano
On Tue, 01 Apr 2014 10:12:38 +1100, Chris Angelico wrote: [...] >> I agree with others that triple-quoted strings are best reserved for >> string literals (including docstrings), not comments. > > Fair enough. I can't remember where (or when!) it was that I learned > triple-quoted strings were app

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Ethan Furman
On 03/31/2014 04:12 PM, Chris Angelico wrote: On Tue, Apr 1, 2014 at 9:57 AM, Ben Finney wrote: Chris Angelico writes: How do you go about doing multi-line comments? I know I've seen other code using triple-quoted strings for long comments before. Just use a sequence of one-line comments::

Re: unicode as valid naming symbols

2014-03-31 Thread Ian Kelly
On Mon, Mar 31, 2014 at 1:31 PM, Antoon Pardon wrote: > Op 31-03-14 19:40, Ian Kelly schreef: >> That was an exaggeration on my part. It wouldn't affect my job, as I >> wouldn't expect to ever actually have to maintain anything like the >> above. My greater point though is that it damages Python

Re: Line of best fit

2014-03-31 Thread Sturla Molden
Roy Smith wrote: > Please tell us more about the environment you're working in. I'm > guessing from the fact that you're calling plt.plot(), that you've > already got some add-on modules loaded. Pandas, maybe? Probably matplotlib.pyplot -- https://mail.python.org/mailman/listinfo/python-li

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Chris Angelico
On Tue, Apr 1, 2014 at 9:57 AM, Ben Finney wrote: > Chris Angelico writes: > >> How do you go about doing multi-line comments? I know I've seen other >> code using triple-quoted strings for long comments before. > > Just use a sequence of one-line comments:: > > # Lorem ipsum dolor sit amet,

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Ben Finney
Chris Angelico writes: > How do you go about doing multi-line comments? I know I've seen other > code using triple-quoted strings for long comments before. Just use a sequence of one-line comments:: # Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a # sapien tempor, suscipi

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Chris Angelico
On Tue, Apr 1, 2014 at 8:42 AM, Ned Batchelder wrote: > On 3/31/14 12:03 PM, Chris Angelico wrote: >> >> Incidentally, if you want to see the code in context, it's here: >> >> https://github.com/Rosuav/runningtime/blob/master/runningtime.py >> >> ChrisA > > > I know you didn't ask about these aspe

Re: OFF TOPIC Spanish in the USA [was Re: Explanation of this Python language feature?]

2014-03-31 Thread Terry Reedy
On 3/31/2014 4:47 PM, Rhodri James wrote: On Mon, 31 Mar 2014 06:23:46 +0100, Mark H Harris wrote: The main point of the link is the status on English as an official language. 28 out of 50 states have legislated English as the official language; meaning, that you either speak and write Englis

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Ned Batchelder
On 3/31/14 12:03 PM, Chris Angelico wrote: Incidentally, if you want to see the code in context, it's here: https://github.com/Rosuav/runningtime/blob/master/runningtime.py ChrisA I know you didn't ask about these aspects, but they jumped out at me: tabs for indentation instead of spaces, an

Re: OFF TOPIC Spanish in the USA [was Re: Explanation of this Python language feature?]

2014-03-31 Thread Rhodri James
On Mon, 31 Mar 2014 06:23:46 +0100, Mark H Harris wrote: The main point of the link is the status on English as an official language. 28 out of 50 states have legislated English as the official language; meaning, that you either speak and write English, or you're going to have a really

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-31 Thread Rhodri James
On Mon, 31 Mar 2014 07:08:24 +0100, Mark H Harris wrote: On 3/30/14 10:22 AM, Steven D'Aprano wrote: In 1991, there was no wireless, no mobile computing, hardly any public Internet outside of the universities. It was before the Eternal September, and only a few years after the Great Renaming

Re: unicode as valid naming symbols

2014-03-31 Thread Marko Rauhamaa
Terry Reedy : > @twist_the_function_meaning > def f: return clear_expression > > is no worse in this regard than the written out form > > def f: return clear_expression > f = twist_the_function_meaning(f) I don't remember feeling the need for either. I have written wrappers of all sorts, but som

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Rhodri James
On Mon, 31 Mar 2014 17:29:54 +0100, Chris Angelico wrote: On Tue, Apr 1, 2014 at 3:20 AM, Rustom Mody wrote: On the whole I prefer multiple assignments. Maybe in this case use small variable names with separate(d) explanatory comments?? Shorter variable names would certainly be the more

Re: unicode as valid naming symbols

2014-03-31 Thread Terry Reedy
On 3/31/2014 3:31 PM, Antoon Pardon wrote: Op 31-03-14 19:40, Ian Kelly schreef: First, because while those may degrade readability, they do so in a constrained way. A decorator application is just the @ symbol and an identifier. And if abused, can totally change the working of your functio

Re: Examples of modern GUI python programms

2014-03-31 Thread Sturla Molden
Metallicow wrote: > One would have to tool through the PySide agreement for their specifics, > but as I recall it is exactly the same as Qt is, which makes sense. According to their web page, PySide is only LGPL. Qt is LGPL or commercial. > Just because a library is LGPL doesn't mean the auth

Re: unicode as valid naming symbols

2014-03-31 Thread Terry Reedy
On 3/31/2014 1:40 PM, Ian Kelly wrote: Second, at least in the case of decorators, while I don't dispute that they can harm readability, I think that in the majority of cases they actually help it. That's because the @ syntax placed before a function or class clearly denotes that the construct

Re: unicode as valid naming symbols

2014-03-31 Thread Antoon Pardon
Op 31-03-14 19:40, Ian Kelly schreef: > On Mon, Mar 31, 2014 at 3:55 AM, Antoon Pardon > wrote: >> On 27-03-14 17:22, Ian Kelly wrote: >>> On Thu, Mar 27, 2014 at 9:28 AM, Mark H Harris >>> wrote: > Do you think that the ability to write this would be an improvement? > > import ⌺ >>>

Re: checking if two things do not equal None

2014-03-31 Thread Moritz Emanuel Beber
On 31/03/14 19:28, Abe wrote: I couldn't see anyone else give this, but I like if None not in (a, b): I did. I am now considering: if None not in (a,b): or if (a is not None) and (b is not None): That's just if not (a is None or b is None): but you seem to have found your way. However, I

Re: unicode as valid naming symbols

2014-03-31 Thread Ian Kelly
On Mon, Mar 31, 2014 at 12:02 PM, Tim Chase wrote: > On 2014-03-31 11:40, Ian Kelly wrote: >> There is nothing useful >> you can do with a name that is the U+1F4A9 character that you can't >> do just as easily with alphanumeric identifiers like pile_of_poo (or >> куча_фекалий if one prefers; that'

Re: unicode as valid naming symbols

2014-03-31 Thread Tim Chase
On 2014-03-31 11:40, Ian Kelly wrote: > There is nothing useful > you can do with a name that is the U+1F4A9 character that you can't > do just as easily with alphanumeric identifiers like pile_of_poo (or > куча_фекалий if one prefers; that's auto-translated, so don't blame > me if it's a poor tran

Re: unicode as valid naming symbols

2014-03-31 Thread Ian Kelly
On Mon, Mar 31, 2014 at 3:55 AM, Antoon Pardon wrote: > On 27-03-14 17:22, Ian Kelly wrote: >> On Thu, Mar 27, 2014 at 9:28 AM, Mark H Harris wrote: Do you think that the ability to write this would be an improvement? import ⌺ ⌚ = ⌺.╩░ ⑥ = 5*⌺.⋨⋩ ❹ = ⑥ - 1 ♅⚕⚛ =

Re: checking if two things do not equal None

2014-03-31 Thread Abe
> I couldn't see anyone else give this, but I like > if None not in (a, b): I did. > I am now considering: > if None not in (a,b): > or > if (a is not None) and (b is not None): However, I decided to just turn the two parameters into one (sequence), since they were logically grouped anyhow.

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Chris Angelico
On Tue, Apr 1, 2014 at 3:20 AM, Rustom Mody wrote: > On the whole I prefer multiple assignments. > Maybe in this case use small variable names with > separate(d) explanatory comments?? Shorter variable names would certainly be the more normal, heh. I let my brother do that part of the typing, pic

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Rustom Mody
On Monday, March 31, 2014 9:33:54 PM UTC+5:30, Chris Angelico wrote: > On Tue, Apr 1, 2014 at 2:40 AM, Marko Rauhamaa wrote: > > As a simple layout question, I'd do it like this: > > > > if mode == "Brake2": > > # Already

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Chris Angelico
On Tue, Apr 1, 2014 at 2:40 AM, Marko Rauhamaa wrote: > As a simple layout question, I'd do it like this: > > > if mode == "Brake2": > # Already got the brakes fully on > distance_to_full_braking_power = 0.0 > spe

Re: Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Marko Rauhamaa
Chris Angelico : > Call this a code review request, if you like. I'm wondering how you'd > go about coding something like this. As a simple layout question, I'd do it like this: if mode == "Brake2": # Already got the br

Code style query: multiple assignments in if/elif tree

2014-03-31 Thread Chris Angelico
Call this a code review request, if you like. I'm wondering how you'd go about coding something like this. Imagine you're in a train, and the brakes don't apply instantly. The definition, in the interests of passenger comfort, is that the first second of brake application has an acceleration of 0.

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-31 Thread Grant Edwards
On 2014-03-30, Rhodri James wrote: > On Sun, 30 Mar 2014 11:44:13 +0100, Steven D'Aprano > >> Among fans of the British writer Terry Pratchett, the usual term is >> Merkins. Including among Merkin fans. > > Many of whom even know what a merkin is, and use the term anyway. As much as I'd rather

Re: Python IM server

2014-03-31 Thread Lutz Horn
Hi, I want to develop a instant message server, simply has user and group entity. Is there any better existing open-source one? Take a look at XMPP[0]. There are some Python libraries[1]. [0] https://en.wikipedia.org/wiki/XMPP [1] http://xmpp.org/xmpp-software/libraries/ -- Opt out of gl

Re: Line of best fit

2014-03-31 Thread Moritz Beber
None of these are in the standard library but why re-invent the wheel? Using numpy: http://docs.scipy.org/doc/numpy/reference/generated/numpy.polyfit.html scipy: http://docs.scipy.org/doc/scipy-0.13.0/reference/generated/scipy.stats.linregress.html statsmodels: http://statsmodels.sourceforge.net

Re: Examples of modern GUI python programms

2014-03-31 Thread Jonathan Harden
On 31 Mar 2014 00:21, "D. Xenakis" wrote: > ... Snip ... > What i need is to develop an android looking program (entirelly in python) for windows, but dunno if this is possible (most propably is), and which tool between those would help me most: tkinter - wxpython - pyqt - pygtk . > > Any exampl

Re: OFF TOPIC Spanish in the USA [was Re: Explanation of this Python language feature?]

2014-03-31 Thread Chris Angelico
On Mon, Mar 31, 2014 at 11:41 PM, Dennis Lee Bieber wrote: > On Mon, 31 Mar 2014 16:44:56 +1100, Chris Angelico > declaimed the following: > >>official language, and pick up any government form - something fairly >>important, like applying for a passport or something. How many > > Passpor

Re: Line of best fit

2014-03-31 Thread Roy Smith
In article <0fb15100-15e8-46d6-a38f-b187c7012...@googlegroups.com>, Jamie Mitchell wrote: > I am new to python so apologies for the ignorance with this question. > > How would I apply a line of best fit to a plot? Python has nothing built-in which does that, but there are plenty of add-on mod

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-31 Thread Roy Smith
In article , Mark H Harris wrote: > On 3/30/14 10:22 AM, Steven D'Aprano wrote: > > In 1991, there was no wireless, no mobile computing, hardly any public > > Internet outside of the universities. It was before the Eternal > > September, and only a few years after the Great Renaming. > > I

Re: OFF TOPIC Spanish in the USA

2014-03-31 Thread Ned Batchelder
On 3/31/14 4:39 AM, Marko Rauhamaa wrote: Mark H Harris : The main point of the link is the status on English as an official language. 28 out of 50 states have legislated English as the official language; meaning, that you either speak and write English, or you're going to have a really tough t

Line of best fit

2014-03-31 Thread Jamie Mitchell
I am new to python so apologies for the ignorance with this question. How would I apply a line of best fit to a plot? My data are netCDF4 data files and this is essentially what I have done so far: swh1=netCDF4.Dataset('filename','r') hs1=swh1.variables['hs'] swh2=netCDF4.Dataset('filename'.'r'

Python IM server

2014-03-31 Thread Wesley
Hi all, I want to develop a instant message server, simply has user and group entity. Is there any better existing open-source one? Thus I can download and have a look. Thanks. Wesley -- https://mail.python.org/mailman/listinfo/python-list

Re: unicode as valid naming symbols

2014-03-31 Thread Antoon Pardon
On 27-03-14 17:22, Ian Kelly wrote: > On Thu, Mar 27, 2014 at 9:28 AM, Mark H Harris wrote: >>> Do you think that the ability to write this would be an improvement? >>> >>> import ⌺ >>> ⌚ = ⌺.╩░ >>> ⑥ = 5*⌺.⋨⋩ >>> ❹ = ⑥ - 1 >>> ♅⚕⚛ = [⌺.✱✳**⌺.❇*❹{⠪|⌚.∣} for ⠪ in ⌺.⣚] >>> ⌺.˘˜¨´՛՜(♅⚕⚛) >> >>Ste

Re: Examples of modern GUI python programms

2014-03-31 Thread Metallicow
On Monday, March 31, 2014 3:48:33 AM UTC-5, Sturla Molden wrote: > If you are to distribute a program using LGPL software on AppStore or > Gopgle Play, then remember that the user must be allowed to relink the > program with anpther version of the library. That is an LGPL requirement. I > don't see

Re: Examples of modern GUI python programms

2014-03-31 Thread Sturla Molden
Metallicow wrote: > My opinion would be wxPython if not actually using for a mobile, or > PySide if you are. Both of these have acceptable licenses if you want to > go commercial also without having to pay for commercial library usage. If you are to distribute a program using LGPL software on A

Re: OFF TOPIC Spanish in the USA

2014-03-31 Thread Marko Rauhamaa
Mark H Harris : > The main point of the link is the status on English as an official > language. 28 out of 50 states have legislated English as the official > language; meaning, that you either speak and write English, or you're > going to have a really tough time participating in culture, busines

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-31 Thread wxjmfauth
Unicode... Interesting reading. jmf -- https://mail.python.org/mailman/listinfo/python-list

Re: OFF TOPIC Spanish in the USA [was Re: Explanation of this Python language feature?]

2014-03-31 Thread Mark Lawrence
On 31/03/2014 05:57, Mark H Harris wrote: On 3/30/14 5:35 AM, Steven D'Aprano wrote: Approximately 5% of the US population either do not speak English at all, or speak it poorly. That includes approximately half a million ASL speakers (American Sign Language, which is not a manual representatio

Re: checking if two things do not equal None

2014-03-31 Thread Jeremy Sanders
contact.tri...@gmail.com wrote: > if (a, b) != (None, None): > or > if a != None != b: > > Preference? Pros? Cons? Alternatives? I couldn't see anyone else give this, but I like if None not in (a, b): pass Jeremy -- https://mail.python.org/mailman/listinfo/python-list

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-31 Thread Rustom Mody
On Monday, March 31, 2014 12:23:55 PM UTC+5:30, Ben Finney wrote: > Mark, you are demonstrating a habit of making sweeping pronouncements > and assertions; and then, when those statements are challenged, you > act as though you never said them. > Here's a characteristic example: > Mark H Harris w