Re: Python packages for hydrology and DEM

2016-04-19 Thread Ben Finney
Xristos Xristoou  writes:

> I want to ask for hydrology python packages with complete function to
> calculate hydrology tasks like fill,flow direction,flow accumulator
> and more?or how can i find genetic algorithms for to do this tasks to
> finaly create a complete hydro model with python.

I know nothing useful about that problem domain. What I can say is that
the first place to look for Python packages is the Python Package Index.

What is your assessment of the search results for searching “hydrology”
or “genetic algorithm” at the Python Package Index?
https://pypi.python.org/pypi?%3Aaction=search&term=hydrology&submit=search>
https://pypi.python.org/pypi?%3Aaction=search&term=genetic+algorithm&submit=search>

-- 
 \  “It is clear that thought is not free if the profession of |
  `\   certain opinions makes it impossible to earn a living.” |
_o__)  —Bertrand Russell, _Free Thought and Official Propaganda_, 1928 |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Pete Forman
Rustom Mody  writes:

> On Tuesday, April 19, 2016 at 6:49:34 AM UTC+5:30, sohcatoa wrote:
>> On Monday, April 18, 2016 at 2:14:17 PM UTC-7, Pete Forman wrote:
>> > Why is it that Python continues to use a fixed width font and therefore
>> > specifies the maximum line width as a character count?
>> >
>> > An essential part of the language is indentation which ought to continue
>> > to mandate that lines start with a multiple of 4 em worth of space (or
>> > some other size or encode with hard tabs, that is not germane to my
>> > question). The content of the line need not be bound by the rules needed
>> > to position its start.
>> >
>> > --
>> > Pete Forman
>>
>> "Why is it that Python continues to use a fixed width font "
>>
>> This guy is trolling, right?

No, it is a genuine question. It applies to computer langauges in
general but this thread is about PEP 8 so I framed it for Python.
I was not proposing a change to the langauge.


> See elastic tabstops: http://nickgravgaard.com/elastic-tabstops/

I like that Nick separates out the concept of alignment with implicit
semantics from the n spaces v tabs arguments. My question asks why
monospace is used for the text.

> And more generally that programmers sticking to text when rest of
> world has moved on is rather backward:
> http://blog.languager.org/2012/10/html-is-why-mess-in-programming-syntax.html

-- 
Pete Forman
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How much sanity checking is required for function inputs?

2016-04-19 Thread Michael Selik
On Mon, Apr 18, 2016 at 1:05 AM Christopher Reimer <
christopher_rei...@icloud.com> wrote:

> On 4/17/2016 3:18 PM, Michael Selik wrote:
>
> > I'd rather turn the question around: how much sanity checking is
> > necessary or useful? You'll find the answer is "surprisingly little"
> > compared to your experience in Java.
>
> I'm looking for a pythonic approach to sanity checking. From what I read
> elsewhere, sanity checking belongs in the unit tests and/or library
> classes designed for other people to use. I haven't seen many examples
> of sanity checks that is common in Java.
>
> > For example, you don't need to
> > explicitly check whether the color is present in your dictionary,
> > because it'll give you a KeyError if you look up a bad key.
>
> Without the sanity check against the constant dictionary, the color
> variable could be anything (it should be a string value). Looking at the
> code again, I should relocate the sanity checks in the Piece base class.
>

Why relocate rather than remove? What message would you provide that's
better than ``KeyError: 42`` with a traceback that shows exactly which
dictionary is being used and how?

> Why does the len of positions need to be 16?
>
> The positions variable is list of coordinates for 16 chess pieces (eight
> pawns, two rooks, two knights, two bishops, a king and a queen) for each
> color, locating the pieces on either the bottom quarter (i.e., [(1,1),
> ..., (2,8)]) or the top quarter (i.e., [(7,1), ..., (8,8)]) of the board.
>

I meant, what goes wrong if the number of positions input is other than 16?
Without these "sanity" checks, your functions might be reusable in, say, a
checkers game.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Ben Finney
Pete Forman  writes:

> My question asks why monospace is used for the text.

Used by whom? Python the programming language (and that includes PEP 8)
has nothing to say about what font you use in your text editor.

-- 
 \  “Why should I care about posterity? What's posterity ever done |
  `\for me?” —Groucho Marx |
_o__)  |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Marko Rauhamaa
Pete Forman :

> I like that Nick separates out the concept of alignment with implicit
> semantics from the n spaces v tabs arguments. My question asks why
> monospace is used for the text.

Because the so-called "plain text" is the age-old lowest common
denominator for formal syntax. Python is especially picky about
alignment, but the same de-facto assumption is critical pretty much in
any programming language from Pascal to Go.

Old computer science textbooks presenting algorithms in Algol, Pascal
or, say, process algebra, did use varying-width fonts but they were
typeset manually.

You *could* liberate programming languages from the monospace
stranglehold but then you couldn't effectively use "cat", "vi" or
"firefox" to display Python programs. You probably would need to wrap
the source code in some richer markup like XML and support it specially
in the editors.

Such enrichment would offer advantages. For example, the visual layout
wouldn't necessarily have to be rigid. No more line-length wars (no
lines would ever need to be "continued"). No more TAB wars. Comments
could be displayed as floating bubbles, or maybe you would have to
scratch the screen to see the comment text.

Why, you could even decide on local language variations. How about
braces to delineate blocks in Python? How about translating the keywords
into Japanese? How about setting the Python code right-to-left with
Hebrew keywords?

Now, descending back on earth, I don't believe the advantages of rich
source code will outweigh those of plain text in the foreseeable future.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why are my files in in my list - os module used with sys argv

2016-04-19 Thread Peter Otten
Steven D'Aprano wrote:

> On Tue, 19 Apr 2016 09:44 am, Sayth Renshaw wrote:
> 
>> Hi
>> 
>> Why would it be that my files are not being found in this script?
> 
> You are calling the script with:
> 
> python jqxml.py samples *.xml
> 
> This does not do what you think it does: under Linux shells, the glob
> *.xml will be expanded by the shell. Fortunately, in your case, you have
> no files in the current directory matching the glob *.xml, so it is not
> expanded and the arguments your script receives are:
> 
> 
> "python jqxml.py"  # not used
> 
> "samples"  # dir
> 
> "*.xml"  # mask
> 
> 
> You then call:
> 
> fileResult = filter(lambda x: x.endswith(mask), files)
> 
> which looks for file names which end with a literal string (asterisk, dot,
> x, m, l) in that order. You have no files that match that string.
> 
> At the shell prompt, enter this:
> 
> touch samples/junk\*.xml
> 
> and run the script again, and you should see that it now matches one file.
> 
> Instead, what you should do is:
> 
> 
> (1) Use the glob module:
> 
> https://docs.python.org/2/library/glob.html
> https://docs.python.org/3/library/glob.html
> 
> https://pymotw.com/2/glob/
> https://pymotw.com/3/glob/
> 
> 
> (2) When calling the script, avoid the shell expanding wildcards by
> escaping them or quoting them:
> 
> python jqxml.py samples "*.xml"

(3) *Use* the expansion mechanism provided by the shell instead of fighting 
it:

