Re: Python Worst Practices

2015-03-01 Thread Dave Angel

On 03/01/2015 08:59 PM, MRAB wrote:

On 2015-03-02 01:37, Dennis Lee Bieber wrote


You'd be able to run it on a TI99/4 (in which the BASIC interpreter,
itself, was run on an interpreter... nothing like taking the first
"16-bit"
home computer and shackling it with an interpreted language that was
run on
an interpreted language)


The "16-bit" CPU had a 16-bit address bus (64K address space). If you
were going to switch from an 8-bit processor to a 16-bit processor, one
of the pluses you'd be looking for would the ability to directly
address more than 64K.



The 16 bit address bus permitted addressing of 64k words.  On most 
processors, that was 64k bytes, though I know one Harris had no bytes, 
but every memory access was 16 bits.  It therefore had the equivalent of 
128k bytes.  Likewise I believe some of the DEC and DG minis had 128k 
bytes of addressability.


Usually, the term 8bit processor was referring to the size of the 
register(s), not the address bus.  All the 8 bit micro-processors had 16 
bit address buses.  In fact, 4 bit processors generally had 12 to 16 bit 
address buses as well.  So a 4 bit processor with a 16 bit address bus 
could address 32k bytes, a half byte (a nybble) at a time).


The IBM PC's 8088 had an 8 bit data-bus and 20 address lines.  But they 
called it a 16bit processor, to try to distinguish it from 8 bit 
processors like the 8080.  Anyway, it was code compatible with the 8086, 
which really did have a 16bit data bus and 20 bit address bus.


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


Re: Python Worst Practices

2015-03-01 Thread Marko Rauhamaa
Rustom Mody :

>> However, when I exhange software engineering ideas with you, I wish
>> both of us could stick to American English.
>
> [...]
>
> I would say it is wrong side of the ledger because the amount of
> culture' invested into a Brit is more than into someone who just
> poorly learned the language yesterday.
>
> In school my most memorable encounters were with Shakespeare, Blake,
> Wordsworth [I did not like Keats]. Until he died at 102 my gpa would
> recite Longfellow's "Lives of great men" almost as a daily prayer. If
> all that gets erased for some tasteless colourless (ok colorless)
> internationalese, its a bloody shame.

We are not talking about culture here but Python coding, conference
keynote addresses at the most "cultured" end of it.


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


Re: Python Worst Practices

2015-03-01 Thread Rustom Mody
On Sunday, March 1, 2015 at 10:32:00 PM UTC+5:30, Marko Rauhamaa wrote:
> Mark Lawrence :
> 
> > Are you suggesting that we Brits have a single "home accent"?  If you
> > are, you need to stand up as your voice is rather muffled.  That by the
> > way is a British expression that may or may not be used around the
> > Commonwealth.  Should we unlearn it to fit in with American English? Two
> > chances, zero or none.
> 
> What you (or I) speak in our native surroundings is up to you (and me).
> 
> However, when I exhange software engineering ideas with you, I wish both
> of us could stick to American English.

When I was in college, there was this course called ‹Accounting and Bookkeeping›
It was a disaster since I always accounted on the wrong side of the ledger.
I guess I only passed because the teacher occasionally also accounted on the 
wrong side of the ledger!!

With due respect Marko, are you accounting on the wrong side of the ledger?

If some non-native of English expresses him/herself poorly we still try to 
understand – its even in the code of conduct or somethin

And yet you insist that a Brit (or English or whatever) should change his ways¹?

I would say it is wrong side of the ledger because the amount of 'culture' 
invested
into a Brit is more than into someone who just poorly learned the language 
yesterday.

In school my most memorable encounters were with Shakespeare, Blake, Wordsworth
[I did not like Keats].
Until he died at 102 my gpa would recite Longfellow's "Lives of great men" 
almost
as a daily prayer.
If all that gets erased for some tasteless colourless (ok colorless) 
internationalese, its a bloody shame.

=
¹Reminds of the modern mania for 'rights'
Yeah some groups – women, races, skin-colors etc etc etc – have been 
traditionally
have-nots. If the attempt at equalizing is not done in balance instead
of equalization we get a swing in the opposite direction and the haves become
the have-nots.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2015-03-01 Thread Chris Angelico
On Mon, Mar 2, 2015 at 2:18 PM, Paul Rubin  wrote:
> Steven D'Aprano  writes:
>> The Aussie replies “Ah yes, I had a car like that once. American-made, is
>> it?”
>
> Is it true that in Australia, the number of the beast is 999?

Wouldn't know. Out here, we're not afraid of the beast - why should we
be? We have spiders, and snakes, and kangaroos, and weather, and
desert, and ants, and spiders, and drop bears, and spiders, and
"jelly" (gelignite), and I nearly forgot to mention that we have
spiders. If you feel like disposing of an unwanted Beast, you could do
worse than deposit him somewhere in the Western Australian desert.
It's kinda like sending him to hell, only the postage is cheaper.

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


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

