Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-06 Thread DaveM
On Tue, 28 Jun 2005 14:52:44 -0700, James Stroud <[EMAIL PROTECTED]>
wrote:

>Frankly, I can't watch Shakespeare or movies like "the full monty" or 
>"trainspotting" because I can't understand a damn word they say. British talk 
>sounds like gibberish to me for the most part.

Not just you. It always amuses me in trips to the US that British voices
(outside of the movies) are often subtitled, while first-generation
Americans whose English is. um, limited, are not.

Try pretending the British accents are from naturalised US citizens. That
should do the trick.

DaveM 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-06 Thread DaveM
On Fri, 07 Oct 2005 00:33:43 -, Grant Edwards <[EMAIL PROTECTED]> wrote:

>On 2005-10-06, DaveM <[EMAIL PROTECTED]> wrote:
>
>>>Frankly, I can't watch Shakespeare or movies like "the full
>>>monty" or "trainspotting" because I can't understand a damn
>>>word they say. British talk sounds like gibberish to me for the
>>>most part.
>>
>> Not just you. It always amuses me in trips to the US that
>> British voices (outside of the movies) are often subtitled,
>> while first-generation Americans whose English is. um,
>> limited, are not.
>
>What?!?  I've never seen a British voice (inside or outside of
>the movies) subtitled -- with the exception of one of a
>nightclub scenes in one movie (I think it was Trainspotting)
>where the dialog was inaudible because of the music.

I noticed this watching news footage rather than imported shows. I haven't
seen 'Trainspotting', but I have seen Scottish accents subtitled
(unnecessarily) on English TV, to understandable anger across the border -
so this isn't uniquely a US phenomenon, to be fair.


>For example: In British English one uses a plural verb when the
>subject consists of more than one person.  Sports teams,
>government departments, states, corporations etc. are 
>grammatically plural.  In American, the verb agrees with the
>word that is the subject, not how many people are denoted by
>that word.
>
>In sports (thats "sport" for you Brits):

Yes.

> American: Minnesota is behind 7-0.  The Vikings are behind 7-0.
>  British: Minnesota are behind 7-0. The Vikings are behind 7-0.

True.

>In politics:

>  American: The war department has decided to cancel the program.
>   British: The war department have decided to cancel the program.

Not sure about this one. They may be used interchangeably as neither strikes
me as sounding "odd".

DaveM
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-10 Thread DaveM
On Fri, 7 Oct 2005 15:57:14 -0500, Terry Hancock
<[EMAIL PROTECTED]> wrote:

>In a Texas dialect, "their" is construed to mean "singular third person
>of indeterminate gender". It's considered rude to use "it" to apply to
>a sentient, and "his or her" is "PC" (and therefore a great sin ;-) ).

Working in a hospital, it always jars when a patient of unknown sex is
referred to as "It". I always use they/them/their, so it's not unique to
Texas.


DaveM
-- 
http://mail.python.org/mailman/listinfo/python-list


Sorting dominoes

2005-11-13 Thread DaveM
Essentially, I'm trying to sort 12 dominoes. Each domino has two different
numbers and there are two of every number. Identical dominoes are possible,
but doubles are not.

The problem is to place the dominoes in a line, side to side, so that two
columns (or rows, depending how you orientate them) are formed, with each
number appearing once in each column(row).

I thought this would be the easy part of the program I'm writing, but so far
some initial states have defeated every attempt I've made, short of
re-shuffling the dominoes after an arbitrary number of attempts.

I'm sure I'll work out an effective algorithm eventually, but I suspect I'm
re-inventing the wheel, so any hints on the best way to tackle this would be
appreciated!

DaveM 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Degrees as barriers to entry [was Re: - E04 - Leadership! Google, Guido van Rossum, PSF]

2006-01-04 Thread DaveM
On 3 Jan 2006 20:09:34 -0800, [EMAIL PROTECTED] (Aahz) wrote:

>Unfortunately, this isn't quite true.  Medicine and law both require the
>passing of an apprenticeship, so there's still some room for favoritism
>and blackballing.