$ python jqxml.py samples/*.xml

This requires that you change your script

from pyquery import PyQuery as pq
import pandas as pd
import sys

fileResult = sys.argv[1:]

if not fileResult:
 print("no files specified")
 sys.exit(1)

for file in fileResult:
print(file)

for items in fileResult:
try:
d = pq(filename=items)
except FileNotFoundError as e:
print(e)
continue
res = d('nomination')
# you could move the attrs definition before the loop
attrs = ('id', 'horse')
# probably a bug: you are overwriting data on every iteration
data = [[res.eq(i).attr(x) for x in attrs] for i in range(len(res))]

I think this is the most natural approach if you are willing to accept the 
quirk that the script tries to process the file 'samples/*.xml' if the 
samples directory doesn't contain any files with the .xml suffix. Common 
shell tools work that way:

$ ls samples/*.xml
samples/1.xml  samples/2.xml  samples/3.xml
$ ls samples/*.XML
ls: cannot access samples/*.XML: No such file or directory

Unrelated: instead of working with sys.argv directly you could use argparse 
which is part of the standard library. The code to get at least one file is

import argparse

parser = argparse.ArgumentParser()
parser.add_argument("files", nargs="+")
args = parser.parse_args()

print(args.files)

Note that this doesn't fix the shell expansion oddity.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Chris Angelico
On Tue, Apr 19, 2016 at 6:09 PM, Marko Rauhamaa  wrote:
> Now, descending back on earth, I don't believe the advantages of rich
> source code will outweigh those of plain text in the foreseeable future.

No, they will not, because they'll make your code proprietary.
Suddenly *nothing* else will viably work with your code. (And before
you say "but diff tools are fine with XML/JSON/YAML/whatever", it's
not that simple; as soon as the underlying structure is capable of
representing information that doesn't matter to your source code, you
open yourself up to diff noise. I've had this exact problem with
git-managing my OBS configs, which are JSON files; there's one
particular array that's effectively a set, and the file keeps
reordering itself. I had to write a pre-commit script that sorts them
into a consistent order, else I'd have had useless diffs.)

Of course, there's no such thing as "plain text". Encodings will
always bite you. But if you can depend on all files being (a) binary,
(b) UTF-8, or (c) tagged with a coding cookie, it's not too hard to
work with other people's files.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


building python for qnx 6.5

2016-04-19 Thread rasikasriniva...@gmail.com
friends

I am interested in python3 for QNX 6.5. Since i have not found a prebuilt 
distribution, I would like to build it. I wanted to find out how I could use 
Momentics IDE to build python for different targets. I want to build only for 
x86 right now but may want to build for the ARM target as well. The IDE is 
hosted on a windows platform. Momentics is based on eclipse I believe.

any pointers would be deeply appreciated.

thanks, srini

-- 
https://mail.python.org/mailman/listinfo/python-list


Django - tastypie - jqgrid Wrapper (installation - manual)

2016-04-19 Thread asimkon .
I would like to use the following wrapper
 in one of my Django
models, but unfortunately i do not know how to do it due to the lack of
sufficient information. I run on my machine Djnago 1.9, tastypi via
easy_install, Apache via mod_wsgi and MySQL.
After installing all these i do not know how to proceed step 1, step 2 etc
in order to use the demo code mentioned in the above page and finally work
successfully. Further details about the type of fields and how could be
used in grids.py (additional information) would help me a lot. I found the
author's github page  but unfortunately there
is contact information to get in touch with him.

If anyone knows so much about it, i would be delighted!

Regards
Kostas Asimakopoulos
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python packages for hydrology and DEM

2016-04-19 Thread Xristos Xristoou
Τη Τρίτη, 19 Απριλίου 2016 - 9:19:33 π.μ. UTC+3, ο χρήστης Xristos Xristoou 
έγραψε:
> I want to ask for hydrology python packages with complete function to 
> calculate hydrology tasks like fill,flow direction,flow accumulator and 
> more?or how can i find genetic algorithms for to do this tasks to finaly 
> create a complete hydro model with python.
> 
> can someone tell me some documentation to do that with python ? i want to 
> find like this TopoToolbox from matlab in python using
> 
> also i want to ask and for python psckage for digital elevation models 
> calcultor like idw krigging spline and more...or some documentation for this
> or some genetic algorithm for this
> 
> ty.

all this packages is old and without or low support-documentecion
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: ReST: link bookmark

2016-04-19 Thread Sergio Spina
Il giorno domenica 17 aprile 2016 12:14:57 UTC+2, Sergio Spina ha scritto:
> Il giorno domenica 17 aprile 2016 12:04:38 UTC+2, Sergio Spina ha scritto:
> > I would know what is the way to implement in ReST a link bookmark like in 
> > this example:
> > 
> > > 
> > > 
> > >
> > > This text stand for an example of text containing
> > > a bookmarked target bookmark.
> > >
> > > So let's go all together to visit the bookmarked target
> > > clicking on this link.
> > >
> > > 
> > > 
> > 
> > The string that is the name of the anchor is produced by an algorithm and 
> > 1) cannot be left away and 2) cannot be seen in the printed document.
> > 
> > Thanks.
> 
> The correct example is:
> 
> > 
> > 
> >
> > This text stand for an example of text containig
> > a target bookmark.
> >
> > So let's go all together to visit the target clicking
> > on this link.
> >
> > 
> > 
> 
> Sorry for the mispelling.

I've tried some experiments looking for a hint:

# file: test.htm




This text stand for an example of text containing
a bookmarked target bookmark.

So let's go all together to visit the bookmarked target
clicking on this link.




First try:

# test.htm converted at http://www.siafoo.net/html.xml

This text stand for an example of text containig a `target <>`_ bookmark.

So let's go all together to visit the target clicking on `this
link <#B3Pa9-5ZRIx-1>`_ .

that is not what I'm looking for;

# pandoc -f html test.htm -s -o test.rst

This text stand for an example of text containig a target bookmark.

So let's go all together to visit the target clicking on `this
link <#B3Pa9-5ZRIx-1>`__.

that is not what I'm looking for;

# html2rst.py taken from 
http://docutils.sourceforge.net/sandbox/cliechti/html2rst/html2rst.py
# python html2rst.py test.htm > test.rst

This text stand for an example of text containig a target bookmark.

So let's go all together to visit the target clicking on `this
link`_.

.. _this link: #B3Pa9-5ZRIx-1

Not a good try.

Is there a better way ?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Jon Ribbens
On 2016-04-17, Tim Golden  wrote:
> On 17/04/2016 18:21, Wildman via Python-list wrote:
>> On Sun, 17 Apr 2016 17:57:51 +0100, Tim Golden wrote:
>
> [... snip my explanation of new moderation for non-subscribers ...]
>
>> How will this change affect posts to comp.lang.python?
>
> Not at all, in the sense that the moderation doesn't apply to 
> comp.lang.python, except insofar as posts which are sent to the list and 
> which we reject obviously won't make it to comp.lang.python either.

But from what you described, it sounds like all Usenet posts will
now be prevented from reaching the list. If so you should probably
consider rmgrouping comp.lang.python or at least abandoning the
idea of it being linked to the mailing list.

(I've no idea of course if you will even see this message!)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Tim Golden

On 19/04/2016 10:03, Jon Ribbens wrote:

On 2016-04-17, Tim Golden  wrote:

On 17/04/2016 18:21, Wildman via Python-list wrote:

On Sun, 17 Apr 2016 17:57:51 +0100, Tim Golden wrote:


[... snip my explanation of new moderation for non-subscribers ...]


How will this change affect posts to comp.lang.python?


Not at all, in the sense that the moderation doesn't apply to
comp.lang.python, except insofar as posts which are sent to the list and
which we reject obviously won't make it to comp.lang.python either.


But from what you described, it sounds like all Usenet posts will
now be prevented from reaching the list. If so you should probably
consider rmgrouping comp.lang.python or at least abandoning the
idea of it being linked to the mailing list.

(I've no idea of course if you will even see this message!)



Well something in my explanation obviously wasn't clear, because that's 
certainly not the case. I'm not even sure which bit gave you that 
impression (please feel free to quote it back at me!).


The Usenet gateway operates distinctly from the Mailman moderation -- in 
fact we have to jump through a hoop or two if we *do* want to moderate 
someone who usually posts via Usenet.


TJG
--
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Jon Ribbens
On 2016-04-19, Tim Golden  wrote:
> On 19/04/2016 10:03, Jon Ribbens wrote:
>> But from what you described, it sounds like all Usenet posts will
>> now be prevented from reaching the list. If so you should probably
>> consider rmgrouping comp.lang.python or at least abandoning the
>> idea of it being linked to the mailing list.
>>
>> (I've no idea of course if you will even see this message!)
>
> Well something in my explanation obviously wasn't clear, because that's 
> certainly not the case. I'm not even sure which bit gave you that 
> impression (please feel free to quote it back at me!).

You said "Our new approach ... will be to reject unsubscribed posts".
Usenet posters are not subscribed to the mailing list, hence their
posts will be be rejected from the list, according to what you said.

> The Usenet gateway operates distinctly from the Mailman moderation -- in 
> fact we have to jump through a hoop or two if we *do* want to moderate 
> someone who usually posts via Usenet.

Are you saying that Usenet posts skip the moderation entirely?

This whole thing seems a bit of a mess. What you really need to be
doing is changing the Usenet group to be moderated, otherwise you're
going to end up with two different views supposedly of the same thing
which in fact may be completely different.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Paul Rudin
Pete Forman  writes:

> Why is it that Python continues to use a fixed width font and therefore
> specifies the maximum line width as a character count?

Python doesn't require the use of any particular font for editing your
code.

However programmers tend to use fixed width fonts when editing code
because then the visual representation of indentation works
consistently. But that's not a python specific thing.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Rustom Mody
On Tuesday, April 19, 2016 at 1:47:48 PM UTC+5:30, Chris Angelico wrote:
> On Tue, Apr 19, 2016 at 6:09 PM, Marko Rauhamaa  wrote:
> > Now, descending back on earth, I don't believe the advantages of rich
> > source code will outweigh those of plain text in the foreseeable future.
> 
> No, they will not, because they'll make your code proprietary.

Pragmatically yes; theoretically no because its like saying
"If one dont want to get locked down to MSWord proprietary tools and formats
one should use latex"
Refuted by the fact that libreoffice and odf etc are free/open


> Suddenly *nothing* else will viably work with your code. (And before
> you say "but diff tools are fine with XML/JSON/YAML/whatever", it's
> not that simple; as soon as the underlying structure is capable of
> representing information that doesn't matter to your source code, you
> open yourself up to diff noise. 

You just nicely described how diff is ½-assed. 
In more detail
here is foo.txt foo1.txt and foo2.txt containing
---
Now is the time
for all good men
to come to the aid of their country
---
vi, emacs, shell (cat) show them right and having the same contents
However diff (and therefore unfortunately git) have no clue that one has
DOS line-endings and one is UTF-16

> I've had this exact problem with
> git-managing my OBS configs, which are JSON files; there's one
> particular array that's effectively a set, and the file keeps
> reordering itself. I had to write a pre-commit script that sorts them
> into a consistent order, else I'd have had useless diffs.)

If you are ok with json morphing to yaml you may find ruamel useful
http://stackoverflow.com/questions/5121931/in-python-how-can-you-load-yaml-mappings-as-ordereddicts
https://pypi.python.org/pypi/ruamel.yaml
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Marko Rauhamaa
Paul Rudin :

> Pete Forman  writes:
>> Why is it that Python continues to use a fixed width font and
>> therefore specifies the maximum line width as a character count?
>
> Python doesn't require the use of any particular font for editing your
> code.
>
> However programmers tend to use fixed width fonts when editing code
> because then the visual representation of indentation works
> consistently. But that's not a python specific thing.

Prehistoric programming languages considered uppercase/lowercase
differences insignificant variations. Most modern languages preserve the
distinction and in fact invite us to make a difference between:

   BLACK
   Black
   black

Why stop there?

We need a PEP to distinguish also between:

 - typefaces (Times New Roman vs Garamond)

 - weights (bold vs thin)

 - serifs (with or without)

 - sizes (8pt vs 11pt)

 - colors (goldenrod vs maroon)


Think of all the lesser programming languages that would seem so
20th-century when Python takes this step -- which virtually every
self-respecting web site has already taken in their style sheets!


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Rustom Mody
On Tuesday, April 19, 2016 at 5:18:07 PM UTC+5:30, Marko Rauhamaa wrote:
> Paul Rudin :
> 
> > Pete Forman  writes:
> >> Why is it that Python continues to use a fixed width font and
> >> therefore specifies the maximum line width as a character count?
> >
> > Python doesn't require the use of any particular font for editing your
> > code.
> >
> > However programmers tend to use fixed width fonts when editing code
> > because then the visual representation of indentation works
> > consistently. But that's not a python specific thing.
> 
> Prehistoric programming languages considered uppercase/lowercase
> differences insignificant variations. Most modern languages preserve the
> distinction and in fact invite us to make a difference between:
> 
>BLACK
>Black
>black
> 
> Why stop there?
> 
> We need a PEP to distinguish also between:
> 
>  - typefaces (Times New Roman vs Garamond)
> 
>  - weights (bold vs thin)
> 
>  - serifs (with or without)
> 
>  - sizes (8pt vs 11pt)
> 
>  - colors (goldenrod vs maroon)
> 
> 
> Think of all the lesser programming languages that would seem so
> 20th-century when Python takes this step -- which virtually every
> self-respecting web site has already taken in their style sheets!

You are of course being facetious but Forth already beat you to it in Color 
Forth:
https://blogs.msdn.microsoft.com/ashleyf/2013/11/02/the-beautiful-simplicity-of-colorforth/

More seriously the problem is that when we go from 100 of ASCII to 1 million 
of Unicode its like a digital to analogue jump.
In http://blog.languager.org/2014/04/unicoded-python.html
Ive described that it would be nice if for instance we could write
x ≤ y in place of the clunky x <= y
Likewise x ≠ y would obviate all useless arguments between x <>y or x != y etc

But then there are a slew of lookalikes like 
x ≲ y
x ≦ y

If someone seriously starts embracing unicode in program source, these 
kinds of questions/issues need corresponding serious consideration.

In the same way and like colorforth, it would be better to distinguish
identifier
from identifier
rather than the current status of distinguishing identifier from Identifier
But then we have a slippery slope:
Should  be same/distinct from  ?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Marko Rauhamaa
Rustom Mody :

> In the same way and like colorforth, it would be better to distinguish
> identifier from
> identifier rather than the current status of
> distinguishing identifier from Identifier But then we have a slippery
> slope: Should  be same/distinct from  ?

In a past life of mine, a development team proudly presented their new
reporting tool that produced beautiful graphs with dozens of
crisscrossing, jagged lines.

I proposed they needed to make each line a different color and add a
legend for each color.

The developers thought that was a great idea.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Rustom Mody
On Tuesday, April 19, 2016 at 9:41:24 AM UTC+5:30, Random832 wrote:
> On Mon, Apr 18, 2016, at 23:54, Rustom Mody wrote:
> > Start no tabs:
> > if foo# comment that is aligned
> > do some stuff# across multiple indent levels 
> > 
> > Add tabs as leading indents with second line indented 1 tab more
> > (showing tabs as |)
> > |if foo# comment that is aligned
> > ||do some stuff# across multiple indent levels 
> >
> > Indent the first comment with 2 tabs
> > At this point the first comment is/shows lefter than the second
> > 
> > Indent the second with 1 tab -- the two #es now line up
> 
> Yeah but now the second line of code is to the right of the whole first
> line of code. "if foo" must have been too short to illustrate it (it's
> long enough if a tab is four spaces, but I guess it's longer in the
> sample), but I assumed you would get the concept of what I was saying
> and try putting something longer there or try extending the comments in
> the C code the sample preloads.
> 
> Like, it ends up looking like this:
> 
> if foo("what if it's a much longer condition"):# comment
>  do something  #
>  comment2
> 
> There's no way to get this:
> 
> if foo("what if it's a much longer condition"):  # comment
> do something # comment2

I get it looking quite nice if I put a tab between "foo" and "("
Is that an acceptable solution?? Dunno...

html tables need all sorts of 'un-table-ifying' options
eg column/row groups, tables within tables and what not.
At which point we cross the point of diminishing returns is not clear 
when we are still armchair discussing.

For something a bit more practical here is emacs (orgtbl mode) doing html 
tables:
https://www.youtube.com/watch?v=EQAd41VAXWo
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Antoon Pardon
Op 19-04-16 om 13:47 schreef Marko Rauhamaa:
> Prehistoric programming languages considered uppercase/lowercase
> differences insignificant variations. Most modern languages preserve the
> distinction and in fact invite us to make a difference between:
>
>BLACK
>Black
>black
>
> Why stop there?
>
> We need a PEP to distinguish also between:
>
>  - typefaces (Times New Roman vs Garamond)
>
>  - weights (bold vs thin)
>
>  - serifs (with or without)
>
>  - sizes (8pt vs 11pt)
>
>  - colors (goldenrod vs maroon)

Well personnaly I would like the introduction of weights.
So that reserved keywords are in bold and identifiers are
thin.

With unicode we could use the mathematical bold letters for
reserved words.

-- 
Antoon Pardon

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python packages for hydrology and DEM

2016-04-19 Thread Michael Selik
On Tue, Apr 19, 2016 at 2:21 AM Xristos Xristoou  wrote:

> I want to ask for hydrology python packages with complete function to
> calculate hydrology tasks like fill,flow direction,flow accumulator and
> more?or how can i find genetic algorithms for to do this tasks to finaly
> create a complete hydro model with python.
>
> can someone tell me some documentation to do that with python ? i want to
> find like this TopoToolbox from matlab in python using
>
> also i want to ask and for python psckage for digital elevation models
> calcultor like idw krigging spline and more...or some documentation for this
> or some genetic algorithm for this
>
>
Sklearn is a good machine learning package (http://scikit-learn.org/).
I suggest simulated annealing rather than genetic algorithms.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why are my files in in my list - os module used with sys argv

2016-04-19 Thread Sayth Renshaw
On Tuesday, 19 April 2016 18:17:02 UTC+10, Peter Otten  wrote:
> Steven D'Aprano wrote:
> 
> > On Tue, 19 Apr 2016 09:44 am, Sayth Renshaw wrote:
> > 
> >> Hi
> >> 
> >> Why would it be that my files are not being found in this script?
> > 
> > You are calling the script with:
> > 
> > python jqxml.py samples *.xml
> > 
> > This does not do what you think it does: under Linux shells, the glob
> > *.xml will be expanded by the shell. Fortunately, in your case, you have
> > no files in the current directory matching the glob *.xml, so it is not
> > expanded and the arguments your script receives are:
> > 
> > 
> > "python jqxml.py"  # not used
> > 
> > "samples"  # dir
> > 
> > "*.xml"  # mask
> > 
> > 
> > You then call:
> > 
> > fileResult = filter(lambda x: x.endswith(mask), files)
> > 
> > which looks for file names which end with a literal string (asterisk, dot,
> > x, m, l) in that order. You have no files that match that string.
> > 
> > At the shell prompt, enter this:
> > 
> > touch samples/junk\*.xml
> > 
> > and run the script again, and you should see that it now matches one file.
> > 
> > Instead, what you should do is:
> > 
> > 
> > (1) Use the glob module:
> > 
> > https://docs.python.org/2/library/glob.html
> > https://docs.python.org/3/library/glob.html
> > 
> > https://pymotw.com/2/glob/
> > https://pymotw.com/3/glob/
> > 
> > 
> > (2) When calling the script, avoid the shell expanding wildcards by
> > escaping them or quoting them:
> > 
> > python jqxml.py samples "*.xml"
> 
> (3) *Use* the expansion mechanism provided by the shell instead of fighting 
> it:
> 
> $ python jqxml.py samples/*.xml
> 
> This requires that you change your script
> 
> from pyquery import PyQuery as pq
> import pandas as pd
> import sys
> 
> fileResult = sys.argv[1:]
> 
> if not fileResult:
>  print("no files specified")
>  sys.exit(1)
> 
> for file in fileResult:
> print(file)
> 
> for items in fileResult:
> try:
> d = pq(filename=items)
> except FileNotFoundError as e:
> print(e)
> continue
> res = d('nomination')
> # you could move the attrs definition before the loop
> attrs = ('id', 'horse')
> # probably a bug: you are overwriting data on every iteration
> data = [[res.eq(i).attr(x) for x in attrs] for i in range(len(res))]
> 
> I think this is the most natural approach if you are willing to accept the 
> quirk that the script tries to process the file 'samples/*.xml' if the 
> samples directory doesn't contain any files with the .xml suffix. Common 
> shell tools work that way:
> 
> $ ls samples/*.xml
> samples/1.xml  samples/2.xml  samples/3.xml
> $ ls samples/*.XML
> ls: cannot access samples/*.XML: No such file or directory
> 
> Unrelated: instead of working with sys.argv directly you could use argparse 
> which is part of the standard library. The code to get at least one file is
> 
> import argparse
> 
> parser = argparse.ArgumentParser()
> parser.add_argument("files", nargs="+")
> args = parser.parse_args()
> 
> print(args.files)
> 
> Note that this doesn't fix the shell expansion oddity.

Hi

Thanks for the insight, after doing a little reading I found this post which 
uses both argparse and glob and attempts to cover the windows and bash 
expansion of wildcards, 
http://breathmintsforpenguins.blogspot.com.au/2013/09/python-crossplatform-handling-of.html

import argparse  
from glob import glob  
   
def main(file_names):  
print file_names  
   
if __name__ == "__main__":  
parser = argparse.ArgumentParser()  
parser.add_argument("file_names", nargs='*') 
#nargs='*' tells it to combine all positional arguments into a single list  
args = parser.parse_args()  
file_names = list()  
   
#go through all of the arguments and replace ones with wildcards with the 
expansion
#if a string does not contain a wildcard, glob will return it as is.
for arg in args.file_names:  
file_names += glob(arg)  
 
main(file_names)

And way beyond my needs for such a tiny script but I think tis is the flask 
developers python cli creation package Click 
http://click.pocoo.org/5/why/#why-not-argparse based of optparse.


> # probably a bug: you are overwriting data on every iteration
> data = [[res.eq(i).attr(x) for x in attrs] for i in range(len(res))]

Thanks for picking this up will have to append to it on each iteration for each 
attribute.

Thank You

Sayth
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Tim Chase
On 2016-04-19 14:47, Marko Rauhamaa wrote:
> We need a PEP to distinguish also between:
>  - typefaces (Times New Roman vs Garamond)
>  - weights (bold vs thin)
>  - serifs (with or without)
>  - sizes (8pt vs 11pt)
>  - colors (goldenrod vs maroon)

Like HTML & CSS, the goal should be to separate the code (HTML) from
its presentation (how it appears in your editor).

It's why I've taken to using formulaic indenting (one or two
indents depending on whether the continued line starts an
indented block) rather than trying to align with something in a prior
line.  It drives me nuts when I globally change the spelling of
something (and thus the length of some variable name) and then feel
obligated to re-indent my continuations to get them to line back up
with some arbitrary paren.  Compare

def do_something(param1,
 param2,
 param3,
 ):
implementation()

with just using

def do_something(param1,
param2,
param3,
):
implementation()

(or, if you want your params to line up


def do_something(
param1,
param2,
param3,
):
implementation()

which is usually how I end up splitting them)

When "do_something" changes to "frobify", I don't feel the need to go
play with indentation with my scheme.

Likewise, I detest aligning comments and almost always prefer to put
them in a neighboring line if there's continuation:

foo = bar * 3 + 2 # we have 3 bars
  # plus one for margin on either side

changing the length of the code portion (say, s/bar/inner_width/) will
require re-indenting (and possibly re-flowing) the comments.

It's even worse if the comment flows to an unrelated line

foo = bar * 3 + 2# we have 3 bars
result = apply(bar)  # plus one for margin on either side

Now, if either line of *code* changes, it requires rejiggering the
comment indentation.

If the comment gets moved above, it's no longer an issue:

# we have 3 bars plus one for margin on either side
foo = bar * 3 + 2
result = apply(bar)

I strongly advocate from keeping the content (the code and its AST)
separate from its presentation.

-tkc







-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why are my files in in my list - os module used with sys argv

2016-04-19 Thread Sayth Renshaw
On Tuesday, 19 April 2016 23:21:42 UTC+10, Sayth Renshaw  wrote:
> On Tuesday, 19 April 2016 18:17:02 UTC+10, Peter Otten  wrote:
> > Steven D'Aprano wrote:
> > 
> > > On Tue, 19 Apr 2016 09:44 am, Sayth Renshaw wrote:
> > > 
> > >> Hi
> > >> 
> > >> Why would it be that my files are not being found in this script?
> > > 
> > > You are calling the script with:
> > > 
> > > python jqxml.py samples *.xml
> > > 
> > > This does not do what you think it does: under Linux shells, the glob
> > > *.xml will be expanded by the shell. Fortunately, in your case, you have
> > > no files in the current directory matching the glob *.xml, so it is not
> > > expanded and the arguments your script receives are:
> > > 
> > > 
> > > "python jqxml.py"  # not used
> > > 
> > > "samples"  # dir
> > > 
> > > "*.xml"  # mask
> > > 
> > > 
> > > You then call:
> > > 
> > > fileResult = filter(lambda x: x.endswith(mask), files)
> > > 
> > > which looks for file names which end with a literal string (asterisk, dot,
> > > x, m, l) in that order. You have no files that match that string.
> > > 
> > > At the shell prompt, enter this:
> > > 
> > > touch samples/junk\*.xml
> > > 
> > > and run the script again, and you should see that it now matches one file.
> > > 
> > > Instead, what you should do is:
> > > 
> > > 
> > > (1) Use the glob module:
> > > 
> > > https://docs.python.org/2/library/glob.html
> > > https://docs.python.org/3/library/glob.html
> > > 
> > > https://pymotw.com/2/glob/
> > > https://pymotw.com/3/glob/
> > > 
> > > 
> > > (2) When calling the script, avoid the shell expanding wildcards by
> > > escaping them or quoting them:
> > > 
> > > python jqxml.py samples "*.xml"
> > 
> > (3) *Use* the expansion mechanism provided by the shell instead of fighting 
> > it:
> > 
> > $ python jqxml.py samples/*.xml
> > 
> > This requires that you change your script
> > 
> > from pyquery import PyQuery as pq
> > import pandas as pd
> > import sys
> > 
> > fileResult = sys.argv[1:]
> > 
> > if not fileResult:
> >  print("no files specified")
> >  sys.exit(1)
> > 
> > for file in fileResult:
> > print(file)
> > 
> > for items in fileResult:
> > try:
> > d = pq(filename=items)
> > except FileNotFoundError as e:
> > print(e)
> > continue
> > res = d('nomination')
> > # you could move the attrs definition before the loop
> > attrs = ('id', 'horse')
> > # probably a bug: you are overwriting data on every iteration
> > data = [[res.eq(i).attr(x) for x in attrs] for i in range(len(res))]
> > 
> > I think this is the most natural approach if you are willing to accept the 
> > quirk that the script tries to process the file 'samples/*.xml' if the 
> > samples directory doesn't contain any files with the .xml suffix. Common 
> > shell tools work that way:
> > 
> > $ ls samples/*.xml
> > samples/1.xml  samples/2.xml  samples/3.xml
> > $ ls samples/*.XML
> > ls: cannot access samples/*.XML: No such file or directory
> > 
> > Unrelated: instead of working with sys.argv directly you could use argparse 
> > which is part of the standard library. The code to get at least one file is
> > 
> > import argparse
> > 
> > parser = argparse.ArgumentParser()
> > parser.add_argument("files", nargs="+")
> > args = parser.parse_args()
> > 
> > print(args.files)
> > 
> > Note that this doesn't fix the shell expansion oddity.
> 
> Hi
> 
> Thanks for the insight, after doing a little reading I found this post which 
> uses both argparse and glob and attempts to cover the windows and bash 
> expansion of wildcards, 
> http://breathmintsforpenguins.blogspot.com.au/2013/09/python-crossplatform-handling-of.html
> 
> import argparse  
> from glob import glob  
>
> def main(file_names):  
> print file_names  
>
> if __name__ == "__main__":  
> parser = argparse.ArgumentParser()  
> parser.add_argument("file_names", nargs='*') 
> #nargs='*' tells it to combine all positional arguments into a single 
> list  
> args = parser.parse_args()  
> file_names = list()  
>
> #go through all of the arguments and replace ones with wildcards with the 
> expansion
> #if a string does not contain a wildcard, glob will return it as is.
> for arg in args.file_names:  
> file_names += glob(arg)  
>  
> main(file_names)
> 
> And way beyond my needs for such a tiny script but I think tis is the flask 
> developers python cli creation package Click 
> http://click.pocoo.org/5/why/#why-not-argparse based of optparse.
> 
> 
> > # probably a bug: you are overwriting data on every iteration
> > data = [[res.eq(i).attr(x) for x in attrs] for i in range(len(res))]
> 
> Thanks for picking this up will have to append to it on each iteration for 
> each attribute.
> 
> Thank You
> 
> Sayth

Scratch that bit about the code for 
http://breathmintsforpenguins.blogspot.com.au/2013/09/python-crossplatform-handling-of.html
 can't get it to work, good general direction

Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Chris Angelico
On Tue, Apr 19, 2016 at 11:31 PM, Tim Chase
 wrote:
> Likewise, I detest aligning comments and almost always prefer to put
> them in a neighboring line if there's continuation:
>
> foo = bar * 3 + 2 # we have 3 bars
>   # plus one for margin on either side
>
> changing the length of the code portion (say, s/bar/inner_width/) will
> require re-indenting (and possibly re-flowing) the comments.
>
> It's even worse if the comment flows to an unrelated line
>
> foo = bar * 3 + 2# we have 3 bars
> result = apply(bar)  # plus one for margin on either side
>
> Now, if either line of *code* changes, it requires rejiggering the
> comment indentation.
>
> If the comment gets moved above, it's no longer an issue:
>
> # we have 3 bars plus one for margin on either side
> foo = bar * 3 + 2
> result = apply(bar)

Oh, absolutely! If the right-hand comment can't fit in the
right-hand-side, it needs to move above the code. The only time I'll
"wrap" that kind of comment is when it actually applies to both lines
of code:

width = bar * 3 + 2 # we have 3x2 bars, plus one...
height = bar * 2 + 2 # ... pixel of margin on all sides

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why are my files in in my list - os module used with sys argv

2016-04-19 Thread Peter Otten
Sayth Renshaw wrote:

> Thanks for the insight, after doing a little reading I found this post
> which uses both argparse and glob and attempts to cover the windows and
> bash expansion of wildcards,
> http://breathmintsforpenguins.blogspot.com.au/2013/09/python-crossplatform-handling-of.html

I hope you read the comment section of that page carefully.
On Linux your script's behaviour will be surprising.


-- 
https://mail.python.org/mailman/listinfo/python-list


Problem with textblob lib

2016-04-19 Thread liran . maymoni
Hey,
Using windows 10
I've install textblob using "py -m pip install textblob".
I can import textblob, or from textblob import blob,word
But i cant: from textblobl import Textblob.
The error i get is:
Traceback (most recent call last):
  File "", line 1, in 
from textblob import Textblob
ImportError: cannot import name 'Textblob'

Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Tim Chase
On 2016-04-19 04:37, Rustom Mody wrote:
> > No, they will not, because they'll make your code proprietary.  
> 
> Pragmatically yes; theoretically no because its like saying
> "If one dont want to get locked down to MSWord proprietary tools
> and formats one should use latex"
> Refuted by the fact that libreoffice and odf etc are free/open

Except that I still regularly have trouble with consistent formatting
being portable between LO/OO.o/MSWord (heck, I still have trouble
with MS Word not being consistent between versions).

-tkc




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Random832
On Tue, Apr 19, 2016, at 08:55, Rustom Mody wrote:
> > Like, it ends up looking like this:
> > 
> > if foo("what if it's a much longer condition"):# comment
> >  do something  #
> >  comment2
> > 
> > There's no way to get this:
> > 
> > if foo("what if it's a much longer condition"):  # comment
> > do something # comment2
> 
> I get it looking quite nice if I put a tab between "foo" and "("
> Is that an acceptable solution?? Dunno...

No, because what if "foo" is much longer? You could put a tab after
"if", but that means while-blocks are indented further than if-blocks.
And that just delays the problem to the third indent block, you've got
to find something to line that up to.

if foo("blah blah blah"):   # comment
if bar("etc etc etc etc"):  # comment
do stuff# comment

becomes

if foo  ("blah blah blah"):# comment
if bar   ("etc etc etc etc"):  # comment
 do stuff  # comment

Maybe what we really need is a way to _display_ a multiline comment at
the right margin (and hanging down for as many lines as it needs),
without having it baked into the source code that way.

Source file contains:
### Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam
### ut mattis leo. In sed arcu gravida, consequat tellus placerat,
### ullamcorper metus.
if foo:
if bar:
do stuff
###
some other stuff

(the last ### is just an empty comment to push stuff after it down past
the first comment - if another comment is there instead, it will be
displayed starting from the "some other stuff" line)

Displays as:

if foo:   # Lorem ipsum dolor sit amet, consectetur
if bar:   # adipiscing elit. Etiam ut mattis leo. In sed
do stuff  # arcu gravida, consequat tellus
  # placerat, ullamcorper metus.

some other stuff
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem with textblob lib

2016-04-19 Thread Peter Otten
liran.maym...@gmail.com wrote:

> Hey,
> Using windows 10
> I've install textblob using "py -m pip install textblob".
> I can import textblob, or from textblob import blob,word
> But i cant: from textblobl import Textblob.
> The error i get is:
> Traceback (most recent call last):
>   File "", line 1, in 
> from textblob import Textblob
> ImportError: cannot import name 'Textblob'
> 
> Thanks.

Try

from textblob import TextBlob

Python is case-sensitive.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Chris Angelico
On Wed, Apr 20, 2016 at 12:05 AM, Random832  wrote:
> Source file contains:
> ### Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam
> ### ut mattis leo. In sed arcu gravida, consequat tellus placerat,
> ### ullamcorper metus.
> if foo:
> if bar:
> do stuff
> ###
> some other stuff
>
> (the last ### is just an empty comment to push stuff after it down past
> the first comment - if another comment is there instead, it will be
> displayed starting from the "some other stuff" line)
>
> Displays as:
>
> if foo:   # Lorem ipsum dolor sit amet, consectetur
> if bar:   # adipiscing elit. Etiam ut mattis leo. In sed
> do stuff  # arcu gravida, consequat tellus
>   # placerat, ullamcorper metus.
>
> some other stuff

Why does it need to be displayed to the right, though? Do we gain
anything by not having the comment above the code?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why are my files in in my list - os module used with sys argv

2016-04-19 Thread Sayth Renshaw
On Tuesday, 19 April 2016 23:46:01 UTC+10, Peter Otten  wrote:
> Sayth Renshaw wrote:
> 
> > Thanks for the insight, after doing a little reading I found this post
> > which uses both argparse and glob and attempts to cover the windows and
> > bash expansion of wildcards,
> > http://breathmintsforpenguins.blogspot.com.au/2013/09/python-crossplatform-handling-of.html
> 
> I hope you read the comment section of that page carefully.
> On Linux your script's behaviour will be surprising.

Yes I have gone your way now and am parsing the files, where my data is going 
will have to wait till after I sleep.

Thanks for the advice.

from pyquery import PyQuery as pq
import pandas as pd
import argparse
# from glob import glob


parser = argparse.ArgumentParser(description=None)


def GetArgs(parser):
"""Parser function using argparse"""
# parser.add_argument('directory', help='directory use',
# action='store', nargs='*')
parser.add_argument("files", nargs="+")
return parser.parse_args()

fileList = GetArgs(parser)
print(fileList.files)
# d = pq(filename='20160319RHIL0_edit.xml')
data = []
attrs = ('id', 'horse')


for items in fileList.files:
d = pq(filename=items)
res = d('nomination')
dataSets = [[res.eq(i).attr(x)
 for x in attrs] for i in range(len(res))]
resultList = data.append(dataSets)

frames = pd.DataFrame(resultList)
print(frames)

--
(pyquery)sayth@sayth-E6410:~/Projects/pyquery$ python jqxml.py samples/*.xml
['samples/20160319RHIL0_edit.xml', 'samples/20160402RAND0.xml', 
'samples/20160409RAND0.xml', 'samples/20160416RAND0.xml']
Empty DataFrame
Columns: []
Index: []
(pyquery)sayth@sayth-E6410:~/Projects/pyquery$ 

Thanks

Sayth
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Grant Edwards
On 2016-04-19, Pete Forman  wrote:

> My question asks why monospace is used for the text.

Well, I always use a monospaced font for code because I find it helps
readability for things like tables of data, block comments, and lines
of code that have some sort of parallel structure that I want to be
obvious to the reader.

> And more generally that programmers sticking to text when rest of
> world has moved on is rather backward:
> http://blog.languager.org/2012/10/html-is-why-mess-in-programming-syntax.html

The same reason humans use written and spoken language rather than
just drawing pictures, pointing, and grunting?

-- 
Grant Edwards   grant.b.edwardsYow! What a COINCIDENCE!
  at   I'm an authorized "SNOOTS
  gmail.comOF THE STARS" dealer!!

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Rustom Mody
On Tuesday, April 19, 2016 at 7:30:18 PM UTC+5:30, Tim Chase wrote:
> On 2016-04-19 04:37, Rustom Mody wrote:
> > > No, they will not, because they'll make your code proprietary.  
> > 
> > Pragmatically yes; theoretically no because its like saying
> > "If one dont want to get locked down to MSWord proprietary tools
> > and formats one should use latex"
> > Refuted by the fact that libreoffice and odf etc are free/open
> 
> Except that I still regularly have trouble with consistent formatting
> being portable between LO/OO.o/MSWord (heck, I still have trouble
> with MS Word not being consistent between versions).

1. That libre is in sux category compared to MS
2. That MS does legal and illegal things to lock people in
3. And other charms of civilized existence
naturally conduce us to the most rational choice - luddeiteism

Fortunately or unfortunately we dont always make rational choices :-)

text files are a luddite choice
They work in the same way that pen-n-paper keep working when the power
fails and computer is down
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Chris Angelico
On Wed, Apr 20, 2016 at 12:15 AM, Grant Edwards
 wrote:
>> And more generally that programmers sticking to text when rest of
>> world has moved on is rather backward:
>> http://blog.languager.org/2012/10/html-is-why-mess-in-programming-syntax.html
>
> The same reason humans use written and spoken language rather than
> just drawing pictures, pointing, and grunting?

http://catb.org/esr/writings/unix-koans/gui-programmer.html

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem with textblob lib

2016-04-19 Thread liran . maymoni
On Tuesday, April 19, 2016 at 5:08:58 PM UTC+3, Peter Otten wrote:
> liran.maym...@gmail.com wrote:
> 
> > Hey,
> > Using windows 10
> > I've install textblob using "py -m pip install textblob".
> > I can import textblob, or from textblob import blob,word
> > But i cant: from textblobl import Textblob.
> > The error i get is:
> > Traceback (most recent call last):
> >   File "", line 1, in 
> > from textblob import Textblob
> > ImportError: cannot import name 'Textblob'
> > 
> > Thanks.
> 
> Try
> 
> from textblob import TextBlob
> 
> Python is case-sensitive.

OMG thank you
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Alice Bevan–McGregor

On 2016-04-18 21:14:02 +, Pete Forman said:


Why is it that Python continues to use a fixed width font and therefore
specifies the maximum line width as a character count?

An essential part of the language is indentation which ought to continue
to mandate that lines start with a multiple of 4 em worth of space (or
some other size or encode with hard tabs, that is not germane to my
question). The content of the line need not be bound by the rules needed
to position its start.


I wrote a semi-serious, somewhat tongue-in-cheek article entitled "Your
code style guide is crap, but still better than nothing." a number of years
ago, and reposted it towards the end of last year. It would seem to apply
here, as the fundamental disconnect isn't just "use of N space
characters", but "use of space characters at all".

From the article:


Do you use spaces in a word processor to line up bullet points? If you
do you’ll be first against the wall when the revolution comes!


http://s.webcore.io/2K0W0m2T2e2f

It also touches on points raised by others, such as Elastic Tabstops.

— Alice.


--
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Rustom Mody
On Tuesday, April 19, 2016 at 7:46:21 PM UTC+5:30, Grant Edwards wrote:
> On 2016-04-19, Pete Forman  wrote:
> 
> > My question asks why monospace is used for the text.
> 
> Well, I always use a monospaced font for code because I find it helps
> readability for things like tables of data, block comments, and lines
> of code that have some sort of parallel structure that I want to be
> obvious to the reader.
> 
> > And more generally that programmers sticking to text when rest of
> > world has moved on is rather backward:
> > http://blog.languager.org/2012/10/html-is-why-mess-in-programming-syntax.html
> 
> The same reason humans use written and spoken language rather than
> just drawing pictures, pointing, and grunting?

I wonder who the joke is on:

| A study comparing Canadian and Chinese students found that the latter were 
| better at complex maths

| Native English speakers rely more on additional brain regions involved in the 
| meaning of words, whereas native Chinese speakers rely more on additional 
| brain regions involved in the visual appearance and physical manipulation of 
| numbers,

from : 
https://www.newscientist.com/article/dn9422-mother-tongue-may-determine-maths-skills/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Tim Chase
On 2016-04-19 23:41, Chris Angelico wrote:
> The only time I'll "wrap" that kind of comment is when it actually
> applies to both lines of code:
> 
> width = bar * 3 + 2 # we have 3x2 bars, plus one...
> height = bar * 2 + 2 # ... pixel of margin on all sides

And even then in that exceptional case, I see that you do the same
thing I do:  just append , hash, space, comment.  No fancy
aligning.

-tkc



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Steven D'Aprano
On Wed, 20 Apr 2016 12:54 am, Rustom Mody wrote:


> I wonder who the joke is on:
> 
> | A study comparing Canadian and Chinese students found that the latter
> | were better at complex maths

Most published studies are wrong.

http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1182327/

- Has that study been replicated by others? Have people tried to 
  replicate it? Were negative findings published, or do they
  languish in some researcher's bottom drawer? (Publication bias
  is a big problem in research.)

- Was the study well-designed, and the given conclusions supported
  by the study? How well did it survive the critical attention of
  experts in that field? Did the study account for differences in
  mathematics education?

- Did the study have sufficient statistical power to support the
  claimed results? Most published studies are invalid since they
  simply lack the power to justify their conclusion.

- Is the effect due to chance? Remember, with a p-value of 0.05 (the
  so-called 95% significance level), one in twenty experiments will
  give a positive result just by chance. A p-value of 0.05 does not
  mean "these results are proven", it just means "if every single 
  thing about this experiment is perfect, then the chances that these
  results are due by chance alone is 1 in 20".

Anyone who has played (say) Dungeons and Dragons, or other role-playing
games, will know that events with a probability of 1 in 20 occur very
frequently. To be precise, they occur one time in twenty.

Even if the claimed results are correct, how strong is the effect?

(a) On average, Canadian students get 49.0% on a standard exam that Chinese
students get 89.0% for.

(b) On average, Canadian students get 49.0% on a standard exam that Chinese
students get 49.1% for.

The level of statistical significance is not related to the strength of the
effect: we can be very confident of small effects, and weakly confident of
large effects.



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Failed install scipy lib

2016-04-19 Thread liran . maymoni
Hello,
i'm trying to use:
"py -m pip install scipy"
and after couple of lines a get an error saying:

Command "C:\Users\Liran\AppData\Local\Programs\Python\Python35-32\python.exe -u 
-c "import setuptools, 
tokenize;__file__='C:\\Users\\Liran\\AppData\\Local\\Temp\\pip-build-er8bfsou\\scipy\\setup.py';exec(compile(getattr(tokenize,
 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" 
install --record 
C:\Users\Liran\AppData\Local\Temp\pip-4505t4eq-record\install-record.txt 
--single-version-externally-managed --compile" failed with error code 1 in 
C:\Users\Liran\AppData\Local\Temp\pip-build-er8bfsou\scipy

What is the problem?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Failed install scipy lib

2016-04-19 Thread liran . maymoni
This is the full Log:

C:\Users\Liran>py -m pip install scipy
Collecting scipy
  Using cached scipy-0.17.0.tar.gz
Installing collected packages: scipy
  Running setup.py install for scipy ... error
Complete output from command 
C:\Users\Liran\AppData\Local\Programs\Python\Python35-32\python.exe -u -c 
"import setuptools, 
tokenize;__file__='C:\\Users\\Liran\\AppData\\Local\\Temp\\pip-build-47xsb0ek\\scipy\\setup.py';exec(compile(getattr(tokenize,
 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" 
install --record 
C:\Users\Liran\AppData\Local\Temp\pip-ybdtaj2y-record\install-record.txt 
--single-version-externally-managed --compile:
lapack_opt_info:
openblas_lapack_info:
  libraries openblas not found in 
['C:\\Users\\Liran\\AppData\\Local\\Programs\\Python\\Python35-32\\lib', 
'C:\\', 'C:\\Users\\Liran\\AppData\\Local\\Programs\\Python\\Python35-32\\libs']
  NOT AVAILABLE

lapack_mkl_info:
mkl_info:
  libraries mkl,vml,guide not found in 
['C:\\Users\\Liran\\AppData\\Local\\Programs\\Python\\Python35-32\\lib', 
'C:\\', 'C:\\Users\\Liran\\AppData\\Local\\Programs\\Python\\Python35-32\\libs']
  NOT AVAILABLE

  NOT AVAILABLE

atlas_3_10_threads_info:
Setting PTATLAS=ATLAS

C:\Users\Liran\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\distutils\system_info.py:633:
 UserWarning: Specified path 
C:\projects\windows-wheel-builder\atlas-builds\atlas-3.10.1-sse2-32\lib is 
invalid.
  warnings.warn('Specified path %s is invalid.' % d)

  NOT AVAILABLE

atlas_3_10_info:

  NOT AVAILABLE

atlas_threads_info:
Setting PTATLAS=ATLAS

  NOT AVAILABLE

atlas_info:

  NOT AVAILABLE


C:\Users\Liran\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\distutils\system_info.py:1542:
 UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
  warnings.warn(AtlasNotFoundError.__doc__)
lapack_info:
  libraries lapack not found in 
['C:\\Users\\Liran\\AppData\\Local\\Programs\\Python\\Python35-32\\lib', 
'C:\\', 'C:\\Users\\Liran\\AppData\\Local\\Programs\\Python\\Python35-32\\libs']
  NOT AVAILABLE


C:\Users\Liran\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\distutils\system_info.py:1553:
 UserWarning:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
  warnings.warn(LapackNotFoundError.__doc__)
lapack_src_info:
  NOT AVAILABLE


C:\Users\Liran\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\distutils\system_info.py:1556:
 UserWarning:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
  warnings.warn(LapackSrcNotFoundError.__doc__)
  NOT AVAILABLE

Running from scipy source directory.
Traceback (most recent call last):
  File "", line 1, in 
  File 
"C:\Users\Liran\AppData\Local\Temp\pip-build-47xsb0ek\scipy\setup.py", line 
265, in 
setup_package()
  File 
"C:\Users\Liran\AppData\Local\Temp\pip-build-47xsb0ek\scipy\setup.py", line 
262, in setup_package
setup(**metadata)
  File 
"C:\Users\Liran\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\distutils\core.py",
 line 135, in setup
config = configuration()
  File 
"C:\Users\Liran\AppData\Local\Temp\pip-build-47xsb0ek\scipy\setup.py", line 
182, in configuration
config.add_subpackage('scipy')
  File 
"C:\Users\Liran\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\distutils\misc_util.py",
 line 1003, in add_subpackage
caller_level = 2)
  File 
"C:\Users\Liran\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\distutils\misc_util.py",
 line 972, in get_subpackage
caller_level = caller_level + 1)
  File 
"C:\Users\Liran\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\distutils\misc_util.py",
 line 909, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
  File "scipy\setup.py", line 15, in configuration
config.add_subpackage('linalg')
  File 
"C:\Users\Liran\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\distutils\misc_util.py",
 line 1003, in add_subpackage
caller_level = 2)
  File 
"C:\Users\Liran\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numpy\distutils\misc_util.py",
 line 9

Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Steven D'Aprano
On Wed, 20 Apr 2016 01:50 am, Steven D'Aprano wrote:

> - Is the effect due to chance? Remember, with a p-value of 0.05 (the
>   so-called 95% significance level), one in twenty experiments will
>   give a positive result just by chance. A p-value of 0.05 does not
>   mean "these results are proven", it just means "if every single
>   thing about this experiment is perfect, then the chances that these
>   results are due by chance alone is 1 in 20".

Arggh! The above is, of course, *wrong*. This is why statistical
significance is so hard. I know the correct interpretation[1] of p-values
and I still got it wrong.

p-values give the probability of a positive result by chance if the null
hypothesis is true, that is, the chances of getting a false positive
result. "We detected a difference that actually isn't there."

It *doesn't* tell you anything about a false negative result: "We failed to
detect a difference which actually is there." And it certainly doesn't tell
you the chances that the result are true.

More here:

https://www.sciencenews.org/article/odds-are-its-wrong



[1] At least, I'm confident I understand p-values with a 95% significance
level.


-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Steven D'Aprano
On Tue, 19 Apr 2016 08:43 pm, Jon Ribbens wrote:

> Are you saying that Usenet posts skip the moderation entirely?
> 
> This whole thing seems a bit of a mess. What you really need to be
> doing is changing the Usenet group to be moderated, otherwise you're
> going to end up with two different views supposedly of the same thing
> which in fact may be completely different.

It's worse than that. There are many other places that mirror this group,
such as gmane, Activestate, bytes.com, gossamer-threads.com, and of course
Google Groups. They all have their own moderation and filtering policies,
which may differ from those of the others. Some of them may do only
mirroring, while others (including GG and gmane) may allow posting.


And yet, we manage to muddle on. If the plethora of mirrors with
inconsistent views is the worst that happens to us, I for one will be
amazingly happy.


-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Steven D'Aprano
On Tue, 19 Apr 2016 01:04 pm, Rustom Mody wrote:

> And more generally that programmers sticking to text when rest of world
> has moved on is rather backward:

I'm pretty sure that the rest of the world has not moved on from text. Text
still makes up by far the bulk of human communication. It's compact (one
second of a Youtube video requires about the same bandwidth as about 7000
words), it can be easily searched, edited, translated, the presentation can
be changed to suit the reader, and more. When precision of meaning is
important, text is still the winner except in a few specialist areas, such
as technical drawings, and even they still make extensive use of text.



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Steven D'Aprano
On Mon, 18 Apr 2016 03:32 pm, Marko Rauhamaa wrote:

> Steven D'Aprano :
> 
>> On Mon, 18 Apr 2016 10:27 am, Random832 wrote:
>>
>>> As an alternative, when you send them through can you put a note on
>>> the bottom saying they're not subscribed, to remind people to CC them
>>> in responses?
>>
>> That doesn't work so well from Usenet. I can reply via news (which
>> definitely works), or I can reply via email (which may or may not
>> work), but it is a pain to reply via *both*.
> 
> I don't like the Usenet+CC approach, but let's try it.
> 
> Did you get the CC, Steven.

Yes I did. I frequently have people CCing me. But that's not the problem for
me -- as I said above, it's a pain for me to SEND (not receive) via both
email and news.


-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


ANN: Python Meeting Düsseldorf - 27.04.2016

2016-04-19 Thread eGenix Team: M.-A. Lemburg
[This announcement is in German since it targets a local user group
 meeting in Düsseldorf, Germany]



ANKÜNDIGUNG

 Python Meeting Düsseldorf

 http://pyddf.de/

   Ein Treffen von Python Enthusiasten und Interessierten
in ungezwungener Atmosphäre.

  Dienstag, 27.04.2016, 18:00 Uhr
  Raum 1, 2.OG im Bürgerhaus Stadtteilzentrum Bilk
Düsseldorfer Arcaden, Bachstr. 145, 40217 Düsseldorf

Diese Nachricht ist auch online verfügbar:
http://www.egenix.com/company/news/Python-Meeting-Duesseldorf-2016-04-27


NEUIGKEITEN

 * Bereits angemeldete Vorträge:

   Matthias Endler
   "Protector - a Circuit Breaker for Time-Series Databases"

   Dr. Klaus Bremer
   "django-autotask"

   Jens Diemer
   "PyHardLinkBackup"

   Tom Engemann
   "Eine kurze Einführung in Kivy"

   Johannes Spielmann
   "Symmetrische Verschlüsselung für alle!"

   Weitere Vorträge können gerne noch angemeldet werden: i...@pyddf.de

 * Startzeit und Ort:

   Wir treffen uns um 18:00 Uhr im Bürgerhaus in den Düsseldorfer
   Arcaden.

   Das Bürgerhaus teilt sich den Eingang mit dem Schwimmbad und
   befindet sich an der Seite der Tiefgarageneinfahrt der Düsseldorfer
   Arcaden.

   Über dem Eingang steht ein großes "Schwimm' in Bilk" Logo. Hinter
   der Tür direkt links zu den zwei Aufzügen, dann in den 2. Stock
   hochfahren. Der Eingang zum Raum 1 liegt direkt links, wenn man aus
   dem Aufzug kommt.

   Google Street View: http://bit.ly/11sCfiw



EINLEITUNG

Das Python Meeting Düsseldorf ist eine regelmäßige Veranstaltung in
Düsseldorf, die sich an Python Begeisterte aus der Region wendet:

 * http://pyddf.de/

Einen guten Überblick über die Vorträge bietet unser YouTube-Kanal,
auf dem wir die Vorträge nach den Meetings veröffentlichen:

 * http://www.youtube.com/pyddf/

Veranstaltet wird das Meeting von der eGenix.com GmbH, Langenfeld,
in Zusammenarbeit mit Clark Consulting & Research, Düsseldorf:

 * http://www.egenix.com/
 * http://www.clark-consulting.eu/



PROGRAMM

Das Python Meeting Düsseldorf nutzt eine Mischung aus Open Space
und Lightning Talks, wobei die Gewitter bei uns auch schon mal
20 Minuten dauern können ;-).

Lightning Talks können vorher angemeldet werden, oder auch spontan
während des Treffens eingebracht werden. Ein Beamer mit XGA Auflösung
steht zur Verfügung.

Lightning Talk Anmeldung bitte formlos per EMail an i...@pyddf.de



KOSTENBETEILIGUNG

Das Python Meeting Düsseldorf wird von Python Nutzern für Python
Nutzer veranstaltet. Um die Kosten zumindest teilweise zu
refinanzieren, bitten wir die Teilnehmer um einen Beitrag in Höhe von
EUR 10,00 inkl. 19% Mwst, Schüler und Studenten zahlen EUR 5,00
inkl. 19% Mwst.

Wir möchten alle Teilnehmer bitten, den Betrag in bar mitzubringen.



ANMELDUNG

Da wir nur für ca. 20 Personen Sitzplätze haben, möchten wir
bitten, sich per EMail anzumelden. Damit wird keine Verpflichtung
eingegangen. Es erleichtert uns allerdings die Planung.

Meeting Anmeldung bitte formlos per EMail an i...@pyddf.de



WEITERE INFORMATIONEN

Weitere Informationen finden Sie auf der Webseite des Meetings:

http://pyddf.de/

Mit freundlichen Grüßen,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Apr 19 2016)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> Python Database Interfaces ...   http://products.egenix.com/
>>> Plone/Zope Database Interfaces ...   http://zope.egenix.com/


::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/
  http://www.malemburg.com/

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Rustom Mody
On Tuesday, April 19, 2016 at 9:44:39 PM UTC+5:30, Steven D'Aprano wrote:
> On Tue, 19 Apr 2016 01:04 pm, Rustom Mody wrote:
> 
> > And more generally that programmers sticking to text when rest of world
> > has moved on is rather backward:
> 
> I'm pretty sure that the rest of the world has not moved on from text. 

Run your popular search engine on "popular linux apps" or some such and
you will get for example:

inkscape
gimp
blender
libreoffice writer/calc/prese
wireshark
skype
firefox
audacity
musescore
totem
vlc
dia

Do these look like text-based apps to you?

> Text
> still makes up by far the bulk of human communication. It's compact (one
> second of a Youtube video requires about the same bandwidth as about 7000
> words), it can be easily searched, edited, translated, the presentation can
> be changed to suit the reader, and more. 

Yes so you just showed that in the realm of multimedia we are somewhere 
nearabouts...  tickertape? Hollerith cards?
Doesn't change the basic structure of the human being
viz that 5 senses working in harmony make us more productive than one 
overworking rest languishing

> When precision of meaning is
> important, text is still the winner except in a few specialist areas, such
> as technical drawings, and even they still make extensive use of text.

Yes in the short to medium run our text capability remains better than others.
Those who want to keep it so forever are keeping the rest of us back
fortunately futilely!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Failed install scipy lib

2016-04-19 Thread Oscar Benjamin
On 19 Apr 2016 17:01,  wrote:
>
> Hello,
> i'm trying to use:
> "py -m pip install scipy"
> and after couple of lines a get an error saying:

I thought that binary wheels for scipy would be available on pypi for each
OS now. Try updating pip and then using it to install scipy.

I'm not on Windows to check myself though I'm afraid.

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Larry Martell
On Tue, Apr 19, 2016 at 11:50 AM, Steven D'Aprano  wrote:
> On Wed, 20 Apr 2016 12:54 am, Rustom Mody wrote:
>
>
>> I wonder who the joke is on:
>>
>> | A study comparing Canadian and Chinese students found that the latter
>> | were better at complex maths
>
> Most published studies are wrong.
>
> http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1182327/
>
> - Has that study been replicated by others? Have people tried to
>   replicate it? Were negative findings published, or do they
>   languish in some researcher's bottom drawer? (Publication bias
>   is a big problem in research.)
>
> - Was the study well-designed, and the given conclusions supported
>   by the study? How well did it survive the critical attention of
>   experts in that field? Did the study account for differences in
>   mathematics education?
>
> - Did the study have sufficient statistical power to support the
>   claimed results? Most published studies are invalid since they
>   simply lack the power to justify their conclusion.
>
> - Is the effect due to chance? Remember, with a p-value of 0.05 (the
>   so-called 95% significance level), one in twenty experiments will
>   give a positive result just by chance. A p-value of 0.05 does not
>   mean "these results are proven", it just means "if every single
>   thing about this experiment is perfect, then the chances that these
>   results are due by chance alone is 1 in 20".
>
> Anyone who has played (say) Dungeons and Dragons, or other role-playing
> games, will know that events with a probability of 1 in 20 occur very
> frequently. To be precise, they occur one time in twenty.
>
> Even if the claimed results are correct, how strong is the effect?
>
> (a) On average, Canadian students get 49.0% on a standard exam that Chinese
> students get 89.0% for.
>
> (b) On average, Canadian students get 49.0% on a standard exam that Chinese
> students get 49.1% for.
>
> The level of statistical significance is not related to the strength of the
> effect: we can be very confident of small effects, and weakly confident of
> large effects.

85% of all statistics are made up.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread alister
On Wed, 20 Apr 2016 01:50:00 +1000, Steven D'Aprano wrote:
> Anyone who has played (say) Dungeons and Dragons, or other role-playing
> games, will know that events with a probability of 1 in 20 occur very
> frequently. To be precise, they occur one time in twenty.
> 
Million to 1 chances happen 9 time out of Ten (T prachett - Varius 
Discworld books :-) )

> Even if the claimed results are correct, how strong is the effect?
> 
> (a) On average, Canadian students get 49.0% on a standard exam that
> Chinese students get 89.0% for.
> 
> (b) On average, Canadian students get 49.0% on a standard exam that
> Chinese students get 49.1% for.
> 
> The level of statistical significance is not related to the strength of
> the effect: we can be very confident of small effects, and weakly
> confident of large effects.





-- 
If anyone has seen my dog, please contact me at x2883 as soon as possible.
We're offering a substantial reward.  He's a sable collie, with three 
legs,
blind in his left eye, is missing part of his right ear and the tip of his
tail.  He's been recently fixed.  Answers to "Lucky".
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Random832


On Tue, Apr 19, 2016, at 12:05, Steven D'Aprano wrote:
> It's worse than that. There are many other places that mirror this group,
> such as gmane, Activestate, bytes.com, gossamer-threads.com, and of
> course
> Google Groups.

Google groups goes through Usenet, and would be affected equally by any
solution to the usenet issue.

Gmane passes posts through normal email submission. It'd be mildly
irritating to have to be subscribed to be able to post through gmane,
but it wouldn't be the first group to have that requirement.

Gossamer threads and Activestate both appear to use the mailing list
archives and not allow posting.

Bytes.com appears to mirror *stack overflow*, not this list, unless I'm
missing something.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Tim Chase
On 2016-04-19 09:46, Rustom Mody wrote:
> inkscape
> gimp
> blender
> libreoffice writer/calc/prese
> wireshark
> skype
> firefox
> audacity
> musescore
> totem
> vlc
> dia
> 
> Do these look like text-based apps to you?

Well, let's take a look at their native file formats:

Inkscape: SVG

Libreoffice: compressed XML

Firefox: HTML+CSS+JS

Musescore: compressed text

Dia: compressed XML

While I haven't used Musescore, I have used the others and
hand-edited the files in each case.  Using vi/vim, or even ed(1).
Because I can, and sometimes because I have to in order to do some
convoluted process that would be a pain to do in a GUI.

For Gimp, Blender, Audacity, Totem, and VLC, those all deal with
binary streams of their content-type.

Skype being proprietary, it doesn't interoperate with bupkis.

So wireshark is the only outlier in my mind, though since it captures
binary packets, I suspect the native format is optimized for
streaming stuff from the NIC to the disk as fast as possible (though
given CPU and disk speeds, I would have figured that a gzipped stream
of text markup would be almost as good).

-tkc







-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Jon Ribbens
On 2016-04-19, Steven D'Aprano  wrote:
> On Tue, 19 Apr 2016 08:43 pm, Jon Ribbens wrote:
>> Are you saying that Usenet posts skip the moderation entirely?
>> 
>> This whole thing seems a bit of a mess. What you really need to be
>> doing is changing the Usenet group to be moderated, otherwise you're
>> going to end up with two different views supposedly of the same thing
>> which in fact may be completely different.
>
> It's worse than that. There are many other places that mirror this group,
> such as gmane, Activestate, bytes.com, gossamer-threads.com, and of course
> Google Groups. They all have their own moderation and filtering policies,
> which may differ from those of the others. Some of them may do only
> mirroring, while others (including GG and gmane) may allow posting.
>
> And yet, we manage to muddle on.

We've muddled on so far, but apparently we're just about to have
a significant change in moderation policy which sounds like it may
very well add to the confusion.

> If the plethora of mirrors with inconsistent views is the worst that
> happens to us, I for one will be amazingly happy.

Well indeed, the main reason I posted at all was because it sounded
like the new policy hadn't thought about Usenet at all and was about
to block Usenet posts completely. If that's not true then I'm more or
less happy ;-)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Marko Rauhamaa
Steven D'Aprano :

> On Mon, 18 Apr 2016 03:32 pm, Marko Rauhamaa wrote:
>> Did you get the CC, Steven.
>
> Yes I did. I frequently have people CCing me. But that's not the
> problem for me -- as I said above, it's a pain for me to SEND (not
> receive) via both email and news.

GNUS does both at once (if requested).


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Rustom Mody
On Tuesday, April 19, 2016 at 11:17:23 PM UTC+5:30, Tim Chase wrote:
> On 2016-04-19 09:46, Rustom Mody wrote:
> > inkscape
> > gimp
> > blender
> > libreoffice writer/calc/prese
> > wireshark
> > skype
> > firefox
> > audacity
> > musescore
> > totem
> > vlc
> > dia
> > 
> > Do these look like text-based apps to you?
> 
> Well, let's take a look at their native file formats:
> 
> Inkscape: SVG
> 
> Libreoffice: compressed XML
> 
> Firefox: HTML+CSS+JS
> 
> Musescore: compressed text
> 
> Dia: compressed XML
> 
> While I haven't used Musescore, I have used the others and
> hand-edited the files in each case.  Using vi/vim, or even ed(1).
> Because I can, and sometimes because I have to in order to do some
> convoluted process that would be a pain to do in a GUI.


If you think xml/html is ok as replacement for text then we have no significant 
disagreement.
That is after all the main point of
http://blog.languager.org/2012/10/html-is-why-mess-in-programming-syntax.html
viz that program texts would be better off replacing text with hypertext.
[that html = Hyper Text Markup Language adds to the snark; but does not change
 the message]

The key difference between all the above and state of art in programming
languages is that lexing, parsing is in principle and possibly in practice
'outsourced' to generic XML tools.
With programming languages these are in silos in the innards of the language
implementation.
And so people typically studying compilers etc come to think of lexing and
parsing as important/key activities
except for a few outliers like Marvin Minsky:
http://web.media.mit.edu/~minsky/papers/TuringLecture/TuringLecture.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Failed install scipy lib

2016-04-19 Thread liran . maymoni
On Tuesday, April 19, 2016 at 8:06:06 PM UTC+3, Oscar Benjamin wrote:
> On 19 Apr 2016 17:01,  wrote:
> >
> > Hello,
> > i'm trying to use:
> > "py -m pip install scipy"
> > and after couple of lines a get an error saying:
> 
> I thought that binary wheels for scipy would be available on pypi for each
> OS now. Try updating pip and then using it to install scipy.
> 
> I'm not on Windows to check myself though I'm afraid.
> 
> --
> Oscar

I tried.
updated pip but still having the same problem
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Failed install scipy lib

2016-04-19 Thread eryk sun
On Tue, Apr 19, 2016 at 12:05 PM, Oscar Benjamin
 wrote:
> On 19 Apr 2016 17:01,  wrote:
>>
>> i'm trying to use:
>> "py -m pip install scipy"
>> and after couple of lines a get an error saying:
>
> I thought that binary wheels for scipy would be available on pypi for each
> OS now. Try updating pip and then using it to install scipy.

PyPI only has Windows wheels for NumPy, not SciPy. You can use
Christoph Gohlke's unofficial packages:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Random832
On Tue, Apr 19, 2016, at 13:43, Tim Chase wrote:
> Well, let's take a look at their native file formats:
> 
> Inkscape: SVG
> 
> Libreoffice: compressed XML
> 
> Firefox: HTML+CSS+JS
> 
> Musescore: compressed text
> 
> Dia: compressed XML

None of those are "text" in the sense being discussed here, which is
"preferred method of viewing and editing is a text editor".

You could, for example, design a programming language that uses XML
markup to associate comments with specific positions in the code and the
editor displays them in little callout boxes when you hover over them
with the mouse. That's not done because of the notion that code has to
be plain text. The fact that the resulting format would still be a text
format that could theoretically be edited with a text editor isn't
relevant to this discussion.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Random832
On Tue, Apr 19, 2016, at 13:55, Jon Ribbens wrote:
> On 2016-04-19, Steven D'Aprano  wrote:
> > It's worse than that. There are many other places that mirror this group,
> > such as gmane, Activestate, bytes.com, gossamer-threads.com, and of course
> > Google Groups. They all have their own moderation and filtering policies,
> > which may differ from those of the others. Some of them may do only
> > mirroring, while others (including GG and gmane) may allow posting.
> >
> > And yet, we manage to muddle on.
> 
> We've muddled on so far, but apparently we're just about to have
> a significant change in moderation policy which sounds like it may
> very well add to the confusion.

It does look like some attention may need to be given to gmane (either
to allow posts to continue to be submitted, or to notify gmane that the
list should be put in "Non-public (posting through Gmane allowed for
list members)" mode.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Ethan Furman

On 04/19/2016 10:55 AM, Jon Ribbens wrote:

On 2016-04-19, Steven D'Aprano wrote:



And yet, we manage to muddle on.


We've muddled on so far, but apparently we're just about to have
a significant change in moderation policy which sounds like it may
very well add to the confusion.


The only thing changing is what happens if someone posts /directly/ to 
the mailing list (not through gmane, etc).


And the change is: Instead of passing the message through, with the risk 
that the poster will never see the responses), we are instead rejecting 
the post with a short explanation of how to either sign-up to the list, 
or use a mirror, etc, to interact with the list/newsgroup/mirror/whatever.



If that's not true then I'm more or less happy ;-)


Excellent.

--
~Ethan~

--
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Random832
On Tue, Apr 19, 2016, at 15:01, Ethan Furman wrote:
> The only thing changing is what happens if someone posts /directly/ to 
> the mailing list (not through gmane, etc).

Is the mailing list software able to make that distinction? I thought
that was on gmane's end.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Failed install scipy lib

2016-04-19 Thread Andrew Farrell
Hi Liran,

If your goal is simply to install SciPy on windows and not have to worry
about python packaging, your best bet is to go ahead and install Anaconda
,
which comes with SciPy and a bunch of other libraries for scientific
computing.

If you don't want all the other libraries and only want scipy, you can
also install
miniconda
 and
then run

conda install scipy

You can also create an isolated environment with

conda create --name scipy35 python=3.5 scipy
activate scipy35

All the best,
Andrew

On Tue, Apr 19, 2016 at 1:18 PM,  wrote:

> On Tuesday, April 19, 2016 at 8:06:06 PM UTC+3, Oscar Benjamin wrote:
> > On 19 Apr 2016 17:01,  wrote:
> > >
> > > Hello,
> > > i'm trying to use:
> > > "py -m pip install scipy"
> > > and after couple of lines a get an error saying:
> >
> > I thought that binary wheels for scipy would be available on pypi for
> each
> > OS now. Try updating pip and then using it to install scipy.
> >
> > I'm not on Windows to check myself though I'm afraid.
> >
> > --
> > Oscar
>
> I tried.
> updated pip but still having the same problem
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Ethan Furman

On 04/19/2016 12:05 PM, Random832 wrote:

On Tue, Apr 19, 2016, at 15:01, Ethan Furman wrote:

The only thing changing is what happens if someone posts /directly/ to
the mailing list (not through gmane, etc).


Is the mailing list software able to make that distinction? I thought
that was on gmane's end.


As far as I understand it, mirrors/usenet are either simply allowed 
through (with spam checks), or the service has it's own user account.


--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Tim Golden

On 19/04/2016 18:30, Random832 wrote:



On Tue, Apr 19, 2016, at 12:05, Steven D'Aprano wrote:

It's worse than that. There are many other places that mirror this group,
such as gmane, Activestate, bytes.com, gossamer-threads.com, and of
course
Google Groups.


Google groups goes through Usenet, and would be affected equally by any
solution to the usenet issue.

Gmane passes posts through normal email submission. It'd be mildly
irritating to have to be subscribed to be able to post through gmane,
but it wouldn't be the first group to have that requirement.

Gossamer threads and Activestate both appear to use the mailing list
archives and not allow posting.

Bytes.com appears to mirror *stack overflow*, not this list, unless I'm
missing something.


Just to be clear: GMane does some kind of header-munging to post on its 
users' behalf; GGroups comes in through usenet.


Very little is actually going to change. Really. (I'm almost sorry now I 
gave the explanation...). We're not disconnecting from Usenet, or GMane 
or anything else.


TJG
--
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Ben Finney
Rustom Mody  writes:

> On Tuesday, April 19, 2016 at 9:44:39 PM UTC+5:30, Steven D'Aprano wrote:
> > On Tue, 19 Apr 2016 01:04 pm, Rustom Mody wrote:
> > 
> > > And more generally that programmers sticking to text when rest of world
> > > has moved on is rather backward:
> > 
> > I'm pretty sure that the rest of the world has not moved on from text. 
>
> Run your popular search engine on "popular linux apps" or some such and
> you will get for example:

That supports a claim of “there are many programs available that
primarily manipulate something other than text”. You didn't make that
claim, so providing support for that is irrelevant.

Your actual claim is that “the rest of the world has moved on from
text”.

You haven't supported that claim at all, and I see endless text everyday
in “the rest of the world”. So your claim is false.

-- 
 \   “I do not believe in immortality of the individual, and I |
  `\consider ethics to be an exclusively human concern with no |
_o__)  superhuman authority behind it.” —Albert Einstein, letter, 1953 |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Chris Angelico
On Wed, Apr 20, 2016 at 6:50 AM, Ben Finney  wrote:
>> > On Tue, 19 Apr 2016 01:04 pm, Rustom Mody wrote:
>> > > And more generally that programmers sticking to text when rest of world
>> > > has moved on is rather backward:
>
> You haven't supported that claim at all, and I see endless text everyday
> in “the rest of the world”. So your claim is false.

In this part of the world, I'm seeing a lot of emails/news posts that
consist of text. How does the rest of the world discuss important
topics? Is everything done with infographics and meme pics?

ChrisA
not that this is exactly an important topic, really...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Marko Rauhamaa
Chris Angelico :

> On Wed, Apr 20, 2016 at 6:50 AM, Ben Finney 
> wrote:
>>> > On Tue, 19 Apr 2016 01:04 pm, Rustom Mody wrote:
>>> > > And more generally that programmers sticking to text when rest
>>> > > of world has moved on is rather backward:
>>
>> You haven't supported that claim at all, and I see endless text everyday
>> in “the rest of the world”. So your claim is false.
>
> In this part of the world, I'm seeing a lot of emails/news posts that
> consist of text. How does the rest of the world discuss important
> topics? Is everything done with infographics and meme pics?

The "plain text" content type is used less and less. Really it is
reserved mostly to programmers. Even texters routinely field animated
emojies nowadays.

Text, in general, might have started to decline. I'm foreseeing a
not-too-distant future where only a smallish group of trained scribes
masters reading and writing. The remainder of the population will
consume and interact with animated pictures, videos, music, games etc.
Back to ancient Egypt.

Just look at the US presidential primaries, where the political
discourse seems to be centered on grunts, melees and simple slogans:

   “We won the evangelicals,” Trump said. “We won with young. We won
   with old. We won with highly educated. We won with poorly educated. I
   love the poorly educated.”

   https://www.yahoo.com/news/trump-i-love-the-poorly-educated-144
   008662.html>

My point is not political; I'm only talking about the communication
media. The medieval populace regarded the Latin-spewing theologians with
awe. Maybe one day, the same superstitious respect will be afforded to
trained Python masters who can bend the machines to their will.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread sohcahtoa82
On Tuesday, April 19, 2016 at 1:59:48 PM UTC-7, Chris Angelico wrote:
> On Wed, Apr 20, 2016 at 6:50 AM, Ben Finney  
> wrote:
> >> > On Tue, 19 Apr 2016 01:04 pm, Rustom Mody wrote:
> >> > > And more generally that programmers sticking to text when rest of world
> >> > > has moved on is rather backward:
> >
> > You haven't supported that claim at all, and I see endless text everyday
> > in "the rest of the world". So your claim is false.
> 
> In this part of the world, I'm seeing a lot of emails/news posts that
> consist of text. How does the rest of the world discuss important
> topics? Is everything done with infographics and meme pics?
> 
> ChrisA
> not that this is exactly an important topic, really...

Personally, I prefer smoke signals.  Range is decent, but the bandwidth is 
atrocious.
-- 
https://mail.python.org/mailman/listinfo/python-list


Python path and append

2016-04-19 Thread Seymore4Head
This doesn't work.  Does Python recognize hidden directories?

handle = open("\\Winmx\New$\q.txt")
for line in handle:
line=line.strip()
print line


Traceback (most recent call last):
  File "\\Winmx\New$\add viewed.py", line 2, in 
handle = open("\\Winmx\New$\q.txt")
IOError: [Errno 2] No such file or directory: '\\Winmx\\New$\\q.txt'

What I would like to do is read a plain text file from a hidden
network drive and append a space and the * character to the end of
each line.

Would someone be so kind as to fill in the blanks to accomplish this
please?


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python path and append

2016-04-19 Thread Chris Angelico
On Wed, Apr 20, 2016 at 8:29 AM, Seymore4Head
 wrote:
>
> handle = open("\\Winmx\New$\q.txt")
> for line in handle:
> line=line.strip()
> print line
>
>
> Traceback (most recent call last):
>   File "\\Winmx\New$\add viewed.py", line 2, in 
> handle = open("\\Winmx\New$\q.txt")
> IOError: [Errno 2] No such file or directory: '\\Winmx\\New$\\q.txt'
>
> What I would like to do is read a plain text file from a hidden
> network drive and append a space and the * character to the end of
> each line.

Start with this:

print("\\Winmx\New$\q.txt")

If that doesn't do what you expect, it's possibly because you want to
use a raw string literal to prevent the backslashes from being parsed.

handle = open(r"\\Winmx\New$\q.txt")

That might help you.

(One clue that this is happening is that some of your backslashes got
doubled in the error message.)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Grant Edwards
On 2016-04-19, Random832  wrote:

> It does look like some attention may need to be given to gmane
> (either to allow posts to continue to be submitted, or to notify
> gmane that the list should be put in "Non-public (posting through
> Gmane allowed for list members)" mode.

While there is such a mode, many lists that don't accepts posts from
non-memebers never inform gmane of it.  In my experience they usually
just discard non-member posts and send an email to the poster saying
that they only accept posts from membersk.

When that happens, you join the list, turn off delivery, and then go
back to gmane and post again.

--
Grant


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Grant Edwards
On 2016-04-19, Chris Angelico  wrote:
> On Wed, Apr 20, 2016 at 6:50 AM, Ben Finney  
> wrote:
>>> > On Tue, 19 Apr 2016 01:04 pm, Rustom Mody wrote:
>>> > > And more generally that programmers sticking to text when rest of world
>>> > > has moved on is rather backward:
>>
>> You haven't supported that claim at all, and I see endless text everyday
>> in ???the rest of the world???. So your claim is false.
>
> In this part of the world, I'm seeing a lot of emails/news posts that
> consist of text. How does the rest of the world discuss important
> topics? Is everything done with infographics and meme pics?

Emojis, one would assume.

--
Grant


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Chris Angelico
On Wed, Apr 20, 2016 at 9:22 AM, Grant Edwards
 wrote:
> On 2016-04-19, Chris Angelico  wrote:
>> On Wed, Apr 20, 2016 at 6:50 AM, Ben Finney  
>> wrote:
 > On Tue, 19 Apr 2016 01:04 pm, Rustom Mody wrote:
 > > And more generally that programmers sticking to text when rest of world
 > > has moved on is rather backward:
>>>
>>> You haven't supported that claim at all, and I see endless text everyday
>>> in ???the rest of the world???. So your claim is false.
>>
>> In this part of the world, I'm seeing a lot of emails/news posts that
>> consist of text. How does the rest of the world discuss important
>> topics? Is everything done with infographics and meme pics?
>
> Emojis, one would assume.
>

What, like characters in the U+1F300-U+1F64F codepoint range?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Tim Chase
On 2016-04-19 14:54, Random832 wrote:
> On Tue, Apr 19, 2016, at 13:43, Tim Chase wrote:
> > Well, let's take a look at their native file formats:
> > Inkscape: SVG
> > Libreoffice: compressed XML
> > Firefox: HTML+CSS+JS
> > Musescore: compressed text
> > Dia: compressed XML
> 
> None of those are "text" in the sense being discussed here, which is
> "preferred method of viewing and editing is a text editor".

Well, my preferred method of "viewing" python code is /usr/bin/python

Authoring, editing, and consuming are all distinct actions.  Yes, a
lot of tools can use libpcap to interface with wireshark dumps, but
if your tool doesn't talk pcap, you can dump to plain-text (as Dennis
mentions doing...well, XML) which is the lingua franca of tool
development.

> You could, for example, design a programming language that uses XML
> markup

[shudders at remembering using a DSL "programming language" that was
XML]

-tkc


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python path and append

2016-04-19 Thread Matthew Barnett

On 2016-04-19 23:38, Chris Angelico wrote:

On Wed, Apr 20, 2016 at 8:29 AM, Seymore4Head
 wrote:


handle = open("\\Winmx\New$\q.txt")
for line in handle:
line=line.strip()
print line


Traceback (most recent call last):
  File "\\Winmx\New$\add viewed.py", line 2, in 
handle = open("\\Winmx\New$\q.txt")
IOError: [Errno 2] No such file or directory: '\\Winmx\\New$\\q.txt'

What I would like to do is read a plain text file from a hidden
network drive and append a space and the * character to the end of
each line.


Start with this:

print("\\Winmx\New$\q.txt")

If that doesn't do what you expect, it's possibly because you want to
use a raw string literal to prevent the backslashes from being parsed.

handle = open(r"\\Winmx\New$\q.txt")

That might help you.

(One clue that this is happening is that some of your backslashes got
doubled in the error message.)


when printed out:

>>> print "\\Winmx\New$\q.txt"
\Winmx\New$\q.txt

That's a file 2 directories down on the current drive.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Steven D'Aprano
On Wed, 20 Apr 2016 02:46 am, Rustom Mody wrote:

> On Tuesday, April 19, 2016 at 9:44:39 PM UTC+5:30, Steven D'Aprano wrote:
>> On Tue, 19 Apr 2016 01:04 pm, Rustom Mody wrote:
>> 
>> > And more generally that programmers sticking to text when rest of world
>> > has moved on is rather backward:
>> 
>> I'm pretty sure that the rest of the world has not moved on from text.
> 
> Run your popular search engine on "popular linux apps" or some such 

When you did that, did you do so by pointing and clicking on a menu of
symbolic icons, or by typing the text "popular linux apps"? 

When the search engine provides the search results for you, does it fetch up
a bunch of little pictures, or a list of text URLs with an extract of the
text from the site?

When I try it:

https://duckduckgo.com/html/?q=popular%20linux%20apps

I get text:

What Are The Best 10 Linux Desktop Apps?
This weekend, I'm going to be spending some time at the Southeast Linux Expo
(SCALE) and presenting at the Linux Beginner Training. I'm doing the
Desktops and ...
linux.com/learn/what-are-best-10-linux-desktop-apps

Lifehacker Pack for Linux: Our List of the Best Linux Apps
NOTE: This post is outdated. Check out the most recent Lifehacker Pack for a
more up-to-date list of essential Linux apps. Note that, unlike Windows and
OS X, Linux ...
lifehacker.com/5924951/lifehacker-pack-for-linux-our-lis...

20 Popular Ubuntu Linux Apps to Try Now | PCWorld
As Ubuntu Linux continues to grow in popularity, most discussions of it tend
to focus on the basics of the operating system itself, including
especially ...
pcworld.com/article/249663/20_popular_ubuntu_linux_ap...

and so forth.

The death of text as a communication medium is greatly exaggerated.


> and 
> you will get for example:
> 
> inkscape
[...]

How ironic that you are using a text-based medium to claim that people
have "moved on" from text. Why didn't you draw us a picture to make your
argument?



> Do these look like text-based apps to you?

Depends on what you mean by text-based.

I don't doubt that some popular applications are used for manipulating media
other than text, e.g. Gimp. But others are all about text: the two most
popular parts of the LibreOffice application suite are used for word
processing and spreadsheets, both text-based media.

Perhaps the most common use of photo editing software like Photoshop and
Gimp is to add text to images.

Even for applications that are used to generate non-text media, their UIs
are filled with text: menus and buttons display words, help screens filled
with text, status bars that display the current coordinates of the mouse as
text, dialog boxes filled with text boxes that you type into. When the UI
has controls which can be controlled by the mouse (e.g. sliders), the
control's value is usually displayed as text.

Even colour wheels invariably display their results as text, as RGB triples
or HTML codes.

You list Firefox (but neglect Thunderbird) but browsing the web is still
primarily a text-based medium. Not only is the fundamental file format of
the web (HTML) text, but the information displayed is more often than not
text. Even when the site displays non-text media, the pages usually include
a way for people to comment, which they do by clicking from a menu of
pre-defined emotions and messages displayed as icons.

Nah, just kidding. They comment by writing text.


I think that your assertion that the "rest of world has moved on" from text
to be nonsense on stilts, but *even if you were right* that doesn't imply
that programmers should do the same. Programmers operate under particular
constraints which the average podcaster or film-maker does not have to deal
with.

Just because some people communicate through the medium of interpretative
dance doesn't mean that programmers can or should.



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Steven D'Aprano
On Wed, 20 Apr 2016 04:54 am, Random832 wrote:

> None of those are "text" in the sense being discussed here, which is
> "preferred method of viewing and editing is a text editor".


That's not the sense of being discussed here. How absurd. Why should a
letter containing nothing but text be classified as "not text" because it
was written in Microsoft World or LibreOffice rather than vi or emacs?


-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Steven D'Aprano
On Wed, 20 Apr 2016 07:35 am, Marko Rauhamaa wrote:

> The "plain text" content type is used less and less. Really it is
> reserved mostly to programmers. Even texters routinely field animated
> emojies nowadays.

Who cares about "plain text" content type? That is not the beginning or end
of what counts as text. By that ridiculously limited definition, Python
progammers have already "moved on from text", because the MIME type of .py
source code is application/x-python.


> Text, in general, might have started to decline. 

o_O

People today, especially the young, probably send more text today than in
any previous time in history. You might have heard of something
called "SMSes"? Kids today spend half their day SMSing, twitting, posting
comments on Facebook, etc. 

And the other half taking selfies. *wink*

Anyone who thinks that we're heading back to hieroglyphics simply isn't
paying attention.




-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Steven D'Aprano
On Wed, 20 Apr 2016 04:54 am, Random832 wrote:

> You could, for example, design a programming language that uses XML
> markup to associate comments with specific positions in the code and the
> editor displays them in little callout boxes when you hover over them
> with the mouse. That's not done because of the notion that code has to
> be plain text.

No, it's not done because the user interface of such a language would be
absolute bollocks.


The reason programmers use text for communicating with (1) other programmers
and (2) the computer is that text is still, and probably always will be, so
much better than any other media *for the purpose of programming* as to
make it no contest.

I'm sure that interpretive dance has its uses, but can you imagine the
computer infrastructure needed to make that practical for programming?

More seriously, there have been attempts to come up with "point and click"
interfaces for programming. The idea makes a sort of sense, if you think of
programming as a flow-chart (does anyone still use them?), but outside of a
handful of specialist areas, they have been a total, utter dead-end.

So-called "visual programming environments" (think: Visual Basic) are
well-suited to laying out the interface of GUI applications. They might
even be useful for extremely limited mini-languages like regexes. I'm told
that there are still people who think that UML diagrams are a good idea.
They're probably good for dataflow programming. But ultimately, to be
productive with one, you still need text.

As for "visual programming languages" (languages with an inherent visual
form which lacks any simple or obvious text equivalent), they've been a
dead-end. Even languages like Scratch cannot do without text. Look at
the "Hello World" program here:

https://en.wikipedia.org/wiki/File:Scratch_Hello_World.png

The graphical elements are pure presentation, to make it more palatable to
children and beginners.

Don't think that I'm opposed to such visual presentations. Look at the
sample code shown at the top of the page here:

https://scratch.mit.edu/

It kinda looks like Hypertalk syntax, which some of you may remember I'm
exceedingly fond of. There's no reason why a GUI editor couldn't display
Python code using such "building block" structure. E.g. indented blocks
could use colour and shape cues to reinforce the structure of the code,
just as Scratch does.

And if you want to see another reason why text rocks as the core for
programming languages?


"Oh no! We're having trouble displaying this Scratch project.

If you are on a mobile phone or tablet, try visiting this project on a
computer.

If you're on a computer, your Flash player might be disabled, missing, or
out of date."

Yeah, thanks guys. Really helpful.



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Random832
On Tue, Apr 19, 2016, at 20:02, Tim Chase wrote:
> Well, my preferred method of "viewing" python code is /usr/bin/python
> 
> Authoring, editing, and consuming are all distinct actions. 

Viewing and executing are also distinct.

> > You could, for example, design a programming language that uses XML
> > markup
> 
> [shudders at remembering using a DSL "programming language" that was
> XML]

But I'm not proposing directly programming in XML markup. You'd use a
GUI.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Random832
On Tue, Apr 19, 2016, at 20:34, Steven D'Aprano wrote:
> That's not the sense of being discussed here.

Yes it is - this started as a discussion of whether indentation and
alignment should be based on fixed spaces (as text editors support) or
dynamic tab stops (as any word processing format supports).

> How absurd. Why should a
> letter containing nothing but text be classified as "not text" because it
> was written in Microsoft World or LibreOffice rather than vi or emacs?

Because it's not _a text file_. It's not obligated to be devoid of
formatting markup or other metadata, or to have a perfectly flat
structure, or to be edited in programs whose design has not been updated
since the early 1970s, which are _exactly_ the complaints leveled
against python source code at the start of this discussion..

__ : Python :: MS Word : Plain Text
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Chris Angelico
On Wed, Apr 20, 2016 at 11:38 AM, Steven D'Aprano  wrote:
> As for "visual programming languages" (languages with an inherent visual
> form which lacks any simple or obvious text equivalent), they've been a
> dead-end. Even languages like Scratch cannot do without text. Look at
> the "Hello World" program here:
>
> https://en.wikipedia.org/wiki/File:Scratch_Hello_World.png
>
> The graphical elements are pure presentation, to make it more palatable to
> children and beginners.
>
> Don't think that I'm opposed to such visual presentations.

Scratch itself is aimed at children, but there's a very similar
language (or maybe it's actually a Scratch derivative) used by the
Unreal Engine to animate sprites - the "blueprint" system. I've seen
it used by someone who doesn't consider herself a programmer in any
way, yet she has a sufficiently logical mind to do the same kind of
work as programming requires. Effectively, flow control has been
turned into a two-dimensional graph, with nodes pointing to other
nodes, but each node is still described primarily with text (using
colour to add instant recognition).

I think there's a lot of value in depicting flow control graphically.
For anyone who's accustomed to working visually, seeing nice little
tagged blocks of "stuff", linked by little lines to show how you get
from one to another, is way easier to handle than a page of "while"
and "if" and "else" statements. But even there, each piece of flow
control is *defined* in text - there's a short message saying what the
condition is, and then two or more pieces of text defining the
potential results of the condition, from which you can link to
destinations.

https://www.twitch.tv/ellalune/v/59455498 - starts at about the 41
minute mark. Notably, around the 00:42:30 point, I say that this is
code, and she says that, well, it sort of is code, but it doesn't
*feel* like code.

Probably the least text-y form of coding that I've ever seen is turtle
graphics, where you depict something using (usually) two dimensional
movement and rotation. But even there, it's normal to use text to
define all the actual actions. Take this, for example:

https://studio.code.org/s/frozen/reset

A nice tutorial, a theme that'll appeal to a lot of people (including
young children), and primarily point-and-click (or drag) to move
components around - but you can *read* the meaning of each component,
in *text*. Once again, it uses a visual representation of flow control
to bury some of the complexity, but the basic actions (move, turn,
etc) are text - and if you want to "capture" a series of actions to
reuse, the way to do that is to give it a name, because names and
words are how people think.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How much sanity checking is required for function inputs?

2016-04-19 Thread Christopher Reimer

On 4/19/2016 1:02 AM, Michael Selik wrote:


Why relocate rather than remove? What message would you provide that's
better than ``KeyError: 42`` with a traceback that shows exactly which
dictionary is being used and how?


I think you misread my code. No dictionary exception occurs in the 
sanity checks. Below is the full function with the revised sanity check 
for positions that compares the input list with the two valid lists of 
board positions.



def generate_set(color, positions):

if positions not in [VARS['COORDINATES'][VARS['BOARD_BOTTOM']],
 VARS['COORDINATES'][VARS['BOARD_TOP']]]:
raise Exception("List for positions contains no valid 
coordinates, "

"got {} instead.".format(positions))

# generate objects according to color and position
for position in positions:
rank, file = position
if rank in VARS['RANK_NOBILITY']:
if file in VARS['FILE_ROOK']:
yield Rook(color, position)
elif file in VARS['FILE_BISHOP']:
yield Bishop(color, position)
elif file in VARS['FILE_KNIGHT']:
yield Knight(color, position)
elif file is VARS['FILE_QUEEN']:
yield Queen(color, position)
elif file is VARS['FILE_KING']:
yield King(color, position)
else:
yield Pawn(color, position)



I meant, what goes wrong if the number of positions input is other than
16? Without these "sanity" checks, your functions might be reusable in,
say, a checkers game.


Chess has 16 pieces (six types) on each side that are set up on the 
board in a particular order. Checkers has 12 pieces (one type) on each 
side that are set up on alternating squares in no particular order. 
Since I'm writing a chess engine because it has endless supply of 
programming changes, I have no desire to write reusable code for two 
similar but different games at the same time.


Thanks,

Chris R.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Terry Reedy

On 4/19/2016 9:38 PM, Steven D'Aprano wrote:


So-called "visual programming environments" (think: Visual Basic) are
well-suited to laying out the interface of GUI applications. They might
even be useful for extremely limited mini-languages like regexes. I'm told
that there are still people who think that UML diagrams are a good idea.
They're probably good for dataflow programming. But ultimately, to be
productive with one, you still need text.

As for "visual programming languages" (languages with an inherent visual
form which lacks any simple or obvious text equivalent), they've been a
dead-end. Even languages like Scratch cannot do without text. Look at
the "Hello World" program here:

https://en.wikipedia.org/wiki/File:Scratch_Hello_World.png

The graphical elements are pure presentation, to make it more palatable to
children and beginners.


I think it is at least as important that the output is pictorial or even 
aural, then having the input text (and you are right, it is text) 
colored.  By comparison, factorial functions (and most calculation 
examples) are rather boring.



Don't think that I'm opposed to such visual presentations. Look at the
sample code shown at the top of the page here:

https://scratch.mit.edu/

It kinda looks like Hypertalk syntax, which some of you may remember I'm
exceedingly fond of. There's no reason why a GUI editor couldn't display
Python code using such "building block" structure. E.g. indented blocks
could use colour and shape cues to reinforce the structure of the code,
just as Scratch does.


That is an interesting idea.  Perhaps I have been stuck in either/or 
thinking -- either graphical or textual. With tk Text (IDLE), it would 
be possible to tag each (4-space) indent with a color for the compound 
statememt keywork causing the indent.



And if you want to see another reason why text rocks as the core for
programming languages?


"Oh no! We're having trouble displaying this Scratch project.

If you are on a mobile phone or tablet, try visiting this project on a
computer.

If you're on a computer, your Flash player might be disabled, missing, or
out of date."


I had to enable Flash for this site.  What are they going to do when 
Flash is dead rather than just dying?  (Get with html5, perhaps?)



Yeah, thanks guys. Really helpful.


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Chris Angelico
On Wed, Apr 20, 2016 at 1:23 PM, Terry Reedy  wrote:
>> It kinda looks like Hypertalk syntax, which some of you may remember I'm
>> exceedingly fond of. There's no reason why a GUI editor couldn't display
>> Python code using such "building block" structure. E.g. indented blocks
>> could use colour and shape cues to reinforce the structure of the code,
>> just as Scratch does.
>
>
> That is an interesting idea.  Perhaps I have been stuck in either/or
> thinking -- either graphical or textual. With tk Text (IDLE), it would be
> possible to tag each (4-space) indent with a color for the compound
> statememt keywork causing the indent.
>

Interesting indeed! Tell me if I've understood you correctly. You'd
display this code:

def func(x):
for n in range(1, x):
while n < x:
if n % 2:
n = (n + 1) * 3 / 2
else:
n = n * 2 + 3

with stripes of colour, with the entire first column of spaces all
tied to the "def", and then the next block of four tied to the "for",
etc? That'd be pretty cool, and a neat way to help people transfer
their skills from Scratch to Python.

(Would "else" be in the same colour as "if"? What about "elif"?)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How much sanity checking is required for function inputs?

2016-04-19 Thread Chris Angelico
On Wed, Apr 20, 2016 at 12:20 PM, Christopher Reimer
 wrote:
> I think you misread my code. No dictionary exception occurs in the sanity
> checks. Below is the full function with the revised sanity check for
> positions that compares the input list with the two valid lists of board
> positions.
>
>
> def generate_set(color, positions):
>
> if positions not in [VARS['COORDINATES'][VARS['BOARD_BOTTOM']],
>  VARS['COORDINATES'][VARS['BOARD_TOP']]]:
> raise Exception("List for positions contains no valid coordinates, "
> "got {} instead.".format(positions))
>
> # generate objects according to color and position
> for position in positions:
> rank, file = position
> if rank in VARS['RANK_NOBILITY']:
> if file in VARS['FILE_ROOK']:
> yield Rook(color, position)
> elif file in VARS['FILE_BISHOP']:
> yield Bishop(color, position)
> elif file in VARS['FILE_KNIGHT']:
> yield Knight(color, position)
> elif file is VARS['FILE_QUEEN']:
> yield Queen(color, position)
> elif file is VARS['FILE_KING']:
> yield King(color, position)
> else:
> yield Pawn(color, position)
>

If you nuke the check at the beginning, what happens? (By the way, I
don't like this shouty "VARS" thing you have going on. It makes it
hard to skim the code. I'm not entirely sure what your initial "not
in" check is even doing.) You seem to have two slightly different ways
of checking things: first something about BOARD_TOP and BOARD_BOTTOM,
and then something else about RANK_NOBILITY and... everything else. It
looks to me like all you need is to have a second check for
RANK_PAWNS, and then raise an exception if it's neither of those. Then
you don't need to pre-check, and the rules aren't split into two
places.

But if I were doing this, I'd make it far more data-driven.

starting_positions = {
VARS['FILE_ROOK']: Rook,
VARS['FILE_BISHOP']: Bishop,
...
}

Or, even better, tie that to the definitions of your classes, in some
way. (Metaprogramming is great here.) Then your code doesn't need an
if/elif tree; you can generate starting positions easily by just
looking up your table.

BTW, it's usually best to not raise Exception, but a custom subclass
of it. But I'm going to assume that this is just an example.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Rustom Mody
On Wednesday, April 20, 2016 at 12:25:09 AM UTC+5:30, Random832 wrote:
> On Tue, Apr 19, 2016, at 13:43, Tim Chase wrote:
> > Well, let's take a look at their native file formats:
> > 
> > Inkscape: SVG
> > 
> > Libreoffice: compressed XML
> > 
> > Firefox: HTML+CSS+JS
> > 
> > Musescore: compressed text
> > 
> > Dia: compressed XML
> 
> None of those are "text" in the sense being discussed here, which is
> "preferred method of viewing and editing is a text editor".

O you are so pedestrian!
Here let me show you how to enjoy beethoven9th.mp3 with emacs:

$ python -m base64 beethoven9th.mp3 > beethoven9th.txt; emacs beethoven9th.txt

Isnt it glorious?
And did you note the çhiɕ, pànacɦe and eĺan with with I demonstrated it?

[Yeah you guessed right: For me French consists of English ...um text.. with a 
squiggle
on every 3rd letter]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Rustom Mody
On Wednesday, April 20, 2016 at 6:33:33 AM UTC+5:30, Steven D'Aprano wrote:
> Anyone who thinks that we're heading back to hieroglyphics simply isn't
> paying attention.

Which are just text in the range 13000-1342F:
http://unicode.org/charts/PDF/U13000.pdf
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How much sanity checking is required for function inputs?

2016-04-19 Thread Michael Selik
On Tue, Apr 19, 2016 at 11:23 PM Christopher Reimer <
christopher_rei...@icloud.com> wrote:

> On 4/19/2016 1:02 AM, Michael Selik wrote:
>
> > Why relocate rather than remove? What message would you provide that's
> > better than ``KeyError: 42`` with a traceback that shows exactly which
> > dictionary is being used and how?
>
> I think you misread my code. No dictionary exception occurs in the
> sanity checks. Below is the full function with the revised sanity check
> for positions that compares the input list with the two valid lists of
> board positions.
>

Perhaps I did misread it. What is the purpose of the "sanity check"? If
it's not obvious I suggest revising the code rather than adding comments.

The first time I read your code, I thought the check was designed to avoid
the possibility of a KeyError a few lines later. My suggestion was to
simply allow bad inputs to cause KeyErrors and not clutter your code. This
second time I'm reading, it seems to be a sort of boundary check, but using
``in`` which would cause a bug... Did you mean to use an inequality?


> > I meant, what goes wrong if the number of positions input is other than
> > 16? Without these "sanity" checks, your functions might be reusable in,
> > say, a checkers game.
>
> I have no desire to write reusable code for two
> similar but different games at the same time.
>

Reusability is a nice side-effect of fewer "sanity checks". Other goals are
clarity, efficiency, and productivity.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How much sanity checking is required for function inputs?

2016-04-19 Thread Stephen Hansen
On Sun, Apr 17, 2016, at 12:34 PM, Christopher Reimer wrote:
>  if color not in [VARS['COLOR_BLACK'], VARS['COLOR_WHITE']]:
>  raise Exception("Require \'{}\' or \'{}\' for input value, got 
> \'{}\' instead.".format(VARS['COLOR_BLACK'], VARS['COLOR_WHITE'], color))

Do you think it likely you'll receive a 'color' value not in the list of
black and white? Are you accepting colors from users? If you are, I'd
sanity check *at user input*. Users are crazy, sanitize and check the
heck out of their stuff.

Your code, though? Your time and effort is better spent putting in a
docstring documenting what's valid in color, and if some other coder
puts in red, why, they'll get a KeyError, and it'll point to precisely
what line is wrong, and be able to figure it out.

Unit tests are where you try feeding invalid data into functions and see
how they react-- and the correct reaction to bad data is usually
exceptions. In this case, a KeyError thrown by [VARS['COLOR_BLACK'],
VARS['COLOR_WHITE']][color] is more descriptive then your verbose
Exception.

(What's with the VARS business? Something smells bad there. You're doing
something weird there)

> How much sanity checking is too much in Python?

IMHO, you've got too much.

But that's a fuzzy question, there's no solid and clear answer. Did you
see Ethan's response? I largely agree with his trinity:

On Sun, Apr 17, 2016, at 10:26 PM, Ethan Furman wrote:
> I sanity check for three reasons:
> 
> 1) raise a nicer error message
> 
> 2) keep the point of failure close to the error
> 
> 3) the consequences of bad data are Bad Bad Things (tm)

With a 4)th that exceptions aren't for users, only programmers. But
ultimately, I'd rather a user see an exception if something weird goes
wrong because they can send it to me and I can diagnose it and push an
update. So I also:

4) Attempt to make sure all user errors result in user error messages,
not exceptions.

Note, 1) doesn't mean I always raise a nicer message, it means if
"KeyError" is ambiguious or odd, I raise a better and more informative
one. But you're getting nothing swapping out KeyError for
Exception(lotsofwords). 

I use 1) more to be less 'nicer' and more, er, 'more specific'. Since I
don't like exceptions to rise to the user level where niceness is
needed.

--Stephen
m e @ i x o k a i . i o
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How much sanity checking is required for function inputs?

2016-04-19 Thread Ethan Furman

On 04/19/2016 10:51 PM, Stephen Hansen wrote:


But that's a fuzzy question, there's no solid and clear answer. Did you
see Ethan's response? I largely agree with his trinity:

On Sun, Apr 17, 2016, at 10:26 PM, Ethan Furman wrote:

I sanity check for three reasons:

1) raise a nicer error message

2) keep the point of failure close to the error

3) the consequences of bad data are Bad Bad Things (tm)


With a 4)th that exceptions aren't for users, only programmers. But
ultimately, I'd rather a user see an exception if something weird goes
wrong because they can send it to me and I can diagnose it and push an
update. So I also:

4) Attempt to make sure all user errors result in user error messages,
not exceptions.

Note, 1) doesn't mean I always raise a nicer message, it means if
"KeyError" is ambiguious or odd, I raise a better and more informative
one. But you're getting nothing swapping out KeyError for
Exception(lotsofwords).

I use 1) more to be less 'nicer' and more, er, 'more specific'. Since I
don't like exceptions to rise to the user level where niceness is
needed.


Yeah, that's a better phrasing for (1); I meant more appropriate or 
informative, such as swapping an internal error (such as KeyError) for a 
more meaningful FieldNotFound error (or whatever) -- largely library 
code concerns.


--
~Ethan~

--
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Terry Reedy

On 4/19/2016 11:41 PM, Chris Angelico wrote:

On Wed, Apr 20, 2016 at 1:23 PM, Terry Reedy  wrote:

It kinda looks like Hypertalk syntax, which some of you may remember I'm
exceedingly fond of. There's no reason why a GUI editor couldn't display
Python code using such "building block" structure. E.g. indented blocks
could use colour and shape cues to reinforce the structure of the code,
just as Scratch does.



That is an interesting idea.  Perhaps I have been stuck in either/or
thinking -- either graphical or textual. With tk Text (IDLE), it would be
possible to tag each (4-space) indent with a color for the compound
statememt keywork causing the indent.



Interesting indeed! Tell me if I've understood you correctly. You'd
display this code:

def func(x):
for n in range(1, x):
while n < x:
if n % 2:
n = (n + 1) * 3 / 2
else:
n = n * 2 + 3

with stripes of colour, with the entire first column of spaces all
tied to the "def", and then the next block of four tied to the "for",
etc?


Exactly.

> That'd be pretty cool, and a neat way to help people transfer

their skills from Scratch to Python.

(Would "else" be in the same colour as "if"? What about "elif"?)


To be determined ;-).  Perhaps different shades.  Scratch uses one color 
for all control: while, if, else, but that would not work for python 
with so much more nesting.  Scratch needs different colors for much 
broader categories as many are not for syntax but for groups of 
functions that in Python would be in imported modules.  I would like 
nested for loops to have slightly different shades, but I would not 
necessarily start with that, unless each compound statement got a new 
tag and color.


What makes the idea not completely ridiculous is that IDLE already keeps 
track of indents for its smart indenting and code context features.


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: How much sanity checking is required for function inputs?

2016-04-19 Thread Stephen Hansen
On Tue, Apr 19, 2016, at 11:09 PM, Ethan Furman wrote:
> On 04/19/2016 10:51 PM, Stephen Hansen wrote:
> > I use 1) more to be less 'nicer' and more, er, 'more specific'. Since I
> > don't like exceptions to rise to the user level where niceness is
> > needed.
> 
> Yeah, that's a better phrasing for (1); I meant more appropriate or 
> informative, such as swapping an internal error (such as KeyError) for a 
> more meaningful FieldNotFound error (or whatever) -- largely library 
> code concerns.

Yeah, and what the OP is doing is going the exact opposite-- from a
more-specific exception (KeyError) to a more generic one (Exception).

To me that's (usually) an anti-pattern. 

--S
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Gregory Ewing

Rustom Mody wrote:

On Wednesday, April 20, 2016 at 6:33:33 AM UTC+5:30, Steven D'Aprano wrote:


Anyone who thinks that we're heading back to hieroglyphics simply isn't
paying attention.



Which are just text in the range 13000-1342F:
http://unicode.org/charts/PDF/U13000.pdf


Moreover, the Egyptian heiroglyphs are *not* pictograms,
they're a phonetic alphabet. It's a textual form of
writing just as much as ours is.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list