2015-03-01 Thread Paul Rubin
Steven D'Aprano  writes:
> The Aussie replies “Ah yes, I had a car like that once. American-made, is 
> it?”

Is it true that in Australia, the number of the beast is 999?
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2015-03-01 Thread Steven D'Aprano
Dennis Lee Bieber wrote:

> Well... when we've got states bigger than some countries...

A Texan farmer goes to Australia on vacation. There he meets an Aussie 
farmer and gets to talking. They walk around the farm a little, and the 
Aussie shows off his herd of cattle. The Texan immediately replies, “Our 
Texan longhorns are at least twice as large as your cows.”

The Aussie shows off his big wheat field and the Texan says, “In Texas, our 
wheat fields are ten times as big as that!”

Just then a herd of kangaroos hop through the field. The Texan does a 
double-take and says "What in San Quentin are those?”

The Aussie replies “Don’t you have any grasshoppers in Texas?” 

The Texan recovers quickly and says “Of course we do, I’ve just never seen 
them that color before. You’ve got a nice farm, but it’s a bit small. Back 
home, when I drive around the ranch checking the fences, I get in my SUV at 
4 in the morning, and don’t get back home until 11 the next night.”

The Aussie replies “Ah yes, I had a car like that once. American-made, is 
it?”



-- 
Steve

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


Re: Python Worst Practices

2015-03-01 Thread MRAB

On 2015-03-02 01:37, Dennis Lee Bieber wrote:

On Sun, 1 Mar 2015 13:43:50 +1100, Chris Angelico 
declaimed the following:


losing performance. Conversely, I'm sure Python could also have been
implemented on top of BASIC if someone felt like it, though what the
advantages might be I have no idea. But performance is not (or should


You'd be able to run it on a TI99/4 (in which the BASIC interpreter,
itself, was run on an interpreter... nothing like taking the first "16-bit"
home computer and shackling it with an interpreted language that was run on
an interpreted language)


The "16-bit" CPU had a 16-bit address bus (64K address space). If you
were going to switch from an 8-bit processor to a 16-bit processor, one
of the pluses you'd be looking for would the ability to directly
address more than 64K.

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


Re: An injury when I was a sbhoolboy; I was bitten by a bat.

2015-03-01 Thread Ben Finney
Ben Finney  writes:

> (See https://www.youtube.com/watch?v=Yz2LaJOVAiA> if you have no
> idea what this is all about.)

I was sloppy with my pronouns there. I'm pretty sure Roy knows what he's
referring to; that “you” was directed to anyone who is not aware.

-- 
 \   “Some people have a problem, and they think “I know, I'll use |
  `\ Perl!”. Now they have some number of problems but they're not |
_o__) sure whether it's a string or an integer.” —Benno Rice, 2011 |
Ben Finney

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


An injury when I was a sbhoolboy; I was bitten by a bat. (was: Python Worst Practices)

2015-03-01 Thread Ben Finney
Roy Smith  writes:

> In article ,
>  Gregory Ewing  wrote:
>
> > But in documentation, in contexts where it's not critical, I'm more
> > likely to use the spelling I'm most familiar with, which is
> > "colour". I can't imagine any English speaker, native or otherwise,
> > being unable to cope with that.
>
> What abut people who can't pronounce the letter "B"?

You mean the letter “C”? Yes, I thought so.

Well why not pronounce the letter “C” as though it were the letter “K”?

(See https://www.youtube.com/watch?v=Yz2LaJOVAiA> if you have no
idea what this is all about.)

Alternatively, I could ask you to pronounce “busy” as though it was
spelled with an “i”; or pronounce “friend” as though it *doesn't* have
an “i”. But that would be asking for sense in English orthography
https://www.theatlantic.com/education/archive/2015/02/how-the-english-language-is-holding-kids-back/385291/>.

-- 
 \  “Any sufficiently advanced bug is indistinguishable from a |
  `\  feature.” —Rich Kulawiec |
_o__)  |
Ben Finney

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


OT Accents [was Re: Python Worst Practices]

2015-03-01 Thread Steven D'Aprano
Michael Torrie wrote:

> If you want a bit of fun, listen to Patrick Stewart reciting a poem in
> his native northern accent.  In school they drilled it out of him, I
> guess.

And then you have people like Alexis Denisof, husband to Alyson Hannigan,
best known for playing Wesley Wyndam-Pryce in Buffy and Angel, and for a
three second clip in The Avengers movie where he is in such heavy makeup
and prosthetics that he is almost unrecognisable. As Wesley, he has such a
sexy upper-crust British accent that he could could almost make straight
men turn. In real life, he sounds like Kermit the Frog on helium.



-- 
Steven

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


Re: Question about python package numpy

