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

2014-03-30 Thread Mark H Harris

On 3/29/14 6:59 AM, Marko Rauhamaa wrote:

I hate localization. You get a error message in Finnish from make or
grep and then you try to google it.

So mine is en_US, but I know people who do fi_FI.


... this is my point precisely.


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


Re: checking if two things do not equal None

2014-03-30 Thread Steven D'Aprano
On Sat, 29 Mar 2014 19:54:09 -0700, Rustom Mody wrote:

 On Sunday, March 30, 2014 8:09:45 AM UTC+5:30, Roy Smith wrote:
 I have no particular problem with
 
  x  2  y
 
 because it fits the same pattern.  But, if you show me
 
  a != None != b:
 
 my brain just goes into overload.  Honestly, I don't even know what
 that means.  My brain keeps trying to stick a, None, and b on Mrs.
 Albaum's number line and keeps walking into the wall.  If you (the
 editorial you) tell me that my failure to grok that expression means
 I'm not fluent in Python, well then, guilty as charged.
 
 Math Terminology
[...]
 So for != chained comparisons are not natural (or IMHO appropriate)

I tend to agree they're not natural, although appropriate is another 
thing. The problem is that we tend to read something like:

a != b != c

as all of a, b and c are unequal, corresponding to:

a == b == c

as all of a, b and c are equal. But that's not what it means. It means 
that a != b and b != c, but it says nothing about a and c. And that was 
my mistake. The OP actually got it right in their first post, but 
sticking None in the middle to ensure it partakes of both comparisons.

a is not None is not b

Still, that's not easily extended to a third item, this would be wrong:

a is not None is not b is not c

since c only gets compared against b, not None. Better is to factor the 
not out:

not (a is b is c is None)


which now should be clear: you're testing whether or not *all* of a, b 
and c are None. If you prefer:

not all(x is None for x in (a, b, c))


Which is more readable is a matter of personal preference.

I think Johannes got it right: boolean logic is easier to reason about 
when there is a minimum of nots.


-- 
Steven D'Aprano
http://import-that.dreamwidth.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: checking if two things do not equal None

2014-03-30 Thread Chris Angelico
On Sun, Mar 30, 2014 at 4:54 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 On Sun, 30 Mar 2014 13:15:18 +1100, Chris Angelico wrote:

 Chained comparisons where you're checking a single variable against two
 constants make perfect sense:

 2  x  5

 Chained comparisons where you check a single constant against two
 variables don't, so much:

 x  2  y

 What exactly does that mean, and why is it written that way?

 It checks that 2 is strictly bounded between x on the left and y on the
 right, i.e. that 2 is inside the open interval x...y. I don't know why
 you think that's unclear. But then I do have a maths background and I'm
 used to chaining comparisons.

 Write it like this:

 low = x
 high = y
 a = 2

 low  a  high

 Does that make more sense? Well-chosen names are good. The fact that a is
 a constant rather than a variable is no big deal:

 low  2  high

The problem isn't that I can't see what the comparisons are. It makes
very good sense to bound a variable within constants; but you already
know exactly where 2 is on the number line, so asking Is 2 between
these two variables seems a bit odd. Maybe it's less so with the
strong mathematical background, but it seems odd to me.

 It'd be more useful but less clear if one of the conditions points the
 other way:

 x  2  y

 which checks that they're both less than two,

 which is quite different from what you wrote the first time.


 but IMO in a less-than-clear way.

 That's an understatement. If I saw code chaining comparisons in that
 fashion, I would assume the second operator  was a typo.

 Chaining less-than and greater than operators should, for clarity, always
 be written in a single order. E.g. a = b  c  d, not a = b  d  c.

 (The second contains a subtle bug too.)

Agreed.

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


Re: unicode as valid naming symbols

2014-03-30 Thread Gregory Ewing

Chris Angelico wrote:

a 5x8 bitmap has
forty pixels, any of which can be either on or off - that gives
roughly twice as much data space as the 21-bit Unicode spec.


We don't need a font, then -- just map the pixels
straight onto bits in the character code!

Might require some user re-education, but that's
a small price to pay for saving so much memory
space.

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


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

2014-03-30 Thread Mark H Harris

On 3/29/14 12:53 PM, Steven D'Aprano wrote:

People have had localised code pages, and localised keyboards to enter
characters in those code pages, for up to 30 years, if not longer.


   Nobody is arguing otherwise, Steven. Having a code page for a local 
language is not the same thing as having software that supports your 
local language code page! Software and code pages improved over time, 
but international communication (which is what I'm talking about) has 
always been done in English, using ASCII. Well except when Guido brought 
the ABC stuff to the states back in the day and had no way to do that 
except to fly himself (and the tape) personally.


In some of those cases, the localisation was done by companies like IBM,
Microsoft and Apple, realising that if they wanted to sell computers
outside of the US, they needed to supply computers that were localised to
their market.


   Unfortunately that happened way late. And even then, international 
communication was still done (and is still done) in English. Only until 
very recently (see my post to Chris) has unicode improved to the point 
where international comm can occur reliably enough (input, font, code 
points) to allow comm in languages other than English. And yet, although 
Kanji has been around for a while, most international comm is still 
handled in English because its the lingua franca.




This code page system actually worked pretty well, so long as you only
exchange documents with people using the same code page. Until the
Internet, that was mostly the case.


   My point exactly. With the advent of the Internet, almost *all* comm 
is English with minor notable exceptions in today's environment. Just 
look around, you need not argue with me. You can find places for local 
comm, but they are sparse.





That's why they called it ASCII American Standard
Code for Information Interchange...


Yes. So what? Just because ASCII exists doesn't mean everyone uses it
*exclusively*.


   Yeah, well, that's exactly what happened; its still happening. Only 
today its UTF-8, a Latin script (there is only one) and thousands of 
people all over the earth on the Internet speaking English around the 
globe.  Yeah, I know, there are localized pockets and people using their 
computer in their heart language, but for international communication 
you're going to find (primarily) people communicating in English.



With the demise of EBCDIC as the standard character encoding (actually
plural encodings, because EBCDIC has code pages too),


   Ha!  That's funny.   EBCIDIC is | was  standard only at IBM. Those 
stubborn people (I used to be one of them) stuck with EBCIDIC and 
SNA/SDLC until they realized that they could not communicate with the 
rest of the world using ASCII and TCP/IP.  ... just hilarious!



ASCII has become
the lowest common denominator for most (but not all) character sets. Pre-
Unicode, most (but definitely not all!) code pages were based on ASCII,
either with a few changes, or extending it to a full 8 bits.


   Yup.


But that's the point:


   Yes it is.


most people with access to computing in the first
place, also had access to input methods and code pages for their native
language. Your idea that they were forced to use ASCII exclusively, with
no way of entering their own language, is simply wrong.


   I'm not arguing that, Steven. You're just being silly. I'm talking 
about be forced to communicate around the world when most of the people 
communicating are speaking English and using ASCII.
   Look, I can unplug my computer from the Internet and use it to 
translate biblical Greek and O.T. Hebrew and be happy as a clam that I'm 
locally doing my own thing in my own language (so what)? The moment I 
want to communicate outside my local space I better know English, and I 
better have a code page that supports it.
   If you live in Israel, and only communicate with people in Israel, 
you can use your modern Hebrew font and code page and be happy as a 
clam; but if you want to communicate with somebody in IOWA, perhaps Iowa 
State for some reason, you better know English. Just say'n.
   On the other hand, just look around  the Internet. 98% of all 
communication is English using UTF-8 today. Yes, you can find pockets 
where this is not true, but primarily, the world is using a modern 
lingua franca.


   I am very interested with the intense interest in this topic.


marcus

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


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

2014-03-30 Thread Steven D'Aprano
On Sun, 30 Mar 2014 00:52:20 -0500, Mark H Harris wrote:

 On 3/29/14 10:45 AM, Mark Lawrence wrote:
 On 29/03/2014 08:21, Mark H Harris wrote:

 Yes. Well, as the joke goes, if you're trilingual you speak three
 languages, if you're bilingual you speak two languages, if you're
 monolingual you're an American (well, that might go for Australia too,
 maybe). When whole continents speak the same language that tends to
 happen.

 You mean like the USA, where I saw an ad in a shop for a bilingual shop
 assistant?  Or is Spanish so like US English it doesn't count as a
 separate language?
 
 I'm not sure what point you are trying to make. We have people here from
 all over the earth, and enough illegal immigrants speaking Spanish to
 account for a population about the size of Ohio.

*raises eyebrow*

Did you intend to imply that it is only illegal immigrants who speak 
Spanish in the USA?

The most recent US census found there are 38.5 million people in the US 
who primarily speak Spanish, and 45 million who speak it as their first 
or second language. In comparison, there are only an estimated 11 million 
illegal immigrants (of which only 7 million is from Mexico).

https://en.wikipedia.org/wiki/Spanish_language_in_the_United_States



-- 
Steven D'Aprano
http://import-that.dreamwidth.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-03-30 Thread Chris Angelico
On Sun, Mar 30, 2014 at 5:31 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 Did you intend to imply that it is only illegal immigrants who speak
 Spanish in the USA?

I think he's correct there. After all, anyone who doesn't fit the
white-skinned monolingual (barely-one-language, really) middle-class
stereotype *MUST* be an illegal immigrant - right? That's how you
recognize who to be rude to.

http://notalwaysright.com/pepperoni-extremism/3163
http://notalwaysright.com/no-obamacare-for-you/17102
http://notalwaysworking.com/they-are-rotten-to-the-corps-part-2/32108
... and plenty more stories besides.

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