In the UK, in Medicine, House Officer jobs pretty much match the
qualification numbers. Sure, which HO post you get can give your career a
head start, but that advantage is evanescent if you can't cut the mustard.

Fouling your career by upsetting the wrong people is, OTOH, easy to do.

DaveM
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: invert or reverse a string... warning this is a rant

2006-10-23 Thread DaveM
On Thu, 19 Oct 2006 20:07:27 -0400, Brad <[EMAIL PROTECTED]> wrote:


>It has been my experience that Python has discouraging forums with 
>someone always calling someone else an idiot or telling them they are 
>awful in some way. I love Python, but the community is way too negative, 
>uptight and generally down on users who do not have PhD's in CS or Math.

>Do you have children? How would your child feel if he brought you 
>something he had made and you then told him it was awful in *sooo* many 
>ways. How does that reflect on you and the community you represent?

Wow. Maybe I have thicker skin than you, or perhaps you're a professional
whose self-worth has been damaged, but I would have been grateful for that
critique, not angry. To each his own, I suppose.

DaveM
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: beginner code problem

2006-06-02 Thread DaveM
On Fri, 2 Jun 2006 18:41:53 -0400, RJ <[EMAIL PROTECTED]> wrote:

>  I'm trying to teach myself Python (probably running into the old dog 
>new tricks issue) and I'm trying to start with the very basics to get a 
>handle on them.
>
>  I'm trying to write code to get the computer to flip a coin 100 times 
>and give me the output of how many times heads and tails. After solving 
>a few syntax errors I seem to be stuck in an endless loop and have to 
>kill python. A few times I would get it to print 'heads 0 (or 1) times 
>and tails 1 (or 0) times' 100 times.
>
>Here's the code I wrote:
>
>import random
>
>flip = random.randrange(2)
>heads = 0
>tails = 0
>count = 0
>
>while count < 100:
>
>   if flip == 0:
>   heads += 1
>   
>   else:
>   tails += 1
>   
>
>   count += 1
>   
>   
>
>print "The coin landed on heads", heads, 'times ' \
> "and tails", tails, 'times'

Several problems here. "flip" is defined just once, so you'll either have
100 heads or tails and your whitespace is all wrong - that's important in
Python. Here's how it should look:

import random

def coinflip():
heads = 0
tails = 0
for goes in range(100):
if random.randrange(2) == 1:
heads += 1
else:
tails += 1
print "heads", heads
print "tails", tails

if __name__ == "__main__":
coinflip()

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


Re: does anybody earn a living programming in python?

2006-09-30 Thread DaveM
On Thu, 28 Sep 2006 00:20:11 +1000, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:

>The
>dictionary definition of countless is "too many to count" (Pocket Oxford),
>which I suppose could be 11 for some people if they didn't take their
>shoes and socks off. Mathematically, any finite integer is able to be
>counted, so "countless" is equivalent to "infinite in number".

While we're being pedantic, there are many more ways to be "too many to
count" than infinity. Counting is a physical process that depends as much on
the counter and circumstances of counting as on the number to be counted.

DaveM
-- 
http://mail.python.org/mailman/listinfo/python-list


Global variables, Classes, inheritance

2006-02-03 Thread DaveM
Although I've programmed for fun - on and off - since the mid 70's, I'm
definitely an OO (and specifically Python) beginner. 

My first question is about global variables. Are they, as I'm starting to
suspect, a sin against God or just best avoided? Having got my current
application working using them, I'm not sure whether I want to refactor it,
but equally, I'd like to write the best code I can.

Secondly (and this is related),  if you have multiple instances of the same
class, but need them all to have access to a dictionary created at run-time,
is there a class way to this without calling the creation method multiple
times? The best thought I've come up with is for the class instance to check
its name and only if it's the first one do the dictionary creation, but I
haven't tried it yet.

My third difficulty is with variables in a class. What's the difference
between the following?:

class Foo:
i = 12345
...