2015-03-01 Thread fl
On Sunday, March 1, 2015 at 1:25:59 PM UTC-8, Andrea D'Amore wrote:
> On 2015-03-01 20:32:34 +, fl said:
> 
> > import numpy
> > it succeeds. On http://wiki.scipy.org/Cookbook, it shows some interesting
> > code example snippet, such as Cookbook / ParticleFilter, Markov chain etc.
> 
> > I don't know how I can access these code examples, because I don't know 
> > where
> > Enthought Canopy installs these package.
> 
> Did you check Canopy's documentation?
> 
> Are you sure the examples in cookbook are installed with the package?
> You can print numpy.__file__ to know where the package is installed.
> 
> At [1] I see "You can get the source code for this tutorial here: 
> tandemqueue.py" with link to the file, why don't you get the source 
> files for the example from their pages?
> 
> 
> [1] http://wiki.scipy.org/Cookbook/Solving_Large_Markov_Chains
> 
> -- 
> Andrea

Thanks for your reply. I learned Python for about one week ago. The link 
in your reply does look like executable. But the second snippet about 
particle filter, see below please, looks award. i.e. I do not see the 
connection between the first and the second code snippet. I should save
them to one .py file? Or save to two files? What name should be for the
second file?


Thanks again.



...
http://wiki.scipy.org/Cookbook/ParticleFilter

The following code shows the tracker operating on a test sequence featuring 
a moving square against a uniform background.
Toggle line numbers
   1 if __name__ == "__main__":
   2   from pylab import *
   3   from itertools import izip
   4   import time
   5   ion()
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-03-01 Thread BartC

On 01/03/2015 16:16, Marko Rauhamaa wrote:

Steven D'Aprano :


Marko Rauhamaa wrote:

Learn it like everybody else has to.


Stockholm Syndrome :-)

"I learned English, and so everyone else should too."


No, the point is that if everybody else has taken the trouble of
learning American English, it shouldn't be too much to ask for the
British to make an effort as well.


Actually it is the Brits who are bilingual; we can watch British /or/ 
American TV shows and movies without needing subtitles. It's not always 
the case the other way around.


You have a point that American-English spellings have some domination 
internationally simply by sheer numbers (in the same way that C-style 
syntax has unfortunately permeated a great number of languages). But I 
think there are still a few places which have had a British influence 
which might still spell colour as "colour" (such as India with a 
population a mere 4 times as large as the USA).


But programming in the UK I'm going to spell variables that include the 
word "colour" with a "u". I'm sure that any Americans will be able to 
guess what it means, if they were ever to see my source codes. (BTW 
"color" gets underlined in red by my spell-checker, another reason to 
avoid it.)


While with any external interfaces that use "color", I often create an 
alias that uses "colour" (saves time later by not constantly misspelling 
it).


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


Re: Python Worst Practices

2015-03-01 Thread Mark Lawrence

On 01/03/2015 21:47, Roy Smith wrote:

In article ,
  Gregory Ewing  wrote:


But in documentation, in contexts where it's not critical,
I'm more likely to use the spelling I'm most familiar
with, which is "colour". I can't imagine any English
speaker, native or otherwise, being unable to cope with
that.


What abut people who can't pronounce the letter "B"?



It's people who can't pronounce "C" who are the problem, leading to 
troubles such as Kings Bollege Bambridge.  Americans also drop the "u" 
so it should be "abot" not "abut".


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Python Worst Practices

2015-03-01 Thread Roy Smith
In article ,
 Gregory Ewing  wrote:

> But in documentation, in contexts where it's not critical,
> I'm more likely to use the spelling I'm most familiar
> with, which is "colour". I can't imagine any English
> speaker, native or otherwise, being unable to cope with
> that.

What abut people who can't pronounce the letter "B"?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-03-01 Thread Gregory Ewing

Mario Figueiredo wrote:

But could you please point us to the ISO that details the
international standard for variable names? Or failing that, to the
public discussion that took place and decided American-English is the
de-facto language for variable names?


American became the standard for variable names the same
way most de-facto standards come into being -- by historical
accident and network effects. Many of the commonly-used
libraries happen to be written by Americans, and programming
languages being the way they are, anyone who uses them
has to follow suit.

When I'm programming I always spell it "color", even when
I don't strictly have to, because having two spellings in
the same body of code would be too confusing for everyone,
myself included.

But in documentation, in contexts where it's not critical,
I'm more likely to use the spelling I'm most familiar
with, which is "colour". I can't imagine any English
speaker, native or otherwise, being unable to cope with
that.

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


Re: Question about python package numpy

2015-03-01 Thread Andrea D'Amore

On 2015-03-01 20:32:34 +, fl said:


import numpy
it succeeds. On http://wiki.scipy.org/Cookbook, it shows some interesting
code example snippet, such as Cookbook / ParticleFilter, Markov chain etc.



I don't know how I can access these code examples, because I don't know where
Enthought Canopy installs these package.


Did you check Canopy's documentation?

Are you sure the examples in cookbook are installed with the package?
You can print numpy.__file__ to know where the package is installed.