Re: checking if two things do not equal None

2014-03-30 Thread Gregory Ewing

Roy Smith wrote:

But, if you show me

 a != None != b:

my brain just goes into overload.


Chained comparisons get weird with not-equal operators.
If you see

  a == b == c

then it implies that a == c, but

  a != b != c

does *not* imply that a != c. At least it doesn't in
Python; I've never seen any mathematicians write that, so
I don't know what they would make of it.

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


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

2014-03-30 Thread Mark H Harris

On 3/30/14 1:31 AM, Steven D'Aprano wrote:

I'm not sure what point you are trying to make. We have people here from
all over the earth, and enough illegal immigrants speaking Spanish to
account for a population about the size of Ohio.


*raises eyebrow*

Did you intend to imply that it is only illegal immigrants who speak
Spanish in the USA?


   Don't be silly, Steven, it doesn't become you.


The most recent US census found there are 38.5 million people in the US
who primarily speak Spanish, and 45 million who speak it as their first
or second language. In comparison, there are only an estimated 11 million
illegal immigrants (of which only 7 million is from Mexico).

https://en.wikipedia.org/wiki/Spanish_language_in_the_United_States


   Hilarious!   That's part of the problem, um, its because they are 
*illegal* that the census bureau does not know about them in terms of 
exact numbers; its a nice effort though.


   America is a melting pot (always has been). We have thousands of 
ethnic groups living here and thousands of languages spoken here. All of 
them are in some place on the continuum of English as a second language; 
its the only way to survive here.



marcus


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


Re: checking if two things do not equal None

2014-03-30 Thread Ben Finney
Chris Angelico ros...@gmail.com writes:

 The problem isn't that I can't see what the comparisons are. It makes
 very good sense to bound a variable within constants; but you already
 know exactly where 2 is on the number line, so asking Is 2 between
 these two variables seems a bit odd. Maybe it's less so with the
 strong mathematical background, but it seems odd to me.

I don't feel odd about asking the question “Is 2 between these two
values?”. It's straightforward and concise. Can you explain better why
you find it odd?