class Foo:
self.i = 12345
...

class Foo:
def __init__(self):
self.i = 12345
...

class Foo:
    def __init(self):
i = 12345
...

DaveM
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Global variables, Classes, inheritance

2006-02-06 Thread DaveM
Thanks very much for the help to all who replied.
I'd completely missed the difference between:

class Foo:
   i = 12345

a = Foo()
b = Foo()

a.i = 678

and Foo.i = 678

Yeah, I know...

DaveM
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 2.4.2 + Zone Alarm

2006-02-23 Thread DaveM
On 20 Feb 2006 16:26:15 -0800, "DannyB" <[EMAIL PROTECTED]> wrote:

>I believe this issue is known - I haven't found a way around it.
>
>ZoneAlarm seems to be stopping IDLE from running.
>I get two errors:
>
>"Socket Error:  Connection refused"
>and
>"IDLE's subprocess didn'tt make connection.  Either IDLE can't start a
>subprocess or personal firewall software is blocking the connection."
>
>I know they are both due to ZA - I've set up ZA to allow Python to
>access the internet w/o prompting me (even though I now it doesn't
>actually access the internet.)
>
>This usually happens after I create a script and run it in the GUI - if
>the script ends up being a never ending loop - I X out of IDLE to stop
>it.  The next time I try to run a script I get the errors until I
>reboot the computer.
>
>IIs there a fix?  I'm pretty sure that this problem started with 2.3.1
>(i'm suing 2.4.2).

I get an the same problem in those circumstances, although I can't remember
if I get that error message (and I use ZoneAlarm).

Windows task manager shows pythonw.exe still running and terminating the
process allows IDLE to start normally. Easier than rebooting. PythonWin
doesn't suffer this problem, btw.

DaveM
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Who uses Python?

2007-06-04 Thread DaveM
On Mon, 04 Jun 2007 12:37:10 -0700, walterbyrd <[EMAIL PROTECTED]> wrote:

>I mean other than sysadmins, programmers, and web-site developers?
>
>I have heard of some DBAs who use a lot of python.
>
>I suppose some scientists. I think python is used in bioinformatics. I
>think some math and physics people use python.
>
>I suppose some people use python to learn "programming" in general.
>Python would do well as a teaching language.
>
>I would think that python would be a good language for data analysis.
>
>Anything else? Finance? Web-analytics? SEO? Digital art?

I'm a hobbyist. No, that's not right - I run a course and I learnt the
language writing a program to allocate tutors and students to tutorial
groups over a three day course I run. I don't know what that makes me - and,
no, I don't want any helpful answers!

DaveM
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: list index()

2007-08-31 Thread DaveM
On Fri, 31 Aug 2007 02:37:15 -0700, Erik Max Francis <[EMAIL PROTECTED]>
wrote:

>_Troll_ and _frolic_ aren't pronounced with the same "o" sound in any 
>accent I've ever heard of.  

You've never heard an English accent then.

>Which you pronounce _boat_ and _bot_ the same way, too?

No - but I would pronounce "lever" and "fever" the same way, if that helps.

DaveM
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Spell-checking Python source code

2007-09-08 Thread DaveM
On Sat, 08 Sep 2007 14:04:55 -0700, John Zenger <[EMAIL PROTECTED]>
wrote:

> In an ideal world, my IDE would do this with a red wavy line.

I can't help with your problem, but this is the first thing I turn off in
Word. It drives me _mad_. 

Sorry - just had to share that.

DaveM
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can Python be useful as functional? (off topic)

2007-09-19 Thread DaveM
On Tue, 18 Sep 2007 21:06:39 +0100, Jonathan Fine <[EMAIL PROTECTED]> wrote:

>Steve Holden wrote:
>
>> You remind me of the conversation between the philosopher and an 
>> attractive lady whom he was seated next to at dinner. He asked her if 
>> she would sleep with him for a million dollars, to which she readily 
>> agreed. So he followed this by asking her if she'd sleep with him for a 
>> dollar. She replied: "No. Do you take me for a prostitutte?", to which 
>> his riposte was "We have already established that fact, and are now 
>> merely haggling about the price".
>
>I've seen this before, and it is witty.
>
>However, it is perhaps unfair towards the woman.  The man, after all, is 
>someone who has offered a woman money in return for sex.
>
>The whole story reads differently if we replace 'philosopher' by 'man' 
>and 'attractive lady' by 'woman'.

The version I prefer has the woman asking, "What sort of woman do you take
me for?"

DaveM
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: x, = y (???)

2008-07-17 Thread DaveM
On Thu, 17 Jul 2008 17:32:30 -0400, Terry Reedy <[EMAIL PROTECTED]> wrote:


> >>> *x, = [3]
> >>> x
>[3]

What does *x signify?

DaveM
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python Written in C?

2008-07-21 Thread DaveM
On Mon, 21 Jul 2008 03:18:01 +0200, Michiel Overtoom <[EMAIL PROTECTED]>
wrote:


>Many major text/word processing programs (Emacs, vi, MS-Word) are also
>written in C.

I thought Emacs was written in Lisp.

DaveM
--
http://mail.python.org/mailman/listinfo/python-list


Rant (was Re: x*x if x>10

2008-07-27 Thread DaveM
On Sun, 27 Jul 2008 05:24:36 -0700 (PDT), alex23 <[EMAIL PROTECTED]> wrote:

>On Jul 27, 10:13 pm, ssecorp <[EMAIL PROTECTED]> wrote:
>> I have seen somewhere that you can write something like:

>> x*x if x>10
>> but exactly that doesn't work and I can't get any variation to work.

>It's called a ternary operator. The format is:
> =  if  else 

I've seen the PERL saying/motto/boast, "There's more than one way to do it"
derided on more than one occasion on this group so what's the reason for
this additional way to put an if else statement on one line? Are "and" and
"or" constructions to produce the same effect not supported for this use?

And while I'm on my high horse, I'd like to bring up list concatenations. I
recently needed to concatenate 5 lists, which doesn't sound a particularly
rare requirement to me. My first attempt was a straightforward loop
extending an empty list. That worked fine but looked like an awful bulky
solution. Afterwards I tried various formulae using "reduce" , falling foul
of the "=" catch on one occasion. Now I'm not a professional programmer, so
there may be good reasons for a single object to have multiple names in a
program, but it sounds like a recipe for disaster to me. Getting back to the
list concatenation, I finally found the itertools.chain command which is the
most compact and fastest (or second fastest by a trivial amount, I can't
remember which). Along the way, I must have tried/used half a dozen methods,
...which brings me back my initial PERL comment. There's more than one way
to do it in Python, too.

DaveM
--
http://mail.python.org/mailman/listinfo/python-list


Re: Rant (was Re: x*x if x>10

2008-07-27 Thread DaveM
On Sun, 27 Jul 2008 16:57:14 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]>
wrote:

>Marc 'BlackJack' Rintsch schrieb:
>> On Sun, 27 Jul 2008 16:41:19 +0200, Diez B. Roggisch wrote:
>> 
>>> DaveM schrieb:
>>>> Getting back to the list concatenation, I finally found the 
>>>> itertools.chain 
>>>> command which is the most compact and fastest (or second fastest by a 
>>>> trivial amount, I can't remember which). Along the way, I must have 
>>>> tried/used half a dozen methods, ...which brings me back my initial PERL 
>>>> comment. There's more than one way to do it in Python, too.

>>> But I *do* know that taking the python zen literally is fruitless.

>> I think it should be taken more literally than the wrong reduction to 
>> "there should be only one way".  People tend to forget "obvious" and 
>> "preferably" all the time.

>Good point. The OP found the obvious way of extending. I wonder what his 
>reasons were to abandon it.

You'll have guessed, I'm sure, that I'm not a professional programmer. This
was the third rewrite of a program to match candidate groups to examiners on
a three day course I run, necessitated on this occasion by a change in the
structure of the course. I originally learnt python as I wrote, and some of
the early code was ugly and verbose, so once the current rewrite was working
I took the opportunity to tidy the code up and document it (yes, I know, but
as I said, I'm an amateur). The list concatenation was an itch I couldn't
scratch:

temp = []
for value in sessexam.values():
temp.extend(value)
c_exam = [name for name in set(temp)] #See what I mean about verbose?
c_exam.sort()
return c_exam

Six lines just didn't feel like it ought to be the best way to do something
so simple. I liked the attempt below better, but was foolish enough to time
it, so that was the end of that.

return sorted(list(set(reduce(lambda x, y: x+y, sessexam.values()

The current version (below) is a compromise, but I still feel there _ought_
to be a simple one word command to join multiple lists.

a = list(set(itertools.chain(*sessexam.values(
a.sort() #As I write I'm wondering if I really need it sorted. Hmm...
return a

DaveM
--
http://mail.python.org/mailman/listinfo/python-list


Re: Rant (was Re: x*x if x>10

2008-07-27 Thread DaveM
On Sun, 27 Jul 2008 16:41:19 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]>
wrote:


>You obviously aren't aware of the pitfalls regarding the mis-use of or 
>and and for this usage.



Well, yes, I am (and the way around the problem), but as its never caught me
out (so far), I hadn't considered it. 

>Can you tell us what you mean by "several names of one object"? You mean 
>this?
>
>a = range(10)
>b = a
>
>id(a) == id(b)
>
>
>? Passing references instead of values is an extremely important concept 
>of many languages, without it you would end up copying most of the time.

OK. I've obviously been thinking about things the wrong way. In Forth you
pass the memory address around, and presumably that's essentially what's
happening when you pass a reference. The problem is, I get caught frequently
in this situation:

a = [1,2,3]

def foo(x):
do_something_with_x
return x

...

Then when I call foo(a), a gets changed. It just isn't the effect I expect
from changing a local.

DaveM
--
http://mail.python.org/mailman/listinfo/python-list


Re: Rant (was Re: x*x if x>10

2008-07-27 Thread DaveM
On Sun, 27 Jul 2008 09:28:28 -0700, Gary Herron <[EMAIL PROTECTED]>
wrote:


>> a = list(set(itertools.chain(*sessexam.values(
>> a.sort() #As I write I'm wondering if I really need it sorted. Hmm...
>> return a

>Didn't someone already answer that.  List addition and sum() both do 
>what you want.
>
> >>> A = [1,2,3]
> >>> B = [4,5,6]
> >>> C = [7,8,9]
>
> >>> A+B+C
>[1, 2, 3, 4, 5, 6, 7, 8, 9]

True, although unsuitable for my circumstance.


> >>> sum([A,B,C], [])
>[1, 2, 3, 4, 5, 6, 7, 8, 9]

Ah. I had no luck with sum, but I hadn't realised it needed the "[]" term. I
must read about it again.

>It doesn't get any easier than that.

Not only that, but it's exactly what I was after - and fastest, too,
although speed isn't really an issue. Thank you.

DaveM
--
http://mail.python.org/mailman/listinfo/python-list


Re: Rant (was Re: x*x if x>10

2008-07-27 Thread DaveM
On Sun, 27 Jul 2008 19:46:32 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]>
wrote:


>As a rule of thumb, don't return objects you didn't create inside a 
>function from scratch.

I wish I'd had that advice when I started learning python. It would have
saved me no end of grief.

DaveM
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python compiler

2006-03-17 Thread DaveM
On Thu, 16 Mar 2006 13:34:14 +0100, "Méta-MCI"
<[EMAIL PROTECTED]> wrote:

>Après, vous pourrez aussi fréquenter le newsgroup :
>fr.comp.lang.python
>qui a l'avantage d'être en français.

But perhaps he's a Flemish speaker - are you trying to start a riot?

DaveM
-- 
http://mail.python.org/mailman/listinfo/python-list