At [1] I see "You can get the source code for this tutorial here: 
tandemqueue.py" with link to the file, why don't you get the source 
files for the example from their pages?



[1] http://wiki.scipy.org/Cookbook/Solving_Large_Markov_Chains

--
Andrea

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


Re: Python Worst Practices

2015-03-01 Thread alister
On Mon, 02 Mar 2015 07:26:22 +1100, Chris Angelico wrote:

> On Mon, Mar 2, 2015 at 7:16 AM, alister
>  wrote:
>> Last time I was is the USA I had a local ask me which state London was
>> in! (heck I know they only bother with their own history but I though
>> we played quite an important role in that)
> 
> See, that wasn't a geographic question, it was one of security alert
> level. He wanted to know if London was presently in a state of alarm.
> 
> ChrisA

unfortunately no, she didn't and was completely clueless. if fact she 
made the stereotypical air head in slasher movies look like a genius.




-- 
Some scholars are like donkeys, they merely carry a lot of books.
-- Folk saying
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-03-01 Thread Mario Figueiredo
On Sun, 01 Mar 2015 22:45:12 +0200, Marko Rauhamaa 
wrote:
>
>Fact remains I can easily understand what Chinese, Mexican, Italian,
>Russian or Malay colleagues say in English. For some reason, Australian
>and Indian speakers don't give me trouble, either. The Irish accent is
>borderline, but the British, sad to say, are hopeless.
>

You should listen to African English speakers...

This is probably common among many languages. Not that I have a common
understanding of the phenomena, but I can easily draw a parallel to
Portuguese. The European Portuguese is harder to understand to folks
learning the language than the non Portuguese dialects in Brazil,
African countries and even Macau in Asia.

This is also an issue among speakers of the language. European
Portuguese don't have any trouble understanding dialect speakers in
Angola, Brazil, Cape Verde, etc. But the those dialect speakers have
an hard time understanding the European Portuguese.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-03-01 Thread Marko Rauhamaa
alister :

> The language is called English, the clue is in the name.

I don't care what you call it as long as you use the Hollywoodese accent
and spelling.

> interestingly most 'Brits' can switch between American English &
> English without too much trouble

I wish they actually did.

Not to pick on the British. All native English-speakers seem to suffer
from the same problem.(*)

Fact remains I can easily understand what Chinese, Mexican, Italian,
Russian or Malay colleagues say in English. For some reason, Australian
and Indian speakers don't give me trouble, either. The Irish accent is
borderline, but the British, sad to say, are hopeless.


Marko

(*) Why, I speak Finnish in the local dialect; however, I *don't* try my
vernacular on any foreigner. The other day, a Russian colleague bravely
initiated a dialogue in Finnish. I was careful to speak slowly using the
standard dialect.
-- 
https://mail.python.org/mailman/listinfo/python-list


Question about python package numpy

2015-03-01 Thread fl
Hi,

It is difficult to install numpy package for my PC Windows 7, 64-bit OS. In
the end, I install Enthought Canopy, which is recommended on line because it 
does install numpy automatically. Now, I can test it with

import numpy

it succeeds. On http://wiki.scipy.org/Cookbook, it shows some interesting
code example snippet, such as Cookbook / ParticleFilter, Markov chain etc.

I don't know how I can access these code examples, because I don't know where
Enthought Canopy installs these package.

Could you help me on using numpy examples?


Thanks,

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


Re: Python Worst Practices

2015-03-01 Thread Chris Angelico
On Mon, Mar 2, 2015 at 7:16 AM, alister
 wrote:
> Last time I was is the USA I had a local ask me which state London was
> in! (heck I know they only bother with their own history but I though we
> played quite an important role in that)

See, that wasn't a geographic question, it was one of security alert
level. He wanted to know if London was presently in a state of alarm.

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


Re: Python Worst Practices

2015-03-01 Thread alister
On Sun, 01 Mar 2015 18:16:05 +0200, Marko Rauhamaa wrote:

> Steven D'Aprano :
> 
>> Marko Rauhamaa wrote:
>>> Learn it like everybody else has to.
>>
>> Stockholm Syndrome :-)
>>
>> "I learned English, and so everyone else should too."
> 
> No, the point is that if everybody else has taken the trouble of
> learning American English, it shouldn't be too much to ask for the
> British to make an effort as well.
>

The language is called English, the clue is in the name. interestingly 
most 'Brits' can switch between American English & English without too 
much trouble (I still have a problem with Chips) 

> 
> You can watch TV programmes at home, but in the office, you should be
> writing Python programs.
> 
> (Spelling deviations are actually minor nuisances. A bigger problem is
> when a Brit thinks they can use their home accent in international
> contexts.)
The bigger problem is that the USian does not know there even is an 
international context.
I know that us British/English are poor at learning other languages but 
we do at least acknowledge that we should do better.

Last time I was is the USA I had a local ask me which state London was 
in! (heck I know they only bother with their own history but I though we 
played quite an important role in that)

> 
> 
> Marko