-- 
 \ “You are welcome to visit the cemetery where famous Russian and |
  `\Soviet composers, artists, and writers are buried daily except |
_o__)   Thursday.” —Russian orthodox monastery, Moscow |
Ben Finney

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


Re: Keyboard standards

2014-03-30 Thread Larry Hudson

On 03/29/2014 12:41 PM, Michael Torrie wrote:

On 03/29/2014 01:27 PM, Larry Hudson wrote:

On 03/28/2014 09:26 PM, Mark H Harris wrote:


PS   Thunderbird puts *both* the list and the news group addys in the to: 
header field on
reply-to-list.   ~nice, huh.


Must be the way YOU set it up.  MY Thunderbird (currently version 24.4.0 on 
Mint Linux 16)
doesn't do any such thing.  Besides, Reply sends private e-mail to the poster -- 
Followup
sends to the newsgroup.


No, Mark describes the standard way Thunderbird works.  Reply-to-List
does what he says it does. Not sure why your installation works
differently.  I guess maybe you are talking about something different.
The mailing list vs the NNTP list.

You're right -- I use the NNTP list only.  I've never looked at the Python mailing list.  The 
very few mailing lists I subscribe to, I only read--never reply to.  Come to think of it, 
currently there's only one, and I rarely do more than skim it briefly--and frequently not even 
that.  I should drop it altogether, just haven't bothered to do so.


 -=- Larry -=-

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


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

2014-03-30 Thread Larry Hudson

On 03/29/2014 10:52 PM, Mark H Harris wrote:

On 3/29/14 10:45 AM, Mark Lawrence wrote:

On 29/03/2014 08:21, Mark H Harris wrote:


Yes. Well, as the joke goes, if you're trilingual you speak three
languages, if you're bilingual you speak two languages, if you're
monolingual you're an American (well, that might go for Australia too,
maybe). When whole continents speak the same language that tends to
happen.


You mean like the USA, where I saw an ad in a shop for a bilingual shop
assistant?  Or is Spanish so like US English it doesn't count as a
separate language?


I'm not sure what point you are trying to make. We have people here from all 
over the earth, and
enough illegal immigrants speaking Spanish to account for a population about 
the size of Ohio.
But, Americans are mostly monolingual. ...point of fact.



I believe the point is your generalized use of American.  After all, Mexicans are Americans 
too, as well as Canadians, Peruvians and ...


Unfortunately, there is no good word for USA-ian.  United States Citizen is too long and 
awkward and United Statesian is ridiculous.  The common usage of American for this is at 
best ambiguous, and definitely inaccurate (as well as chauvinistic, and rather insulting to 
other North and South Americans outside the US).


 -=- Larry -=-

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


Re: checking if two things do not equal None

2014-03-30 Thread Chris Angelico
On Sun, Mar 30, 2014 at 5:52 PM, Ben Finney ben+pyt...@benfinney.id.au wrote:
 Chris Angelico ros...@gmail.com writes:

 The problem isn't that I can't see what the comparisons are. It makes
 very good sense to bound a variable within constants; but you already
 know exactly where 2 is on the number line, so asking Is 2 between
 these two variables seems a bit odd. Maybe it's less so with the
 strong mathematical background, but it seems odd to me.

 I don't feel odd about asking the question “Is 2 between these two
 values?”. It's straightforward and concise. Can you explain better why
 you find it odd?

Possibly because the variable between two constants is something
I've done often (usually in the more explicit form of x  min  x 
max in a language without chained comparisons), usually
bounds-checking some value. I've never had to ask whether a single
constant has two variables, one on either side. But that's just that
I've personally never done it; it doesn't mean nobody does it, by any
means.

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


Re: checking if two things do not equal None

2014-03-30 Thread Marko Rauhamaa
Gregory Ewing greg.ew...@canterbury.ac.nz:

   a != b != c

 does *not* imply that a != c. At least it doesn't in Python; I've
 never seen any mathematicians write that, so I don't know what they
 would make of it.

Any resemblance between mathematics notation and Python is purely
coincidental. I must admit I had missed Python's chained comparisons
until this discussion, but now I looked up the definition:

comparison::=  or_expr ( comp_operator or_expr )*
comp_operator ::=   |  | == | = | = | !=
   | is [not] | [not] in

[...]

Formally, if a, b, c, ..., y, z are expressions and op1, op2, ...,
opN are comparison operators, then a op1 b op2 c ... y opN z is
equivalent to a op1 b and b op2 c and ... y opN z, except that each
expression is evaluated at most once.


That means, in my opinion, that you should feel free to use chaining any
way you see fit. Also, the rule is crystal-clear and easy to grasp:
there's an implicit and there.

It's another thing, then, if it was a good idea to include chaining
there in the first place, but I trust the idea was properly vetted and
double checked against possible parsing ambiguities.

Even without chaining is not is a bit suspect:

 False is not 0
True
 False is (not 0)
False
 False is not not not 0
  File stdin, line 1
False is not not not 0
   ^
SyntaxError: invalid syntax



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


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

2014-03-30 Thread Steven D'Aprano
On Sun, 30 Mar 2014 01:48:27 -0500, Mark H Harris wrote:

 On 3/30/14 1:31 AM, Steven D'Aprano wrote:
 I'm not sure what point you are trying to make. We have people here
 from all over the earth, and enough illegal immigrants speaking
 Spanish to account for a population about the size of Ohio.

 *raises eyebrow*

 Did you intend to imply that it is only illegal immigrants who speak
 Spanish in the USA?
 
 Don't be silly, Steven, it doesn't become you.

Given the sorts of patronising, condescending things you insist are true 
about non-Americans, such as their supposed inability to communicate in 
their own language on the Internet, I wasn't sure.

 The most recent US census found there are 38.5 million people in the US
 who primarily speak Spanish, and 45 million who speak it as their first
 or second language. In comparison, there are only an estimated 11
 million illegal immigrants (of which only 7 million is from Mexico).

 https://en.wikipedia.org/wiki/Spanish_language_in_the_United_States
 
 Hilarious!   That's part of the problem, um, its because they are
 *illegal* that the census bureau does not know about them in terms of
 exact numbers; its a nice effort though.

The number of illegal immigrants is not estimated from the Census numbers 
directly. It's not like they have a tick box Are you in this country 
illegally?.

Just because *you* don't know how illegal immigrant numbers are 
estimated, or what margin of error those estimates might have, don't make 
the mistake of imagining that any such effort is hilarious, a joke, or 
otherwise useless. Naturally the figure is *estimated*, I even said it 
was estimated, and gave it as a round number.

If I had said there were 11,205,971 illegal immigrants in the USA as of 
last Tuesday, then you would have a good excuse to mock my spurious 
precision. Otherwise, not so much.


 America is a melting pot (always has been). We have thousands of
 ethnic groups living here and thousands of languages spoken here.

Not really. There are under 350 languages spoken in the USA. Over 92% of 
the population speaking just two of them, English and Spanish, with 
Chinese a *very* distant third. Only eight languages are spoken by more 
than 1 million people. Even if you double that figure, to capture that 
one guy who speaks Gunwinyguan and other outliers, you still end up well 
under even a single thousand.

The surprising thing to me about this is not that the number of languages 
is so low (there are about 6000-7000 languages in the world), but that it 
is so high. I would have predicted well under 100. After all, spoken 
language popularity is an excellent example of network effects: the more 
people who speak a language, the more valuable it is to speak the same 
language.

Network effects explain why, out of the six or seven thousand languages 
in the world, just thirteen account for more than half the world's 
population:

1) Mandarin
2) Spanish
3) English
4) Hindi
5) Arabic
6) Portuguese
7) Bengali
8) Russian
9) Japanese
10) Punjabi
11) German
12) Javanese
13) Wu

adding up to 51%. The next thirteen bring the total to 64%.

(Figures are, naturally, approximate and subject to change.)


 All of
 them are in some place on the continuum of English as a second language;
 its the only way to survive here.

Approximately 5% of the US population either do not speak English at all, 
or speak it poorly. That includes approximately half a million ASL 
speakers (American Sign Language, which is not a manual representation of 
English but an independent language in it's own right), the majority of 
whom are unable to speak or understand spoken English.

Be careful of making sweeping generalisations like the only way to 
survive. Especially when they're so judgemental. It's not like there are 
gangs of armed militia hunting down deaf children and foreign grannies 
who only speak the language of their homeland. Well, maybe in Arizona.

*wink*



-- 
Steven D'Aprano
http://import-that.dreamwidth.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-03-30 Thread Steven D'Aprano
On Sun, 30 Mar 2014 00:32:58 -0700, Larry Hudson wrote:

 Unfortunately, there is no good word for USA-ian.  United States
 Citizen is too long and awkward and United Statesian is ridiculous. 
 The common usage of American for this is at best ambiguous, and
 definitely inaccurate (as well as chauvinistic, and rather insulting to
 other North and South Americans outside the US).

Among fans of the British writer Terry Pratchett, the usual term is 
Merkins. Including among Merkin fans.



-- 
Steven D'Aprano
http://import-that.dreamwidth.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-03-30 Thread Chris Angelico
On Sun, Mar 30, 2014 at 9:35 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 Network effects explain why, out of the six or seven thousand languages
 in the world, just thirteen account for more than half the world's
 population:

 1) Mandarin
 2) Spanish
 3) English
 4) Hindi
 5) Arabic
 6) Portuguese
 7) Bengali
 8) Russian
 9) Japanese
 10) Punjabi
 11) German
 12) Javanese
 13) Wu

 adding up to 51%. The next thirteen bring the total to 64%.

Where did that info come from? And more importantly, what does it
count? Is that people's first language, or all languages known, or
what? A bit of Googling brought me to a Wikipedia page [1] which
quotes a similar figure of thirteen languages; that's talking about
native speakers, and is talking about native speakers. But that may
not be the most useful definition here.

An alternative useful definition is accessibility: if you
communicate a message in Mandarin and English, a large proportion of
humans will be capable of understanding that message. Does it take the
above thirteen to exceed 50% of the world by that definition? Or
wording it another way, is there no set of twelve or less languages
which will reach 50% of the world? There's another Wikipedia page [2]
that tries to estimate total number of speakers, but it's nearly
impossible to get any sort of accurate figure; it puts Mandarin at
somewhere over a billion people, and English as another billion or so;
that's coming up toward 50% right there (say, 1.5b each is 3b, out of
a world population of 7b). Ball-park figures, those two plus Spanish
(another half billion or so) would pretty much hit your half mark.

I've no idea what point I'm trying to make here. Just poking around
with numbers. :)

ChrisA

[1] https://en.wikipedia.org/wiki/List_of_languages_by_number_of_native_speakers
[2] https://en.wikipedia.org/wiki/List_of_languages_by_total_number_of_speakers
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-03-30 Thread Roy Smith
In article j8-dne29t9g2varonz2dnuvz_qsdn...@giganews.com,
 Larry Hudson org...@yahoo.com wrote:

 I believe the point is your generalized use of American.  After all, 
 Mexicans are Americans too, as well as Canadians, Peruvians and ...
 
 Unfortunately, there is no good word for USA-ian.

I believe Mexicans refer to us as norteamericanos in polite company.  
That's a little long for daily use, so more typically it's shortened to 
gringo.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: checking if two things do not equal None

2014-03-30 Thread Roy Smith
In article 5337b4e4$0$29994$c3e8da3$54964...@news.astraweb.com,
 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:

 I think Johannes got it right: boolean logic is easier to reason about 
 when there is a minimum of nots.

I used to do a lot of digital logic design.  In certain logic families, 
it's easier to build a NAND gate than an AND gate (and similarly, NOR is 
easier than OR).  This leads to lots of inverted logic.  Adding to the 
confusion, many designs would use active low logic, which means a 1 
was represented by a low voltage, and a 0 by a high voltage.  So, you 
quickly end up with gibberish like, not active low clear nand not 
active low enable clock.  I'm glad I don't do that stuff any more.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: checking if two things do not equal None

2014-03-30 Thread MRAB

On 2014-03-30 13:21, Roy Smith wrote:

In article 5337b4e4$0$29994$c3e8da3$54964...@news.astraweb.com,
  Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:


I think Johannes got it right: boolean logic is easier to reason about
when there is a minimum of nots.


I used to do a lot of digital logic design.  In certain logic families,
it's easier to build a NAND gate than an AND gate (and similarly, NOR is
easier than OR).  This leads to lots of inverted logic.  Adding to the
confusion, many designs would use active low logic, which means a 1
was represented by a low voltage, and a 0 by a high voltage.  So, you
quickly end up with gibberish like, not active low clear nand not
active low enable clock.  I'm glad I don't do that stuff any more.


When you're building with discrete logic chips, NAND gates are useful
because you can use them as inverters too, which helps to keep the chip
count down.
--
https://mail.python.org/mailman/listinfo/python-list


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

2014-03-30 Thread Steven D'Aprano
On Sat, 29 Mar 2014 03:21:29 -0500, Mark H Harris wrote:

 On 3/29/14 1:03 AM, Chris Angelico wrote:

 http://forum.ecomstation.ru/

 Prominent discussion forum, although that strives to be at least
 partially bilingual in deference to those of us who are so backward as
 to speak only English.
 
 Yes. Well, as the joke goes, if you're trilingual you speak three
 languages, if you're bilingual you speak two languages, if you're
 monolingual you're an American (well, that might go for Australia too,
 maybe). When whole continents speak the same language that tends to
 happen.

I think that the Québécois and Mexicans might object to your 
characterisation of North America as speaking a single language.

English is the primary lingua franca in various fields, such as aviation, 
diplomacy, trade and, yes, computing. But it's not the only lingua franca 
in common use: French and Spanish are the second and third most common 
languages used in international trade, and Arabic, Mandarin, Cantonese, 
Russian, and many others remain important regional and international 
lingua francas:

https://en.wikipedia.org/wiki/List_of_lingua_francas

English currently is the dominant international language, but it is not 
the only such language, and it's dominance is not so complete that other 
languages are second-class. One need only look at your spam folder, and 
see how much spam is sent in Chinese, Russian and other languages to 
realise that English hasn't even come close to taking over the planet yet.

But none of which is really relevant to the question on hand. When people 
from France, Germany, Russia, Brazil and Japan get together on the 
Internet, they probably write English. When they are writing for 
themselves, they typically write in French, Germany, Russian, Brazilian 
Portuguese, and Japan.

http://blog.gmane.org/gmane.comp.python.brasil
http://blog.gmane.org/gmane.comp.accessibility.tanaguru
http://blog.gmane.org/gmane.comp.apache.discussion.russian

etc.


[...]
 What I can tell you in my own experience, as an amateur radio
 operator (W0MHH, general class) who has communicated all over the earth
 (even to Soviet Russia), all my computer|radio comm was in English using
 Morse code sets, Latin characters, and ASCII.  No one ever asked me to
 comm in Russian, or French, nor Italian, nor Tswana...

Are you aware that the astronauts on the International Space Station have 
to be fluent in Russian? Hardly surprising, since the Soyuz rockets used 
to get to the ISS are made by Russians, maintained by Russians, and 
launched by Russians. All the controls and manuals are written in 
Russian. One might almost say that the lingua franca of space travel is 
Russian.

You're experience suggests that the lingua franca of the amateur radio 
community is English. If you wanted to be an astronaut, you'd need to 
learn Russian. (Although I wonder whether the Chinese agree about that.) 
Whenever you have people from a broad range of languages getting together 
and needing to communicate, they need to agree on a common tongue. Often 
that's English. Often it is not.

http://www.arabo.com/

(I searched for python, and got three hits: one in English and two in 
French.)


 By the way, in my view, 1991 is very recently; 

In 1991, there was no wireless, no mobile computing, hardly any public 
Internet outside of the universities. It was before the Eternal 
September, and only a few years after the Great Renaming. Python had just 
been released for the first time, and Windows 3.1 hadn't been (although 
3.0 had). There was no Netscape, no Mosaic graphical web browsers. Steve 
Jobs hadn't returned to Apple yet, Apple was still losing money and mind-
share, and Google didn't even exist. It was a different era.

1991 is 23 years ago. In computer years, I consider that almost eight 
generations, about the same as 160 years in human terms. 


 from a computer historical standpoint too. I mean, think
 about it, computers have only existed since late 1940s and only in their
 modern context since about 1989. I didn't really start using unicode
 until about 5 years ago; python has only really used it since python3.
 right?

No. Python 2.2 introduced Unicode.



-- 
Steven D'Aprano
http://import-that.dreamwidth.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-03-30 Thread Ian Kelly
On Mar 30, 2014 9:26 AM, Steven D'Aprano 
steve+comp.lang.pyt...@pearwood.info wrote:

 On Sat, 29 Mar 2014 03:21:29 -0500, Mark H Harris wrote:
  from a computer historical standpoint too. I mean, think
  about it, computers have only existed since late 1940s and only in their
  modern context since about 1989. I didn't really start using unicode
  until about 5 years ago; python has only really used it since python3.
  right?

 No. Python 2.2 introduced Unicode.

Python 2.0 if the PEP 100 metadata is accurate.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-03-30 Thread Steven D'Aprano
On Sun, 30 Mar 2014 01:22:55 -0500, Mark H Harris wrote:

 On 3/29/14 12:53 PM, Steven D'Aprano wrote:
 People have had localised code pages, and localised keyboards to enter
 characters in those code pages, for up to 30 years, if not longer.
 
 Nobody is arguing otherwise, Steven. 

It certainly seemed like you were.


 Having a code page for a local
 language is not the same thing as having software that supports your
 local language code page!

Of course they're not the same, but localised software does exist. You're 
making the mistake of thinking that because you only see English-language 
software, no other software exists. But you are an English-speaker in an 
English-speaking country, of course nearly all the software you see is 
written for English speakers.

But if you were in Spain, the software you buy would be in Spanish:

http://www.sevenforums.com/general-discussion/123741-changing-language-
localization.html

More about localisation:

http://blogs.msdn.com/b/oldnewthing/archive/2012/07/26/10333558.aspx

http://support.apple.com/kb/HT4239?viewlocale=fr_FRlocale=fr_FR



 Software and code pages improved over time,
 but international communication (which is what I'm talking about) has
 always been done in English, using ASCII. 

That's simply not correct. Even if we limit always to mean since World 
War Two, it's still wrong. IBM was localising their computers for non-
English markets before ASCII even existed, code pages was an IBM 
technology invented for EBCDIC-using mainframes before there were ASCII-
using PCs.

What is true is that English is the primary lingua franca on the 
Internet. But it's not the only one, and there are plenty of places on 
the Internet where people discuss things in their own language.


 Well except when Guido brought
 the ABC stuff to the states back in the day and had no way to do that
 except to fly himself (and the tape) personally.

 In some of those cases, the localisation was done by companies like
 IBM, Microsoft and Apple, realising that if they wanted to sell
 computers outside of the US, they needed to supply computers that were
 localised to their market.
 
 Unfortunately that happened way late. And even then, international
 communication was still done (and is still done) in English.

And French. And Spanish. And Chinese. If you trade with most of Africa, 
knowing Arabic or French will probably be more useful than knowing 
English.


 Only until
 very recently (see my post to Chris) has unicode improved to the point
 where international comm can occur reliably enough (input, font, code
 points) to allow comm in languages other than English.

Unicode has little to do with the ability to communicate in languages 
other than English. If you want to communicate in Greek, you don't need 
Unicode, you just need both parties to agree to use ISO-8859-7. If you 
want to communicate in Japanese, you could use Shift-JIS, or various 
others.

Where Unicode comes into it is when you want to manage *mixed* 
communication. There's no way for me to include your ISO-8859-7 Greek 
text in my Shift-JIS Japanese document. I can use one, or the other, but 
not both. But with Unicode, I can use them both.


[...]
 My point exactly. With the advent of the Internet, almost *all* comm
 is English with minor notable exceptions in today's environment.

Not even close to almost all. Barely half of the Internet is English. 
If you only look in the English-speaking corners of the Internet, it is 
hardly surprising that you only see people speaking English.


Even at the high-point, English was only 80% of the Internet, 20% (that's 
*one in five* websites) was non-English:

http://www.theatlantic.com/past/docs/issues/2000/11/wallraff3.htm

That was a decade ago, and as predicted, the percentage of the Internet 
which uses English has plummeted as more non-English speakers have got on 
the 'net. Today, only 56% of the Internet is English:

http://w3techs.com/technologies/overview/content_language/all

That figure is based on the one million most popular websites. If you 
include *all* websites, you'll find the English percentage is even lower, 
and quite likely under 50%.

https://en.wikipedia.org/wiki/Languages_used_on_the_Internet

Some other points to consider: 

44% of WordPress sites are non-English:

http://venturebeat.com/2013/07/27/19-percent-of-the-web-runs-on-wordpress/

which is representative of the broader Internet. And since 2001, while 
the use of English on the Internet grew by 281%, other languages have 
grown much faster: 

- Spanish (743%)
- Chinese (1,277%)
- Russian (1,826%)
- Arabic (2,501%)


-- 
Steven D'Aprano
http://import-that.dreamwidth.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


writing reading from a csv or txt file

2014-03-30 Thread mtcplumb
Hi I have 3 csv files with a list of 5 items in each.
rainfall in mm, duration time,time of day,wind speed, date.
I am trying to compare the files. cutting out items in list list. ie:- 
first file (rainfall2012.csv)rainfall, duration,time of day,wind speed,date.
first file (rainfall2013.csv)rainfall, duration,time of day,wind speed,date.
I would like to pick out maybe rainfalls and duration's and measure against say 
years. 
I would like to very the items from the rows. 
could you please advise me where i can find such information. or book, textbook.

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


Re: writing reading from a csv or txt file

2014-03-30 Thread Jason Friedman

 I am trying to compare the files. cutting out items in list list. ie:-
 first file (rainfall2012.csv)rainfall, duration,time of day,wind
 speed,date.
 first file (rainfall2013.csv)rainfall, duration,time of day,wind
 speed,date.
 I would like to pick out maybe rainfalls and duration's and measure
 against say years.

 Could you show us the first, say, three rows from each file, plus what you
would like the first three or six lines of output to be?
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: writing reading from a csv or txt file

2014-03-30 Thread Joseph L. Casale
 Hi I have 3 csv files with a list of 5 items in each.
 rainfall in mm, duration time,time of day,wind speed, date.
 I am trying to compare the files. cutting out items in list list. ie:-
 first file (rainfall2012.csv)rainfall, duration,time of day,wind speed,date.
 first file (rainfall2013.csv)rainfall, duration,time of day,wind speed,date.
 I would like to pick out maybe rainfalls and duration's and measure against
 say years.
 I would like to very the items from the rows.
 could you please advise me where i can find such information. or book,
 textbook.

How about we help you here..

So if you want to compare by year, you want to read all the rows in and perform
some math, because I can't help myself, I push this into sqlite at least but 
that's
probably overkill for you (besides the limitless benefits:)). You want to store 
some
state while you iterate over each row in the csv, appending data, then finally 
performing
some statistical math on the collection.

You will do this for each file, then finally aggregate your results.

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


Re: writing reading from a csv or txt file

2014-03-30 Thread Gary Herron

On 03/30/2014 12:05 PM, mtcpl...@googlemail.com wrote:

Hi I have 3 csv files with a list of 5 items in each.
rainfall in mm, duration time,time of day,wind speed, date.
I am trying to compare the files. cutting out items in list list. ie:-
first file (rainfall2012.csv)rainfall, duration,time of day,wind speed,date.
first file (rainfall2013.csv)rainfall, duration,time of day,wind speed,date.
I would like to pick out maybe rainfalls and duration's and measure against say 
years.
I would like to very the items from the rows.
could you please advise me where i can find such information. or book, textbook.



How is this a Python question?

There is a standard  module included with Python for reading CSV files.  
Would you like to know how to use that?  You can find documentation on 
it here:

http://docs.python.org/3/library/csv.html

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


Re: checking if two things do not equal None

2014-03-30 Thread Gregory Ewing

Roy Smith wrote:
Adding to the 
confusion, many designs would use active low logic, which means a 1 
was represented by a low voltage, and a 0 by a high voltage.  So, you 
quickly end up with gibberish like, not active low clear nand not 
active low enable clock.


There are ways of dealing with that in schematic diagrams.
For exammple, if you have two active-low signals A and B
and want to express A is active or B is active, you
draw an OR gate symbol with inversion circles on the
inputs. That's equivalent to a NAND gate, but makes the
intention clear.

Schematics drawn that way are much easier to follow than
ones that only use the inverted-output versions of the
symbols.

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


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

2014-03-30 Thread Rhodri James
On Sun, 30 Mar 2014 11:44:13 +0100, Steven D'Aprano  
steve+comp.lang.pyt...@pearwood.info wrote:



On Sun, 30 Mar 2014 00:32:58 -0700, Larry Hudson wrote:


Unfortunately, there is no good word for USA-ian.  United States
Citizen is too long and awkward and United Statesian is ridiculous.
The common usage of American for this is at best ambiguous, and
definitely inaccurate (as well as chauvinistic, and rather insulting to
other North and South Americans outside the US).


Among fans of the British writer Terry Pratchett, the usual term is
Merkins. Including among Merkin fans.


Many of whom even know what a merkin is, and use the term anyway.

--
Rhodri James *-* Wildebeest Herder to the Masses
--
https://mail.python.org/mailman/listinfo/python-list


Examples of modern GUI python programms

2014-03-30 Thread D. Xenakis
Id like to ask.. do you know any modern looking GUI examples of windows 
software written in python? Something like this maybe: 
http://techreport.com/r.x/asus-x79deluxe/software-oc.jpg (or hopefully 
something like this android look: 
http://chromloop.com/wp-content/uploads/2013/07/Skype-4.0-Android-screenshot.jpg).
What i need is to develop an android looking program (entirelly in python) for 
windows, but dunno if this is possible (most propably is), and which tool 
between those would help me most: tkinter - wxpython - pyqt - pygtk .

Any examples and suggestions are most welcome.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-03-30 Thread MRAB

On 2014-03-30 23:57, Rhodri James wrote:

On Sun, 30 Mar 2014 11:44:13 +0100, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:


On Sun, 30 Mar 2014 00:32:58 -0700, Larry Hudson wrote:


Unfortunately, there is no good word for USA-ian.  United States
Citizen is too long and awkward and United Statesian is ridiculous.
The common usage of American for this is at best ambiguous, and
definitely inaccurate (as well as chauvinistic, and rather insulting to
other North and South Americans outside the US).


Among fans of the British writer Terry Pratchett, the usual term is
Merkins. Including among Merkin fans.


Many of whom even know what a merkin is, and use the term anyway.


Isn't that what some said it sounded like when George W Bush said it?

My fellow 'mercns, ...
--
https://mail.python.org/mailman/listinfo/python-list


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

2014-03-30 Thread Walter Hurry
Steven D'Aprano wrote:

 On Sun, 30 Mar 2014 00:32:58 -0700, Larry Hudson wrote:

 Unfortunately, there is no good word for USA-ian.  United States
 Citizen is too long and awkward and United Statesian is ridiculous. 
 The common usage of American for this is at best ambiguous, and
 definitely inaccurate (as well as chauvinistic, and rather insulting to
 other North and South Americans outside the US).

 Among fans of the British writer Terry Pratchett, the usual term is 
 Merkins. Including among Merkin fans.

Tom Sharpe was there first, I think.
By the way, his books are hilarious.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Examples of modern GUI python programms

2014-03-30 Thread Michael Torrie
On 03/30/2014 05:16 PM, D. Xenakis wrote:
 What i need is to develop an android looking program (entirelly in
 python) for windows, but dunno if this is possible (most propably
 is), and which tool between those would help me most: tkinter -
 wxpython - pyqt - pygtk .
 
 Any examples and suggestions are most welcome.

Your best bet is to use PyQt.  I bet you can make some android-looking
UIs using QtQuick (Javascript) with a bit of Python glue.


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


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

2014-03-30 Thread Mark H Harris

On 3/30/14 5:35 AM, Steven D'Aprano wrote:

On Sun, 30 Mar 2014 01:48:27 -0500, Mark H Harris wrote:

 Don't be silly, Steven, it doesn't become you.


Given the sorts of patronising, condescending things you insist are true
about non-Americans, such as their supposed inability to communicate in
their own language on the Internet, I wasn't sure.


   You just crossed the boundary from silly to asinine.



1) Mandarin
2) Spanish
3) English
4) Hindi
5) Arabic
6) Portuguese
7) Bengali
8) Russian
9) Japanese
10) Punjabi
11) German
12) Javanese
13) Wu

adding up to 51%. The next thirteen bring the total to 64%.


   Where the heck did you get that!?! ...wow.


(Figures are, naturally, approximate and subject to change.)


   no doubt.

*wink*

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


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

2014-03-30 Thread Mark H Harris

On 3/30/14 5:35 AM, Steven D'Aprano wrote:


Approximately 5% of the US population either do not speak English at all,
or speak it poorly. That includes approximately half a million ASL
speakers (American Sign Language, which is not a manual representation of
English but an independent language in it's own right), the majority of
whom are unable to speak or understand spoken English.


Steven, you have trolled us over to the left edge of outer left field 
all the way back at the fence, dude, seriously--- and then you dropped 
the ball. Geeeze... error.


My point at the beginning was that we need a universal unicode input 
device. Its time to think past US_104 and en_US.  Come in out of left field.


As long as I'm passing along my dreams to everyone, we also need a 
universal translator on the uptake. In other words, everyone inputs from 
a universal encoder, and every browser has the option of on-demand 
translation (or not). Its a little like google translate, but on-demand, 
and its standard, and it works everywhere with every language.


Everyone keys input in their own heart language (first, primary 
language) and then the internet browser allows for display of first 
language (if the coding is the same) and translates if the coding is 
different (all configurable of course). Yes, the apps are in the cloud.


What say you?  We all type in our own language, and everyone else gets 
to read it in their own language. Its kinda like the day of Pentecost 
(except that its print instead of audio).


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


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

2014-03-30 Thread Chris Angelico
On Mon, Mar 31, 2014 at 3:57 PM, Mark H Harris harrismh...@gmail.com wrote:
 As long as I'm passing along my dreams to everyone, we also need a universal
 translator on the uptake. In other words, everyone inputs from a universal
 encoder, and every browser has the option of on-demand translation (or not).
 Its a little like google translate, but on-demand, and its standard, and it
 works everywhere with every language.

 Everyone keys input in their own heart language (first, primary language)
 and then the internet browser allows for display of first language (if the
 coding is the same) and translates if the coding is different (all
 configurable of course). Yes, the apps are in the cloud.

 What say you?  We all type in our own language, and everyone else gets to
 read it in their own language. Its kinda like the day of Pentecost (except
 that its print instead of audio).

And Pentecost required direct intervention of the all-powerful God of
the universe. Any less, and you'll run into translation difficulties.
It certainly cannot be automated; even done manually by people expert
in both the source and target languages, translation is imperfect.

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


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

2014-03-30 Thread Mark H Harris

On 3/30/14 1:31 AM, Steven D'Aprano wrote:

The most recent US census found there are 38.5 million people in the US
who primarily speak Spanish, and 45 million who speak it as their first
or second language. In comparison, there are only an estimated 11 million
illegal immigrants (of which only 7 million is from Mexico).


The following link shows plenty of language stats (most of them differ 
from yours markedly; the estimates are just guesses really).


The main point of the link is the status on English as an official 
language.  28 out of 50 states have legislated English as the official 
language; meaning, that you either speak and write English, or you're 
going to have a really tough time participating in culture, business, 
government, and recreation.


http://en.wikipedia.org/wiki/Languages_of_the_United_States#Official_language_status


marcus


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


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

2014-03-30 Thread Mark H Harris

On 3/31/14 12:05 AM, Chris Angelico wrote:


What say you?  We all type in our own language, and everyone else gets to
read it in their own language. Its kinda like the day of Pentecost (except
that its print instead of audio).


And Pentecost required direct intervention of the all-powerful God of
the universe. Any less, and you'll run into translation difficulties.
It certainly cannot be automated; even done manually by people expert
in both the source and target languages, translation is imperfect.


Truth.   Well, like I said, its a dream.  And, we are finally at that 
point in time space (fast computers, elegant programming languages, 
network, cloud apps, desire) where I think we could tackle universal 
translation.


On the other hand, would it be easier to simply move everyone to a 
neutral lingua franca?  For instance, lets say, biblical Greek.  In 
other words, the entire world learns a new (dead) language. Then, we all 
move forward speaking ONE language and we forget the translation thing 
altogether?


The reason that won't work is that everyone needs their heart language 
(as what it means to be human, and as what it means to be 'them'). How 
we speak is how we think, and feel. Its a conundrum for sure.


marcus

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


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

2014-03-30 Thread Chris Angelico
On Mon, Mar 31, 2014 at 4:23 PM, Mark H Harris harrismh...@gmail.com wrote:

 The main point of the link is the status on English as an official language.
 28 out of 50 states have legislated English as the official language;
 meaning, that you either speak and write English, or you're going to have a
 really tough time participating in culture, business, government, and
 recreation.

 http://en.wikipedia.org/wiki/Languages_of_the_United_States#Official_language_status

Considering how much is done to ensure that illiterate people can
still comprehend critical information (important signage, warnings,
traffic directions, etc, etc, etc), I think we can assume that someone
who speaks some language other than English will still manage to do a
lot of things. Plus, plenty of official documents are available in
many languages; the legislated official language just means that the
English version is the only one that is guaranteed to be there. Go to
any one of the states you've mentioned, where English is the sole
official language, and pick up any government form - something fairly
important, like applying for a passport or something. How many
languages is it available in? They might all be on the same form, or
maybe you have to explicitly request it in Spanish, but I expect it'll
be translated into several non-official languages for the convenience
of those whose English isn't as good as their (switch to GLaDOS voice)
Insert Subject Native Language Here (switch voice back).

But none of this has anything to do with the original point, namely
that there are people who communicate in other languages. Even if you
have to learn English for the sake of official documents, you won't
necessarily want to chat with your friends in English. If you pick up
the phone and talk to someone, you can use whatever language you want;
if you switch to email, chances are you still can. And that's
something that's been true since the dawn of email, which predates
Unicode by a slight margin... of a decade or so.

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


Re: Examples of modern GUI python programms

2014-03-30 Thread Metallicow
On Sunday, March 30, 2014 9:16:06 PM UTC-5, Michael Torrie wrote:
 On 03/30/2014 05:16 PM, D. Xenakis wrote:
 
  What i need is to develop an android looking program (entirelly in
  python) for windows, but dunno if this is possible (most propably
  is), and which tool between those would help me most: tkinter -
 
  wxpython - pyqt - pygtk .
  
  Any examples and suggestions are most welcome.
 
 Your best bet is to use PyQt.  I bet you can make some android-looking
 UIs using QtQuick (Javascript) with a bit of Python glue.

Well, I wouldn't exactly say that Qt is the way to go just yet...
The author needs to weigh the benefits of each toolkit and make a decision for 
themselves.

As far as Qt is concerned, it is a bit more geared towards mobile apps at this 
point in its python life.
It is a bit nicer with the animated stuff also.
wxPython on the other hand has way better community support than QT side and 
has been around longer, so that may be a consideration.
Tk is alright and bundled with python but requires more work than the others 
and isn't always native looking without a bit of extra work.

Overall if you are fine with using a GUI builder for the GUI framework, then QT 
has a nice put-it-all-together IDE.
If you are looking for a really customized(hand-tweakable) GUI with relative 
hassle, then I would recommend wxPython or if you know Tk this would be ok for 
the majority of stuff, but requires a bit more work.

Another thing to consider is that if you are actually wanting this to work on a 
android or mobile device QT would be a better choice. Especially if touch 
support is an option.
If you are only wanting it to look like android themed app, the other choices 
provide better long term benefits.

As far as pygtk, that fairs better with linux, and in my opinion could use some 
updates platform-wise rounding the bugs out overall.

My opinion would be wxPython if not actually using for a mobile, or PySide if 
you are. Both of these have acceptable licenses if you want to go commercial 
also without having to pay for commercial library usage.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue11704] functools.partial doesn't create bound methods

2014-03-30 Thread Nick Coghlan

Nick Coghlan added the comment:

With the introduction of functools.partialmethod in 3.4, marking this older 
docs issue as a won't fix

--
resolution:  - wont fix
stage:  - committed/rejected
status: open - closed
type:  - enhancement

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11704
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14198] Backport parts of the new memoryview documentation

2014-03-30 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
versions:  -Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14198
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21074] Too aggressive constant folding

2014-03-30 Thread Nick Coghlan

Nick Coghlan added the comment:

I'm marking this as a duplicate of issue 11549 (which is about building out an 
AST optimiser), mostly because I don't think this kind of parameter tweaking 
makes sense with the current peephole optimiser.

With a more sophisticated Python implemented optimiser earlier in the pipeline, 
it becomes more reasonable to make smarter decisions about space/speed 
trade-offs when dealing with sequence repetition, and even just really large 
integer values.

--
nosy: +ncoghlan
resolution:  - duplicate
status: open - closed
superseder:  - Build-out an AST optimizer, moving some functionality out of 
the peephole optimizer

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21074
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1191964] asynchronous Subprocess

2014-03-30 Thread Josiah Carlson

Josiah Carlson added the comment:

Due to some rumblings over on the mentors list and python-dev, this is now 
getting some love.

Guido has stated that something should make it into the subprocess module for 
3.5 in this email: 
https://groups.google.com/d/msg/dev-python/I6adJLIjNHk/Usrvxe_PVJIJ

His suggested API is:
proc.write_nonblocking(data)
data = proc.read_nonblocking()
data = proc.read_stderr_nonblocking()


I've implemented the API for Windows and Linux, and below are my findings.


On the Linux side of things, everything seems to be working more or less as 
expected, though in writing tests I did need to add an optional argument to 
qcat.py in order to have it flush its stdout to be able to read from the parent 
process. Odd, but whatever.

Also, Richard Oudkerk's claims above about not needing to use fcntl to swap 
flags is not correct. It's necessary to not block on reading, even if select is 
used. Select just guarantees that there is at least 1 byte or a closed handle, 
not that your full read will complete.


On the Windows side of things, my assumptions about WriteFile() were flawed, 
and it seems that the only way to make it actually not block if/when the 
outgoing buffer is full is to create a secondary thread to handle the writing*. 
I've scoured the MSDN docs and there doesn't seem to be an available API for 
interrogating the pipe to determine whether the buffer is full, how full it is, 
or whether the write that you'd like to do will succeed or block.

* This applies even with the use of asyncio. Because the intent for the call is 
to return more or less immediately, a thread still has to be created to handle 
the event loop for IO completion, which means that asyncio can't prevent the 
use of threads and not block without basically integrating an event loop into 
the caller.

Considering that the Windows communicate() method already uses threads to 
handle reading and writing, I don't believe it is a big deal to add it for this 
situation too. Any major objections?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1191964
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1191964] asynchronous Subprocess

2014-03-30 Thread Josiah Carlson

Changes by Josiah Carlson josiah.carl...@gmail.com:


--
versions: +Python 3.5 -Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1191964
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20022] modernize the Mac bundlebuilder.py script

2014-03-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3cf72994d5ae by Ned Deily in branch 'default':
Issue #20022: Eliminate use of deprecated bundlebuilder in OS X builds.
http://hg.python.org/cpython/rev/3cf72994d5ae

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20022
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20022] Eliminate the use of the deprecated bundlebuilder.py script in OS X builds

2014-03-30 Thread Ned Deily

Ned Deily added the comment:

Thanks for the patch, Ronald.  I modified it a bit and also removed 
bundlebuilder.py from the source tree.  Applied for release in 3.5.0.

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed
title: modernize the Mac bundlebuilder.py script - Eliminate the use of the 
deprecated bundlebuilder.py script in OS X builds

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20022
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21074] Too aggressive constant folding

2014-03-30 Thread STINNER Victor

STINNER Victor added the comment:

The change that I proposed (check parameters before compute the result is
simple), whereas implementing a new optimizer working on the AST requires
much more work.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21074
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21101] Extend the PyDict C API to handle cases where the hash value in known

2014-03-30 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
components: Interpreter Core
files: known_hash.diff
keywords: patch
nosy: rhettinger
priority: normal
severity: normal
stage: patch review
status: open
title: Extend the PyDict C API to handle cases where the hash value in known
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file34666/known_hash.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21101
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21101] Extend the PyDict C API to handle cases where the hash value in known

2014-03-30 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


Added file: http://bugs.python.org/file34667/applied_known_hash.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21101
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21101] Extend the PyDict C API to handle cases where the hash value in known

2014-03-30 Thread Raymond Hettinger

New submission from Raymond Hettinger:

Propose adding two functions, PyDict_GetItem_KnownHash() and 
PyDict_SetItem_KnownHash().

It is reasonably common to make two successive dictionary accesses with the 
same key.  This results in calling the hash function twice to compute the same 
result.

For example, the technique can be used to speed-up collections.Counter (see the 
attached patch to show how).  In that patch, the hash is computed once, then 
used twice (to retrieve the prior count and to store the new count.

There are many other places in the standard library that could benefit:

Modules/posixmodule.c 1254
Modules/pyexpat.c 343 and 1788 and 1798
Modules/_json.c 628 and 1446 and 1515 and 1697
Modules/selectmodule.c 465
Modules/zipmodule.c 137
Objects/typeobject.c 6678 and 6685
Objects/unicodeobject.c 14997
Python/_warnings.c 195
Python/compile.c 1134
Python/import.c 1046 and 1066
Python/symtable 671 and 687 and 1068

A similar technique has been used for years in the Objects/setobject.c 
internals as a way to eliminate unnecessary calls to PyObject_Hash() during 
set-to-set and set-to-dict operations.

The benefit is biggest for objects such as tuples or user-defined classes that 
have to recompute the hash on every call on PyObject_Hash().

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21101
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21101] Extend the PyDict C API to handle cases where the hash value in known

2014-03-30 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


Added file: http://bugs.python.org/file34668/double_counter_hash.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21101
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21102] 3.4.0 PDF (a4,letter) and EPUB documentation missing

2014-03-30 Thread koobs

New submission from koobs:

python-3.4.0-docs-pdf-letter.{zip,tar.bz2}
python-3.4.0-docs-pdf-letter.{zip,tar.bz2}

are missing from:

https://www.python.org/ftp/python/doc/3.4.0/

/current/ also still points to 3.3.x documentation:

https://www.python.org/ftp/python/doc/current/

--
assignee: docs@python
components: Documentation
messages: 215176
nosy: docs@python, koobs
priority: normal
severity: normal
status: open
title: 3.4.0 PDF (a4,letter) and EPUB documentation missing
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21102
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21102] 3.4.0 PDF (a4,letter) and EPUB documentation missing

2014-03-30 Thread koobs

koobs added the comment:

Missing files was supposed to read:

python-3.4.0-docs-pdf-a4.{zip,tar.bz2}
python-3.4.0-docs-pdf-letter.{zip,tar.bz2}
python-3.4.0-docs-epub.{zip,tar.bz2}

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21102
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16716] Deprecate OSError aliases in the doc

2014-03-30 Thread priya

Changes by priya priyapappachan...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file34669/exception.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16716
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1191964] asynchronous Subprocess

2014-03-30 Thread Richard Oudkerk

Richard Oudkerk added the comment:

Using asyncio and the IOCP eventloop it is not necessary to use threads.  
(Windows may use worker threads for overlapped IO, but that is hidden from 
Python.)  See

  https://code.google.com/p/tulip/source/browse/examples/child_process.py

for vaguely expect-like interaction with a child python process which works 
on Windows.  It writes commands to stdin, and reads results/tracebacks from 
stdout/stderr.

Of course, it is also possible to use overlapped IO directly.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1191964
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21101] Extend the PyDict C API to handle cases where the hash value in known

2014-03-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21101
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21100] Micro-optimization for tuple comparison

2014-03-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This patch breaks lexicographic ordering of tuples:

(1, 2)  (1, 2, 0)  (1, 3)

--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21100
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21100] Micro-optimization for tuple comparison

2014-03-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
Removed message: http://bugs.python.org/msg215179

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21100
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21100] Micro-optimization for tuple comparison

2014-03-30 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +tim.peters

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21100
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21100] Micro-optimization for tuple comparison

2014-03-30 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21100
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1191964] asynchronous Subprocess

2014-03-30 Thread janzert

Changes by janzert janz...@janzert.com:


--
nosy: +janzert

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1191964
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21101] Extend the PyDict C API to handle cases where the hash value in known

2014-03-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Is there any benefit in making them public API functions?

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21101
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1697175] winreg module for cygwin?

2014-03-30 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Closing as out of date.

--
resolution:  - out of date
status: languishing - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1697175
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21102] 3.4.0 PDF (a4,letter) and EPUB documentation missing

2014-03-30 Thread Georg Brandl

Georg Brandl added the comment:

Fixed the symlink. Larry, where did you put the other archives?

--
assignee: docs@python - larry
nosy: +georg.brandl, larry

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21102
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21085] compile error Python3.3 on Cygwin

2014-03-30 Thread Martin v . Löwis

Martin v. Löwis added the comment:

dellair jie: would you like to work on a patch?

It's fine if not, but it may then be that there is no resolution to this issue 
for the coming months or years (unless somebody else volunteers to write a 
patch).

Running configure should have created pyconfig.h. Please report what this file 
has; pyconfig.h.in is not configured.

--
nosy: +loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21085
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21102] 3.4.0 PDF (a4,letter) and EPUB documentation missing

2014-03-30 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Added missing docs releases.

--
nosy: +benjamin.peterson
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21102
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20924] openssl init 100% CPU utilization

2014-03-30 Thread Martin v . Löwis

Martin v. Löwis added the comment:

As Antoine says: if the socket is *really* in blocking mode, then 
SSL_do_handshake should block until the handshake if fully complete. It should 
not return SSL_ERROR_WANT_READ in this case.

If you have managed to build Python for yourself to diagnose this further, 
please add a call to ioctlsocket in this loop to verify that the socket is in 
blocking mode.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20924
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21101] Extend the PyDict C API to handle cases where the hash value in known

2014-03-30 Thread Raymond Hettinger

Raymond Hettinger added the comment:

 Is there any benefit in making them public API functions?

Originally, I was going to suggest them as internal functions, but the variety 
of use cases in the standard library suggested that third-party C extensions 
would benefit as well.  

Since this isn't functionality a user can create themselves, a public function 
is the only way to expose this service.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21101
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21101] Extend the PyDict C API to handle cases where the hash value in known

2014-03-30 Thread Alex Gaynor

Alex Gaynor added the comment:

Would it be reasonable to develop a Python API for this? If C functions have a 
need to do this, surely Python code does as well.

--
nosy: +alex

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21101
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21100] Micro-optimization for tuple comparison

2014-03-30 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
resolution:  - invalid
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21100
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21100] Micro-optimization for tuple comparison

2014-03-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 16fd3f4c9128 by Raymond Hettinger in branch 'default':
Issue 21100: Amazingly, tuple lexicographic ordering was untested.
http://hg.python.org/cpython/rev/16fd3f4c9128

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21100
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21103] Encoding str to IDNA with ellipsis decomposes to empty labels

2014-03-30 Thread Christopher Foo

New submission from Christopher Foo:

When encoding a string with the IDNA codec I expected that it will always raise 
an exception with empty labels. When I do this

 'example.c…'.encode('idna').decode('ascii')

it returns

'example.c...'

instead of raising UnicodeError. The original string ends with U+2026 
HORIZONTAL ELLIPSIS if you can't see it clearly. These strings are coming from 
web pages in a web crawler.

I tested this on Python 3.4, 3.3.2, 2.7.5, 2.6.9.

--
components: Library (Lib)
messages: 215189
nosy: chfoo
priority: normal
severity: normal
status: open
title: Encoding str to IDNA with ellipsis decomposes to empty labels
type: behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21103
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21101] Extend the PyDict C API to handle cases where the hash value is known

2014-03-30 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
title: Extend the PyDict C API to handle cases where the hash value in known - 
Extend the PyDict C API to handle cases where the hash value is known

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21101
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21104] Read from file aborted

2014-03-30 Thread Alex Grinko

New submission from Alex Grinko:

When reading from text file on Windows Python ends loop on character 0x1A
sample.py:
number = 0
with open(sample.txt,'r') as f:
for line in f:
number += 1
print line
print File has 8 lines, but Python could read only ,number

--
components: Windows
files: sample.txt
messages: 215190
nosy: Alex.Grinko
priority: normal
severity: normal
status: open
title: Read from file aborted
type: behavior
versions: Python 2.7, Python 3.3
Added file: http://bugs.python.org/file34670/sample.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21104
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21105] functools.partialmethod example doesn't actually work

2014-03-30 Thread Alex Gaynor

New submission from Alex Gaynor:

Specifically the example at: 
https://docs.python.org/3/library/functools.html?highlight=functools#functools.partialmethod

``_alive`` isn't actually assigned before the example tries to read it. Running 
this code at a for-real REPL results in:

 class Cell(object):
... @property
... def alive(self):
... return self._alive
... def set_state(self, state):
... self._alive = bool(state)
... import functools
... set_alive = functools.partialmethod(set_state, True)
... set_dead = functools.partialmethod(set_state, False)
...
 c = Cell()
 c.alive
Traceback (most recent call last):
  File stdin, line 1, in module
  File stdin, line 4, in alive
AttributeError: 'Cell' object has no attribute '_alive'

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 215191
nosy: alex, docs@python
priority: normal
severity: normal
status: open
title: functools.partialmethod example doesn't actually work
versions: Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21105
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21101] Extend the PyDict C API to handle cases where the hash value is known

2014-03-30 Thread Raymond Hettinger

Raymond Hettinger added the comment:

 Would it be reasonable to develop a Python API for this? 

I suspect that in pure Python, the overhead would exceed the benefit.

Current code:

   d[key] = d[key] + 1

Effort to save a double hash:

   h = hash(key)
   c = d.getitem_known_hash(key, hash)
   d.setitem_known_hash(key, hash, c + 1)

In PyPy, the second code sample might actually be faster that the first, but 
all the other pythons suffer from interpreter overhead, a double dict lookup 
for the hash() function, two dict lookups just to find the new methods, 
allocating a bound method, and forming two argument tuples.

There is also an API design issue.  The pure python core datatype APIs are 
designed in a way to encourage higher level thinking (that is why we can't 
directly manage hash table sparsity or list over-allocation for example).

In contrast, the C API is aimed at users who seek additional control and  
optimization at a lower level than the core language provides.  We tend to 
expose a number of tools at the C level that would be inappropriate for 
higher-level code.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21101
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11824] freeze.py broken due to ABI flags

2014-03-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4e37a4a036c6 by Martin v. Löwis in branch '3.4':
Issue #11824: Consider ABI tags in freeze. Patch by Meador Inge.
http://hg.python.org/cpython/rev/4e37a4a036c6

New changeset 1b6fc88ae3f5 by Martin v. Löwis in branch 'default':
Merge 3.4: Issue #11824: Consider ABI tags in freeze. Patch by Meador Inge.
http://hg.python.org/cpython/rev/1b6fc88ae3f5

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11824
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11824] freeze.py broken due to ABI flags

2014-03-30 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Thanks for the patch. Closing this issue as it only deals with the ABI flags; 
the remaining issues with freeze are dealt with elsewhere.

--
nosy: +loewis
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11824
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21105] functools.partialmethod example doesn't actually work

2014-03-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ed81acc970d9 by Benjamin Peterson in branch '3.4':
make partialmethod example work (closes #21105)
http://hg.python.org/cpython/rev/ed81acc970d9

New changeset b8a76485b5ed by Benjamin Peterson in branch 'default':
merge 3.4 (#21105)
http://hg.python.org/cpython/rev/b8a76485b5ed

--
nosy: +python-dev
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21105
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16047] Tools/freeze no longer works in Python 3

2014-03-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 001a6dc996e7 by Martin v. Löwis in branch '3.4':
Issue #16047: Fix module exception list and __file__ handling in freeze.
http://hg.python.org/cpython/rev/001a6dc996e7

New changeset 87ded2fdac4b by Martin v. Löwis in branch 'default':
Merge 3.4 (#16047)
http://hg.python.org/cpython/rev/87ded2fdac4b

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16047
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16047] Tools/freeze no longer works in Python 3

2014-03-30 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Thanks for the patch. It seems to work now.

http://buildbot.python.org/all/builders/AMD64%20Ubuntu%20LTS%20Freeze%203.x/builds/9

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16047
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11549] Build-out an AST optimizer, moving some functionality out of the peephole optimizer

2014-03-30 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berker.peksag

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11549
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21103] Encoding str to IDNA with ellipsis decomposes to empty labels

2014-03-30 Thread Martin v . Löwis

Martin v. Löwis added the comment:

I believe this behavior is correct wrt. RFC 3490. In the input, the last label 
is c…, which is not empty. It is passed to ToASCII, which normalizes the 
ellipsis to  If UseSTD3ASCIIRules was true, conversion would fail as it 
yields . (\x2E). However, Python choses not to set UseSTD3ASCIIRules (and 
instead leaves it to the DNS server to decide whether the name is valid).

I believe this is actually a bug in the RFC, which should ban . from the the 
set of conversion results regardless of UseSTD3ASCIIRules. However, since this 
RFC is superseded, you probably won't get anybody to confirm this view.

--
nosy: +loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21103
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21103] Encoding str to IDNA with ellipsis decomposes to empty labels

2014-03-30 Thread R. David Murray

R. David Murray added the comment:

For whatever it is worth, it looks like rfc 5892 marks U+2026 as disallowed.

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21103
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21106] Updated Mac folder icon

2014-03-30 Thread Vivek Jain

New submission from Vivek Jain:

Python 3 still uses an old-style Mac folder icon in its installer 
(https://github.com/python-git/python/blob/master/Mac/Icons/Python%20Folder.icns?raw=true)
 that looks out of place on recent Macs. I created a quick replacement that is 
higher res and fits in better.

--
assignee: ronaldoussoren
components: Macintosh
files: Python Folder.icns
messages: 215200
nosy: ronaldoussoren, viveksjain
priority: normal
severity: normal
status: open
title: Updated Mac folder icon
type: enhancement
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file34671/Python Folder.icns

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21106
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21106] Updated Mac folder icon

2014-03-30 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Can you please submit a contributor form, and indicate that you are willing to 
license the icon under this agreement?

--
nosy: +loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21106
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21106] Updated Mac folder icon

2014-03-30 Thread Martin v . Löwis

Martin v. Löwis added the comment:

We should probably also ask for the PSF's permission (from the trademark 
committee) to use this specific modification of the logo in CPython.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21106
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21106] Updated Mac folder icon

2014-03-30 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
assignee: ronaldoussoren - ned.deily
nosy: +ned.deily
versions:  -Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21106
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21104] Read from file aborted

2014-03-30 Thread eryksun

eryksun added the comment:

AFAIK, this doesn't affect Python 3 under normal circumstances. A file could be 
manually set to text mode by calling msvcrt.setmode(f.fileno(), os.O_TEXT), but 
that's out of the norm.

In Python 2, on Windows interpreting ctrl+z (0x1a) as end-of-file is normal 
behavior in text mode. Read the remarks about [t]ext mode in the description of 
Microsoft's fopen implementation:

http://msdn.microsoft.com/en-us/library/yeby3zcb%28v=vs.90%29.aspx

If you use Python's universal newlines mode, e.g. open('sample.txt', 'rU'), 
then the underlying file is opened in binary mode and therefore will not 
interpret ctrl+z as the end-of-file marker.

--
nosy: +eryksun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21104
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21106] Updated Mac folder icon

2014-03-30 Thread Vivek Jain

Vivek Jain added the comment:

Submitted the patch, and I license the icon under the PSF contributor 
agreement. To make the icon, I used: (1) the default Apple folder icon as a 
starting point and (2) the Python icon from 
https://www.python.org/community/logos/ (but with modified colors). For (1), 
not sure if there are any copyright issues involved and if so how to get proper 
permission from Apple. I'm guessing the old icon also used the default Mac 
folder icon at the time. For (2), I defer to your expertise to find out the 
right people to contact to get it approved.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21106
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21106] Updated Mac folder icon

2014-03-30 Thread Vivek Jain

Vivek Jain added the comment:

By Submitted the patch I meant Submitted the contributor agreement.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21106
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21106] Updated Mac folder icon

2014-03-30 Thread Ezio Melotti

Ezio Melotti added the comment:

Regarding the Python logo, you should write to psf-tradema...@python.org, tell 
them that you used the logo for the icon and add a link to this issue.
I'm sure they will be happy to let you use it, but it's good to let them know.

--
nosy: +ezio.melotti
stage:  - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21106
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1599254] mailbox: other programs' messages can vanish without trace

2014-03-30 Thread David Watson

David Watson added the comment:

On Sun 23 Mar 2014, David Watson wrote:
 There actually isn't a test for the original locking issue, as
 the tests all use the mailbox API, which doesn't provide a way to
 turn off dot-locking. ...

On second thought, the underlying error doesn't actually have
anything to do with locking - another process can open the
mailbox, and mailbox.py can replace the file before that process
even tries to lock it.  Andrew's test_concurrent_append()
originally *did* test for this, but commit c37cb11b546f changed
the single-file mailbox classes to just sync the file rather than
replacing it when messages have only been added, as in that test,
meaning it's no longer effective (for that issue at least).

I've now made a test for the original renaming-vs-copying issue
which just uses the simple _subprocess mechanism that the other
tests use, rather than trying to set up any special locking
conditions.  I've also split the tests into two patches -
mailbox-tests-2.7-part1-for-copy-back.diff has the test for the
original issue, and passes with the copy-back patch applied,
while mailbox-tests-2.7-part2.diff applies on top and includes
the rest (these involve the separate issues around rereading, and
mostly fail).

--
Added file: 
http://bugs.python.org/file34672/mailbox-tests-2.7-part1-for-copy-back.diff
Added file: http://bugs.python.org/file34673/mailbox-tests-2.7-part2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1599254
___# HG changeset patch
# Parent a293c01337a62718938d9639653cf1b8dfffa054

diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py
--- a/Lib/test/test_mailbox.py
+++ b/Lib/test/test_mailbox.py
@@ -13,6 +13,7 @@ from test import test_support
 import unittest
 import mailbox
 import glob
+from contextlib import contextmanager
 try:
 import fcntl
 except ImportError:
@@ -21,6 +22,27 @@ except ImportError:
 # Silence Py3k warning
 rfc822 = test_support.import_module('rfc822', deprecated=True)
 
+try:
+import multiprocessing
+except ImportError:
+multiprocessing = None
+else:
+@contextmanager
+def child_process(func, *args, **kwargs):
+Context manager to run a function concurrently in a child process.
+
+Runs func(*args, **kwargs) in a subprocess using
+multiprocessing and waits for it to terminate.
+
+
+process = multiprocessing.Process(target=func, args=args, 
kwargs=kwargs)
+try:
+process.start()
+yield
+finally:
+process.join()
+
+
 class TestBase:
 
 def _check_sample(self, msg):
@@ -45,6 +67,53 @@ class TestBase:
 test_support.unlink(target)
 
 
+def add_message(factory, path, msg):
+# Add msg to mailbox at path, using mailbox instance returned
+# by factory.
+mbox = factory(path)
+try:
+mbox.lock()
+mbox.add(msg)
+finally:
+mbox.close()
+
+def add_two_delete_one(factory, path, msg1, msg2):
+# Add msg1 and msg2 to mailbox at path, then delete msg1.
+# Uses mailbox instance returned by factory.
+mbox = factory(path)
+try:
+mbox.lock()
+key = mbox.add(msg1)
+mbox.add(msg2)
+# Flushing out two messages then deleting one ensures that for
+# the single-file mailbox formats, the subsequent flush has to
+# rewrite the mailbox.
+mbox.flush()
+del mbox[key]
+mbox.flush()
+finally:
+mbox.close()
+
+def only_yield():
+yield
+
+def child_func(to_child, from_parent, child, child_args):
+# Used by _subprocess method below.  Waits for Connection object
+# from_parent to receive EOF, and then calls child with
+# arguments child_args.
+try:
+to_child.close()
+try:
+from_parent.recv()
+except EOFError:
+pass
+else:
+raise AssertionError(Unexpectedly received data from parent 
+ process.)
+finally:
+from_parent.close()
+child(*child_args)
+
 class TestMailbox(TestBase):
 
 _factory = None # Overridden by subclasses to reuse tests
@@ -59,6 +128,166 @@ class TestMailbox(TestBase):
 self._box.close()
 self._delete_recursively(self._path)
 
+def _acquire_lock(self, mbox=None):
+# Keep trying to acquire lock on self._box (or mbox if given)
+# until we get it.
+if mbox is None:
+mbox = self._box
+while True:
+try:
+mbox.lock()
+break
+except mailbox.ExternalClashError:
+time.sleep(0.01)
+
+@contextmanager
+def _locked(self, mbox=None):
+# Context manager to lock and unlock self._box, or mbox if given.
+if mbox is None:
+mbox = self._box
+try:
+self._acquire_lock(mbox)
+

[issue21106] Updated Mac folder icon

2014-03-30 Thread Vivek Jain

Vivek Jain added the comment:

I just emailed psf-tradema...@python.org (and CC'd assignee ned.deily) 
requesting permission to use the logo.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21106
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21106] Updated Mac folder icon

2014-03-30 Thread Ned Deily

Ned Deily added the comment:

Thanks for your contribution.  I think the more important issue here is the use 
of the Apple folder icon.  Someone would need to research what restrictions if 
any exist before we could consider using an icon based on it.

The current icons were added back in 2006.  I don't know whether they were 
based on Apple icons and/or to what extent license issues were researched then. 
 Perhaps Jacob or Ronald remembers.  If there is a question, we could just 
eliminate use of the folder icon

changeset:   38177:676492a93c8a
branch:  legacy-trunk
user:Ronald Oussoren ronaldousso...@mac.com
date:Sun May 14 20:35:41 2006 +
files:   Mac/OSX/Icons/Disk Image.icns Mac/OSX/Icons/IDLE.icns 
Mac/OSX/Icons/Python Folder.icns Mac/OSX/Icons/PythonCompiled.icns 
Mac/OSX/Icons/PythonLauncher.icns Mac/OSX/Icons/PythonSource.icns Mac/
description:
A first cut at replacing the icons on MacOS X. This replaces all icons by icons
based on the new python.org logo. These are also the first icons that are
proper OSX icons.

These icons were created by Jacob Rus.

--
nosy: +jrus

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21106
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19655] Replace the ASDL parser carried with CPython

2014-03-30 Thread Eli Bendersky

Eli Bendersky added the comment:

There were no serious objections bar the pre-release timing. Now that we're 
safely in 3.5 territory, can I go ahead and create a patch?

Note that for purposes of review, the Github project linked in the original 
message is more convenient, IMHO

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19655
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15955] gzip, bz2, lzma: add option to limit output size

2014-03-30 Thread Nadeem Vawda

Nadeem Vawda added the comment:

Thanks for the patch, Nikolaus. I'm afraid I haven't had a chance to look
over it yet; this past week has been a bit crazy for me. I'll definitely
get back to you with a review in the next week, though.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15955
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21106] Updated Mac folder icon

2014-03-30 Thread Vivek Jain

Vivek Jain added the comment:

Some searching turned up http://www.apple.com/legal/contact/#copyright. I have 
contacted Apple through the form and will keep you guys updated. Hopefully they 
will respond.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21106
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21090] File read silently stops after EIO I/O error

2014-03-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Python 2.7 uses C fopen() and fread(), so what happens probably is that fread() 
silences the error.

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21090
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >