Greetings Pythonistas. I have recently discovered a strange anomoly
with string.replace. It seemingly, randomly does not deal with
characters of ordinal value > 127. I ran into this problem while
downloading auction web pages from ebay and trying to replace the
"\xa0" (dec 160, nbsp char in iso-
Jm lists wrote:
> Since I can write the statement like:
>
print os.path.isdir.__doc__
> Test whether a path is a directory
>
> Why do I still need the getattr() func as below?
>
print getattr(os.path,"isdir").__doc__
> Test whether a path is a directory
You don't. getattr() is only us
"Jm lists" <[EMAIL PROTECTED]> on Mon, 12 Feb 2007 12:36:10
+0800 didst step forth and proclaim thus:
> Hello,
>
> Since I can write the statement like:
>
> >>> print os.path.isdir.__doc__
> Test whether a path is a directory
>
> Why do I still need the getattr() func as below?
>
> >>> print g
Samuel Karl Peterson wrote:
> Greetings Pythonistas. I have recently discovered a strange anomoly
> with string.replace. It seemingly, randomly does not deal with
> characters of ordinal value > 127. I ran into this problem while
> downloading auction web pages from ebay and trying to replace th
James Stroud <[EMAIL PROTECTED]> on Sun, 11 Feb 2007 16:53:16 -0800
didst step forth and proclaim thus:
> agent-s wrote:
> > Basically I'm programming a board game and I have to use a list of
> > lists to represent the board (a list of 8 lists with 8 elements each).
> > I have to search the adjace
I've been thinking about this for a bit and wanted some input as to the design
of it. The problem is as such:
I need a program running in the background to process messages (FIFO order)
which I would send using soap/xmlrpc/pyro (haven't decided yet). According to
my thinking I would need to mak
En Mon, 12 Feb 2007 01:46:51 -0300, susan <[EMAIL PROTECTED]>
escribió:
>> > $ python ./pyExcelerator/setup.py install
>>
>> Try this instead:
>> $ cdpyExcelerator
>> $ python ./setup.py install
> I still wonder why my way didn't work. I think maybe there's some hard
> code of installation dire
Steven Bethard <[EMAIL PROTECTED]> on Sun, 11 Feb 2007 22:23:59
-0700 didst step forth and proclaim thus:
> Samuel Karl Peterson wrote:
> > Greetings Pythonistas. I have recently discovered a strange anomoly
> > with string.replace. It seemingly, randomly does not deal with
> > characters of ord
En Mon, 12 Feb 2007 02:24:54 -0300, Samuel Karl Peterson
<[EMAIL PROTECTED]> escribió:
> James Stroud <[EMAIL PROTECTED]> on Sun, 11 Feb 2007 16:53:16 -0800
> didst step forth and proclaim thus:
>
>> agent-s wrote:
>> > Basically I'm programming a board game and I have to use a list of
>> > list
"agent-s" <[EMAIL PROTECTED]> writes:
> Basically I'm programming a board game and I have to use a list of
> lists to represent the board (a list of 8 lists with 8 elements each).
> I have to search the adjacent cells for existing pieces and I was
> wondering how I would go about doing this efficie
En Mon, 12 Feb 2007 02:38:29 -0300, Samuel Karl Peterson
<[EMAIL PROTECTED]> escribió:
Sorry to steal the thread! This is only related to your signature:
> "if programmers were paid to remove code instead of adding it,
> software would be much better" -- unknown
I just did that last week. Arou
On Mon, 12 Feb 2007 00:57:35 +, Alan Isaac wrote:
> "Stargaming" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> ... types *= n
>> ... shuffle(types)
>
> This again has the "costs" I referred to:
> creating a potentially large sequence,
> and shuffling it. (Additionally,
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> If you want to avoid shuffle, here's an alternative:
>
> def random_values(n, valuelist=[True, False]):
> N = len(valuelist)
> for _ in range(N*n):
> yield valuelist[random.randrange(0, N)]
That is not guaranteed to yield exactly equa
On Mon, 12 Feb 2007 03:01:55 -0300, Gabriel Genellina wrote:
> En Mon, 12 Feb 2007 02:38:29 -0300, Samuel Karl Peterson
> <[EMAIL PROTECTED]> escribió:
>
> Sorry to steal the thread! This is only related to your signature:
>
>> "if programmers were paid to remove code instead of adding it,
>>
On Sun, 11 Feb 2007 22:20:24 -0800, Paul Rubin wrote:
> Steven D'Aprano <[EMAIL PROTECTED]> writes:
>> If you want to avoid shuffle, here's an alternative:
>>
>> def random_values(n, valuelist=[True, False]):
>> N = len(valuelist)
>> for _ in range(N*n):
>> yield valuelist[random
Paul Rubin wrote:
> "agent-s" <[EMAIL PROTECTED]> writes:
>
>>Basically I'm programming a board game and I have to use a list of
>>lists to represent the board (a list of 8 lists with 8 elements each).
>>I have to search the adjacent cells for existing pieces and I was
>>wondering how I would go a
James Stroud:
> import operator
> srch = [(i,j) for i in [-1,0,1] for j in [-1,0,1] if (i,j) != (0,0)]
> is_adj = reduce(operator.or_, [ary[row+i][col+j] for (i,j) in srch]])
Or maybe (untested), Python V.2.5:
srch = [(i,j) for i in [-1,0,1] for j in [-1,0,1] if (i,j) != (0,0)]
is_adj = any(ary[r
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> Ah, I see what you mean... you're reminding me that the Original Poster
> seems to want a biased set of almost-but-not-quite-randomly chosen
> values, so that random_values(1) must return one each of True and False
> and never True, True or False, False
On Feb 12, 4:24 pm, Samuel Karl Peterson
<[EMAIL PROTECTED]> wrote:
> C-like way to do it, (warning, untested in python):
>
> for i in range(8):
> for j in range(8):
> for offset_i in range(-1,2):
> for offset_j in range(-1, 2):
> row = i + offset_i
>
101 - 119 of 119 matches
Mail list logo