-- 
You know it's going to be a long day when you get up, shave and shower,
start to get dressed and your shoes are still warm.
-- Dean Webber
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-03-01 Thread Mario Figueiredo
On Sun, 1 Mar 2015 11:23:51 -0800 (PST), wxjmfa...@gmail.com wrote:

>
>http://www.unicode.org/reports/tr31/
>
>Python is doing very on that sile.
>
>jmf
>

I'm glad Annex 31 agrees that I can name identifiers even in hebrew if
I really want to. For a moment there I was shaking when I opened the
link.

Must be some other document then. This one didn't help.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-03-01 Thread Marko Rauhamaa
Michael Torrie :

> On 03/01/2015 09:58 AM, Marko Rauhamaa wrote:

>> Well, every nonnative strives for the standard Hollywoodese and does
>> a decent job at that. But when I hear a Brit speak their native
>> tongue, I just "smile and wave, smile and wave" because I usually
>> have little idea what they are trying to explain.
>
> Ahh, I see. Your reaction, then, is similar to what most international
> English speakers do when they hear American politicians trying to
> speak in folksy southern accents.

Yes. Note that the Atlanta-based CNN has standardized on a Hollywood
accent(*). Only occasionally do the anchors slip and the Georgia accent
shines through.


Marko

(*) With some fake artefacts. For example, "negotiate" is pronounced
hypercorrectly [nə'goʊsəeɪt] instead of the standard [nə'goʊʃəeɪt].
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: iPython 3 released

2015-03-01 Thread Fabien

On 01.03.2015 19:24, Mark Lawrence wrote:

This seemed to be a low key affair, at least from my perspective


True, no messages yet on the scientific python mailing lists either. I 
am wondering if avoiding a massive switch to a *.0 release was the 
reason for this (relative) silence.


Fabien


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


Re: Python Worst Practices

2015-03-01 Thread Mario Figueiredo
On Sun, 01 Mar 2015 19:52:32 +0200, Marko Rauhamaa 
wrote:
>
>I mean, nobody's taking away your native language. It's just that
>everybody's got to learn a foreign language. The learning curve
>shouldn't be too steep for a native Brit.

That's fine. But could you please point us to the ISO that details the
international standard for variable names? Or failing that, to the
public discussion that took place and decided American-English is the
de-facto language for variable names?

It would help seal your argumentation for american-english naming
conventions on a positive note.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-03-01 Thread Michael Torrie
On 03/01/2015 09:58 AM, Marko Rauhamaa wrote:
> Well, every nonnative strives for the standard Hollywoodese and does a
> decent job at that. But when I hear a Brit speak their native tongue, I
> just "smile and wave, smile and wave" because I usually have little idea
> what they are trying to explain.

Ahh, I see.  Your reaction, then, is similar to what most international
English speakers do when they hear American politicians trying to speak
in folksy southern accents.

Seriously, though, it's interesting to note that in the previous
generations of Americans and Canadians, many people, including a
Hollywood actors, were taught elocution in schools, and a pseudo-posh
English (as in the country) sort of accent.  Completely fake of course
much like the Queen's accent.  My grandparents, for example had hints of
such an accent, particularly in certain words.  Christopher Plummer is a
great example of this half-posh accent.  Born and raised in Canada, he
certainly sounds nothing like common broad north American, and certainly
not common Canadian.  Just listening to recordings of radio
personalities and politicians from before 1950, and it's really
interesting to hear the differences between modern speaking, both in
accents and intonations.  Language changes.

If you want a bit of fun, listen to Patrick Stewart reciting a poem in
his native northern accent.  In school they drilled it out of him, I guess.

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


Re: suggestions for functional style (singleton pattern?)

2015-03-01 Thread Mario Figueiredo
On Mon, 02 Mar 2015 02:04:40 +1100, Steven D'Aprano
 wrote:

>Mario Figueiredo wrote:
>
>> (warning: Didn't bother prove-reading and spell chocking. Sorry...)
>
>Warning: didn't bother reading. Not sorry at all.

Ohh.. how hurtful of you.

It was 4:45 am when I posted that, after long hours trying to make
some code work on Erlang that needs to be ready by Monday. And only
because I wasn't seeing anyone replying to the OP request for help,
that was sitting there for quite a few hours while everyone else was
entertained discussing how many keywords are in a programming
language. After I replied, I went to bed. Exhausted and sleepy.

I'm not sorry you didn't read either, you pretentious prick. But I
find it funny you replied to say that.
-- 
https://mail.python.org/mailman/listinfo/python-list


iPython 3 released

2015-03-01 Thread Mark Lawrence
This seemed to be a low key affair, at least from my perspective, but 
I'm fairly certain that people here will be interested.


http://ipython.org/ipython-doc/3/whatsnew/version3.html

http://ipython.org/install.html

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Python Worst Practices

2015-03-01 Thread Mark Lawrence

On 01/03/2015 17:52, Marko Rauhamaa wrote:

Mark Lawrence :


On 01/03/2015 17:01, Marko Rauhamaa wrote:

What you (or I) speak in our native surroundings is up to you (and
me).

However, when I exhange software engineering ideas with you, I wish
both of us could stick to American English.


Well I'm not going to, so tough, or is that togh? Colour, harbour,
tyre, antogonise are the way I spell words, and I'm not changing the
habits of a lifetime simply because I'm on a technical site.


Wow, a somewhat Chauvinistic attitude, wouldn't you say? The French will
learn it. The Germans will learn it. Us Finns will learn it. Only you
won't learn it because you won't change the habits of a lifetime.

I mean, nobody's taking away your native language. It's just that
everybody's got to learn a foreign language. The learning curve
shouldn't be too steep for a native Brit.


Marko



I have German and Spanish 'O' levels taken 40 years ago.  I've no 
intention of going back to school to learn a dialect of my own language. 
 Why did those dumbos have to change it anyway, it's perfectly simple?


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Python Worst Practices

2015-03-01 Thread Marko Rauhamaa
Mark Lawrence :

> On 01/03/2015 17:01, Marko Rauhamaa wrote:
>> What you (or I) speak in our native surroundings is up to you (and
>> me).
>>
>> However, when I exhange software engineering ideas with you, I wish
>> both of us could stick to American English.
>
> Well I'm not going to, so tough, or is that togh? Colour, harbour,
> tyre, antogonise are the way I spell words, and I'm not changing the
> habits of a lifetime simply because I'm on a technical site.

Wow, a somewhat Chauvinistic attitude, wouldn't you say? The French will
learn it. The Germans will learn it. Us Finns will learn it. Only you
won't learn it because you won't change the habits of a lifetime.

I mean, nobody's taking away your native language. It's just that
everybody's got to learn a foreign language. The learning curve
shouldn't be too steep for a native Brit.


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


Re: Python Worst Practices

2015-03-01 Thread Mark Lawrence

On 01/03/2015 17:01, Marko Rauhamaa wrote:

Mark Lawrence :


Are you suggesting that we Brits have a single "home accent"?  If you
are, you need to stand up as your voice is rather muffled.  That by the
way is a British expression that may or may not be used around the
Commonwealth.  Should we unlearn it to fit in with American English? Two
chances, zero or none.


What you (or I) speak in our native surroundings is up to you (and me).

However, when I exhange software engineering ideas with you, I wish both
of us could stick to American English.


Marko



Well I'm not going to, so tough, or is that togh?  Colour, harbour, 
tyre, antogonise are the way I spell words, and I'm not changing the 
habits of a lifetime simply because I'm on a technical site.


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Python Worst Practices

2015-03-01 Thread Marko Rauhamaa
Mark Lawrence :

> Are you suggesting that we Brits have a single "home accent"?  If you
> are, you need to stand up as your voice is rather muffled.  That by the
> way is a British expression that may or may not be used around the
> Commonwealth.  Should we unlearn it to fit in with American English? Two
> chances, zero or none.

What you (or I) speak in our native surroundings is up to you (and me).

However, when I exhange software engineering ideas with you, I wish both
of us could stick to American English.


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


Re: Python Worst Practices

2015-03-01 Thread Marko Rauhamaa
Chris Angelico :

> On Mon, Mar 2, 2015 at 3:16 AM, Marko Rauhamaa  wrote:
>> (Spelling deviations are actually minor nuisances. A bigger problem
>> is when a Brit thinks they can use their home accent in international
>> contexts.)
>
> Of course, because there's one "international accent" that everyone
> except the Brits use, isn't there?

Well, every nonnative strives for the standard Hollywoodese and does a
decent job at that. But when I hear a Brit speak their native tongue, I
just "smile and wave, smile and wave" because I usually have little idea
what they are trying to explain.


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


Re: Python Worst Practices

2015-03-01 Thread Mark Lawrence

On 01/03/2015 16:42, Chris Angelico wrote:

On Mon, Mar 2, 2015 at 3:38 AM, Mark Lawrence  wrote:

Are you suggesting that we Brits have a single "home accent"?  If you are,
you need to stand up as your voice is rather muffled.  That by the way is a
British expression that may or may not be used around the Commonwealth.
Should we unlearn it to fit in with American English? Two chances, zero or
none.


It's not one that we use out here in the Antipodes... probably a
British peculiarity. Or perhaps an English peculiarity, but I would
guess more likely British.

ChrisA



British.  Never call me English, my mum was Welsh and would come back 
from the grave to haunt you :)


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Python Worst Practices

2015-03-01 Thread Chris Angelico
On Mon, Mar 2, 2015 at 3:38 AM, Mark Lawrence  wrote:
> Are you suggesting that we Brits have a single "home accent"?  If you are,
> you need to stand up as your voice is rather muffled.  That by the way is a
> British expression that may or may not be used around the Commonwealth.
> Should we unlearn it to fit in with American English? Two chances, zero or
> none.

It's not one that we use out here in the Antipodes... probably a
British peculiarity. Or perhaps an English peculiarity, but I would
guess more likely British.

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


Re: Python Worst Practices

2015-03-01 Thread Mark Lawrence

On 01/03/2015 16:16, Marko Rauhamaa wrote:

Steven D'Aprano :


Marko Rauhamaa wrote:

Learn it like everybody else has to.


Stockholm Syndrome :-)

"I learned English, and so everyone else should too."


No, the point is that if everybody else has taken the trouble of
learning American English, it shouldn't be too much to ask for the
British to make an effort as well.

You can watch TV programmes at home, but in the office, you should be
writing Python programs.

(Spelling deviations are actually minor nuisances. A bigger problem is
when a Brit thinks they can use their home accent in international
contexts.)


Marko



Are you suggesting that we Brits have a single "home accent"?  If you 
are, you need to stand up as your voice is rather muffled.  That by the 
way is a British expression that may or may not be used around the 
Commonwealth.  Should we unlearn it to fit in with American English? 
Two chances, zero or none.


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Python Worst Practices

2015-03-01 Thread Chris Angelico
On Mon, Mar 2, 2015 at 3:16 AM, Marko Rauhamaa  wrote:
> No, the point is that if everybody else has taken the trouble of
> learning American English, it shouldn't be too much to ask for the
> British to make an effort as well.
>
> You can watch TV programmes at home, but in the office, you should be
> writing Python programs.

A programme is what you sell for five bucks in the theatre lobby. A
program is something you execute to figure out how much money you lost
on the show. Different words.

> (Spelling deviations are actually minor nuisances. A bigger problem is
> when a Brit thinks they can use their home accent in international
> contexts.)

Of course, because there's one "international accent" that everyone
except the Brits use, isn't there?

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


Re: Python Worst Practices

2015-03-01 Thread Marko Rauhamaa
Steven D'Aprano :

> Marko Rauhamaa wrote:
>> Learn it like everybody else has to.
>
> Stockholm Syndrome :-)
>
> "I learned English, and so everyone else should too."

No, the point is that if everybody else has taken the trouble of
learning American English, it shouldn't be too much to ask for the
British to make an effort as well.

You can watch TV programmes at home, but in the office, you should be
writing Python programs.

(Spelling deviations are actually minor nuisances. A bigger problem is
when a Brit thinks they can use their home accent in international
contexts.)


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


Re: suggestions for functional style (singleton pattern?)

2015-03-01 Thread Steven D'Aprano
Michael Torrie wrote:

> Is not "only one object is ever created from a given class" the same as
> "could not be [instantiated] more than once?"

Not really.

A class which you merely happen to only instantiate once is not a singleton
class. It's just a class that you instantiate N times, where so far N has
only equalled 1.

A singleton class on the other hand is a class where N *must* equal 1,
because the class itself enforces that rule.

More generally, N may equal some small value, e.g. a Boolean class might
have a fixed set of exactly 2 instances. Sometimes people try to invent
names like "doubleton" for these, but none of those names have really taken
off.

Python modules are an interesting case. Although we often call them
singletons, they're actually nothing like a singleton. Modules are
instances of ModuleType, and there is no upper limit to the number of
instances that can be created. It's not even true that Python enforces only
a single instance per module, there are ways to get around that (albeit
normally you don't want to get around it!). Here is just once way:


# Don't do this at home!
py> import sys
py> mysys = sys
py> del sys.modules['sys'], sys
py> import sys
py> sys is mysys
False


Nevertheless, modules can be used to implement similar semantics to those of
singleton classes, and in particular they provide the most important
features of singleton classes for free. But calling them singletons just
because they quack like singletons is a little weird. Next we'll be calling
the Borg pattern "singletons".




-- 
Steven

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


Re: suggestions for functional style (singleton pattern?)

2015-03-01 Thread Steven D'Aprano
Mario Figueiredo wrote:

> (warning: Didn't bother prove-reading and spell chocking. Sorry...)

Warning: didn't bother reading. Not sorry at all.



-- 
Steven

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


Re: Python Worst Practices

2015-03-01 Thread BartC

On 01/03/2015 02:08, Steven D'Aprano wrote:

BartC wrote:


On 28/02/2015 15:33, Mark Lawrence wrote:


It also makes me wonder what idiot decided to use C as the language for
the first Python implementation? Or was it written in something else and
then ported?


Python was already slow enough even written in C.



Tell that to the IronPython developers.


This was about the first implementation of Python. Wikipedia tells me 
that Python first appeared in 1991, while IronPython dates from 2006, 
and is apparently written in C# which came out in 2000.


> Of course, benchmarks are very variable, depending on what you wish 
to do,

> and a few things (like exceptions) are very much slower in IronPython:
>
> 
http://ironpython.codeplex.com/wikipage?title=IP27A1VsCPy27Perf&referringTitle=IronPython%20Performance


And Hello World seems to be about 15 times slower. (Actually how can any 
Hello World program take more than a second to run?)


--
Bartc

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


ANN: grc 1.7 released

2015-03-01 Thread garabik-news-2005-05
This is generic colouriser, version 1.7.

grc is a colouriser configured by regular expressions, including 
a simple command line wrapper for some commonly used unix commands.

Notable changes in this version:
 - add the possibility to replace text in addition to colouring
 - add several configuration files

License: GPL (any version)

URL: http://kassiopeia.juls.savba.sk/~garabik/software/grc.html

-- 
 ---
| Radovan Garabík http://kassiopeia.juls.savba.sk/~garabik/ |
| __..--^^^--..__garabik @ kassiopeia.juls.savba.sk |
 ---
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PIL installation fails; registration problem

2015-03-01 Thread GerritM
Some more searching brought me to Pillow. That seems to work!

No answer needed anymore on previous question.


On Saturday, February 28, 2015 at 9:51:53 PM UTC+1, GerritM wrote:
> I am reinstalling everything on my new Windows 7 laptop. I run into a problem 
> when installing PIL 1.1.7, in combination with my Activestate Python 2.7.8.
> 
> The PIL installer complains that no Python is registered. I did run Joakim 
> Löw's script to register Python. This results in the message "*** You 
> probably have another Python installation!". Adding some code to this script 
> reveals that my Python is registered with the following values (deviating 
> from the values in the script):
> installkey: C:\Python27\
> pythonkey C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk
> 
> The script proposes for pythonkey: 
> C:\Python27;C:\Python27\Lib\;C:\Python27\DLLs\
> 
> Can I change the pythonkey to the value proposed by Joakim Löw's script?

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


Re: Python Worst Practices

2015-03-01 Thread Steven D'Aprano
Marko Rauhamaa wrote:

> The language of science and technology is American English.

Not so. Despite claims that "99% of science publishing is done in English",
there are still significant amounts of science and technology published in
non-English languages. And the majority which is published in English
doesn't necessarily use American English. 

E.g. I searched for article titles containing "colour" in The Lancet, the
world's premier medical journal, and found 328 results, versus 8
for "color".

http://www.thelancet.com/action/doSearch?searchType=quick&searchText=colour&occurrences=articleTitle&journalCode=&searchScope=fullSite


Likewise Nature uses Oxford spelling:

http://en.wikipedia.org/wiki/Oxford_spelling



Not surprisingly, the use of English varies by field and nationality.
According to this study:

http://www.researchtrends.com/issue-31-november-2012/the-language-of-future-scientific-communication/

Dutch scientists publish in English forty times as much as they publish in
their native language, while Chinese scientists do so only twice as often.

According to astronaut Chris Hadfield's autobiography, being able to speak
and read fluent Russian is essential for astronauts on the ISS, especially
if they want to fly a Soyuz. I would expect that robotics is mostly written
in Japanese.

It is not a given that science and technology should be (1) monlingual, and
(2) using the language of the dominant political superpower. As this
article points out, monoglot science is neither historically inevitable,
nor necessarily a good thing:

http://aeon.co/magazine/science/how-did-science-come-to-speak-only-english/

Don't imagine for one second that the entire world is willing to meekly
follow the path to American cultural hegemony:

http://www.goethe.de/lhr/prj/diw/dos/enindex.htm

(The irony of Germans publish pro-German articles in English has not escaped
me, but if they had published them in German I wouldn't have found them.)

As Russia flexes its muscles and tries to reclaim it's co-superpower role,
I'm sure that there will be more hard sciences and mathematics published in
Russian. Chinese is already one of the world's major diplomatic and trade
linga francas, and somewhere between 1/3 and 1/2 of Chinese science and
technology journals already publish in Chinese. If you want to specialise
in solar power engineering, I suggest you learn German and Chinese.

In IT, we have this:

http://blog.stackoverflow.com/2014/02/cant-we-all-be-reasonable-and-speak-english/


I suspect that we're probably close to peak Anglophone science, and that in
the next decade or so the trend will reverse. My prediction is that over
the next half century, we'll return to a polyglot situation.


> Learn it like everybody else has to.

Stockholm Syndrome :-)

"I learned English, and so everyone else should too."

I often get the impression that many coders have an attitude that suffering
is good for their art. "If it was hard for me to write, it should be hard
for you to maintain" is part of it. Far too many coders love languages that
make good programming *hard* (but not too hard, of course), and resist
languages with garbage collection, compiler enforced safety, etc. It's not
a universal thing, of course, otherwise Python, Java, etc. would be tiny
niche languages, but the myth of the heroic genius programmer dies hard. I
think that inside every hacker there is tiny bit of admiration for Mel the
Real Programmer:

https://www.cs.utah.edu/~elb/folklore/mel.html

even if he didn't use a magnetised needle and a steady hand.

http://xkcd.com/378/



-- 
Steven

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