In article <[EMAIL PROTECTED]>,
David Hughes <[EMAIL PROTECTED]> wrote:
>
>Who coined this originally?
AFAICT, none other than Guido.
--
Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/
"as long as we like the same operating system, things are cool." --piranha
--
http
Hello
It seems like I have Unicode data in a CSV file but Python is using
a different code page, so isn't happy when I'm trying to read and put
this data into an SQLite database with APSW:
sql = "INSERT INTO mytable (col1,col2) VALUES (?,?)"
cursor.executemany(sql, records("test.
Cédric Lucantis wrote:
I don't see any string method to do that
>>> 'abcde'.translate(str.maketrans('','','bcd'))
'ae'
I do not claim this to be better than all the other methods,
but this pair can also translate while deleting, which others cannot.
--
http://mail.python.org/mailman/listin
I wrote some pretty basic socket programming again, but I'm still confused
about what's happening with the buffer_size variable. Here are the server and
client programs:
--
from socket import *
host = ''
port = 51567
address = (host, port)
buffer_size = 1024
server_socket = socket
have you guys seen this on Slashdot yet? (i did a quick search in the
archives and haven't seen any posts yet so hopefully this isn't a
duplicate msg!)
http://developers.slashdot.org/developers/08/06/16/1855209.shtml
this video is a visualization of the commits to the source base (and
made by who
Paul,
Thank you for the informative reply.
Yes, I created the indent problem when manually copying the original
script when I posted. (I'm using an old laptop to study python and
posting here using the desktop.)
Your examples really helped. Last night I played with using a for
loop instead of
On Jun 17, 6:34 am, Thomas Hill <[EMAIL PROTECTED]> wrote:
> On Jun 15, 6:23 pm, takayuki <[EMAIL PROTECTED]> wrote:
>
> > def hasnolet(avoid):
> > fin = open('animals.txt')
> > for line in fin:
> > word = line.strip()
> > for letter in avoid:
> >
So I'm writing a script which will create several instances of User()
class. I want each instance to be named after the login name
of a user. I don't know beforehand how many users the script will
have to create or how they are named. Right now I've created a dictionary
of usernames as keys and obj
takayuki wrote:
I'm early on in my python adventure so I'm not there yet on the strip
command nuances.I'm reading "How to think like a python
programmer" first. It's great.
Then "Learning python". I've read parts of Dive into Python and will
work through it fully when I'm a little farther
takayuki wrote:
Paul,
Thank you for the informative reply.
Yes, I created the indent problem when manually copying the original
script when I posted. (I'm using an old laptop to study python and
posting here using the desktop.)
Your examples really helped. Last night I played with using a fo
On Jun 17, 8:02 am, bvdp <[EMAIL PROTECTED]> wrote:
> Thanks. That was easy :)
>
> > The change to the _ast version is left as an exercise to the reader ;)
>
> And I have absolutely no idea on how to do this. I can't even find the
> _ast import file on my system. I'm assuming that the _ast definit
On Jun 16, 8:24 am, Bruno Desthuilliers wrote:
>
> IIRC (please someone correct me if I'm wrong), proper release of file
> resources as soon as the file object gets out of scope is not garanteed
> in the language spec and is implementation dependant.
Right. Resources are freed in CPython right af
Le Monday 16 June 2008 20:35:22 George Sakkis, vous avez écrit :
> On Jun 16, 1:49 pm, Gerard flanagan <[EMAIL PROTECTED]> wrote:
> > George Sakkis wrote:
> > > I have a situation where one class can be customized with several
> > > orthogonal options. Currently this is implemented with (multiple)
Le Tuesday 17 June 2008 05:10:57 Maric Michaud, vous avez écrit :
> The class complextiy problem is actually solved by :
>
> inst_with_alg1 = MyClassUsingStrategies((algo1_strategy,),
> (algo1_strategy,)) inst_with_alg1_alg2 = MyClassUsingStrategies(
>
"Hyuga" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
On Jun 13, 11:34 am, "Reedick, Andrew" <[EMAIL PROTECTED]> wrote:
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:python-
> [EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
> Sent: Friday, June 13, 2008 11:11 AM
On Jun 16, 5:24 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> > ``odict.byindex(index)``
>
> > Index-based lookup is supported by ``byindex()`` which returns
> > the key/value pair for an index, that is, the "position" of a
> > key in the ordered dict. 0 is the fir
I'm a bit confusing about whether "is not" equivelent to "!="
if a != b:
...
if a is not b:
...
What's the difference between "is not" and "!=" or they are the same thing?
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
On Jun 17, 8:02 am, bvdp <[EMAIL PROTECTED]> wrote:
Thanks. That was easy :)
The change to the _ast version is left as an exercise to the reader ;)
And I have absolutely no idea on how to do this. I can't even find the
_ast import file on my system. I'm assuming that
pirata wrote:
I'm a bit confusing about whether "is not" equivelent to "!="
if a != b:
...
if a is not b:
...
What's the difference between "is not" and "!=" or they are the same thing?
No, they are not the same thing. == and != test to see if the *value* of
two variables are the same.
pirata wrote:
I'm a bit confusing about whether "is not" equivelent to "!="
if a != b:
...
if a is not b:
...
What's the difference between "is not" and "!=" or they are the same thing?
The `==` operator tests equality. The `is` operator tests identity.
If you don't specifically inte
On Jun 16, 10:29 pm, pirata <[EMAIL PROTECTED]> wrote:
> I'm a bit confusing about whether "is not" equivelent to "!="
>
> if a != b:
> ...
>
> if a is not b:
> ...
>
> What's the difference between "is not" and "!=" or they are the same thing?
"is not" is the logical negation of the "is" oper
I'm writing to see calcuration process.
And so, I can't catch StopIteration...
What is mistake?
def collatz(n):
r=[]
while n>1:
r.append(n)
n = 3*n+1 if n%2 else n/2
yield r
for i, x in enumerate(collatz(13)):
try:
last = x[:i+1]
print x[:i+1]
except StopIteration:
John Salerno wrote:
== and != test to see if the *value* of
two variables are the same.
Let me just clarify this. It might seem like a picky point, but I think
it's pretty important when learning Python.
I don't really mean the value of the variables themselves, I mean the
values that the
[EMAIL PROTECTED] wrote:
for i, x in enumerate(collatz(13)):
try:
last = x[:i+1]
print x[:i+1]
except StopIteration:
print last.appnd(1)
My guess would be because StopIteration is raised when control returns
to the for loop and sees that it has nothing else left. At that point
On Tue, Jun 17, 2008 at 11:29 AM, pirata <[EMAIL PROTECTED]> wrote:
> I'm a bit confusing about whether "is not" equivelent to "!="
>
> if a != b:
> ...
>
> if a is not b:
> ...
>
>
> What's the difference between "is not" and "!=" or they are the same thing?
The 'is' is used to test do they poi
DIGITAL TVhttp://digitaltvtech.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
Jean-Paul Calderone wrote:
>
> There's plenty of things other than that one static variable that can get
> messed up in this scenario. The access violation could easily come along
> with random memory corruption. Fixing just the GC to handle this doesn't
> mean your program will be able to keep
En Mon, 16 Jun 2008 06:29:09 -0300, Bruno Desthuilliers <[EMAIL PROTECTED]>
escribió:
> Gabriel Genellina a écrit :
>
>> It appears that you want to catch all exceptions, just use Exception for
>> that:
>> try:
>>...
>> except Exception:
>>...
>
> Hem... That's definitively *not* an a go
Please sent your country nature picture in need it. plz ya
--
http://mail.python.org/mailman/listinfo/python-list
I've been trying to coax this class to use something other than the
default '$' but it seems setting it to something else has no discernible
effect. Is it necessary to inherit from the class to do this?
I've only been using Python for a couple of weeks so I'm not sure what
the best approach is
On Jun 16, 9:53 pm, kretik <[EMAIL PROTECTED]> wrote:
> I've been trying to coax this class to use something other than the
> default '$' but it seems setting it to something else has no discernible
> effect. Is it necessary to inherit from the class to do this?
Yes, subclassing is the intended wa
On Jun 17, 11:07 am, "Leo Jay" <[EMAIL PROTECTED]> wrote:
> On Tue, Jun 17, 2008 at 11:29 AM, pirata <[EMAIL PROTECTED]> wrote:
> > I'm a bit confusing about whether "is not" equivelent to "!="
>
> > if a != b:
> > ...
>
> > if a is not b:
> > ...
>
> > What's the difference between "is not" and
>> For this API, I think it's important to make some performance guarantees.
>
> I may appreciate them for all Python collections :-)
See
http://wiki.python.org/moin/TimeComplexity
>> It seems fairly difficult to make byindex O(1), and
>> simultaneously also make insertion/deletion better than
> My guess is that the two main memory allocate/deallocate cases are 1)
> appending a new item to the end, and 2) GC'ing the entire data
> structure. I would optimize these 2 at the expense of all others.
Does that include dictionary lookups?
Regards,
Martin
--
http://mail.python.org/mailman/lis
Raymond Hettinger wrote:
On Jun 16, 9:53 pm, kretik <[EMAIL PROTECTED]> wrote:
I've been trying to coax this class to use something other than the
default '$' but it seems setting it to something else has no discernible
effect. Is it necessary to inherit from the class to do this?
Yes, subclas
> Yes I did my job, i had mention it before. but an application would not
> consist mine only, it could be incorporate your c extension module(s), and
> others, means problem could be from my side, yours, or others. Though
> forcing to reset the state would not mean fixing the real problem, but
On Jun 17, 10:50 am, [EMAIL PROTECTED] wrote:
> I'm writing to see calcuration process.
> And so, I can't catch StopIteration...
>
> What is mistake?
>
> def collatz(n):
> r=[]
> while n>1:
> r.append(n)
> n = 3*n+1 if n%2 else n/2
> yield r
>
> for i, x in enumerate(collatz(13)):
>
On Jun 16, 9:16 pm, asdf <[EMAIL PROTECTED]> wrote:
> So I'm writing a script which will create several instances of User()
> class. I want each instance to be named after the login name
> of a user. I don't know beforehand how many users the script will
> have to create or how they are named. Rig
Is anyone aware of any prior work done with searching or matching a
pattern over nested Python lists? I have this problem where I have a
list like:
[1, 2, [1, 2, [1, 7], 9, 9], 10]
and I'd like to search for the pattern [1, 2, ANY] so that is returns:
[1, 2, [1, 2, [6, 7], 9, 9], 10]
[1, 2, [6,
En Mon, 16 Jun 2008 07:34:06 -0300, Bart Kastermans <[EMAIL PROTECTED]>
escribió:
> Summary: can't verify big O claim, how to properly time this?
>
> This is interesting. I had never attempted to verify a big O
> statement
> before, and decided that it would be worth trying. So I wrote some
> c
On Jun 17, 12:36 pm, Lie <[EMAIL PROTECTED]> wrote:
> On Jun 17, 10:50 am, [EMAIL PROTECTED] wrote:
>
>
>
> > I'm writing to see calcuration process.
> > And so, I can't catch StopIteration...
>
> > What is mistake?
>
(snip)
>
> In a for-loop, StopIteration is caught by the for-loop for your
> conv
I was trying to print a dot on console every second to indicates
running process, so I wrote, for example:
for i in xrange(10):
print ".",
time.sleep(1)
Idealy, a dot will be printed out each second. But there is nothing
print out until after 10 seconds, all 10 dots come out together.
I
On Jun 17, 12:28 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> > My guess is that the two main memory allocate/deallocate cases are 1)
> > appending a new item to the end, and 2) GC'ing the entire data
> > structure. I would optimize these 2 at the expense of all others.
>
> Does that include
En Mon, 16 Jun 2008 21:21:35 -0300, John Salerno <[EMAIL PROTECTED]> escribió:
> I wrote some pretty basic socket programming again, but I'm still confused
> about what's happening with the buffer_size variable. Here are the server and
> client programs:
>
> --
>
> from socket import
On Jun 17, 5:50 am, [EMAIL PROTECTED] wrote:
> I'm writing to see calcuration process.
> And so, I can't catch StopIteration...
>
> What is mistake?
>
> def collatz(n):
> r=[]
> while n>1:
> r.append(n)
> n = 3*n+1 if n%2 else n/2
> yield r
>
> for i, x in enumerate(collatz(13)):
>
On Jun 17, 8:43 am, Chris <[EMAIL PROTECTED]> wrote:
> On Jun 17, 5:50 am, [EMAIL PROTECTED] wrote:
>
>
>
> > I'm writing to see calcuration process.
> > And so, I can't catch StopIteration...
>
> > What is mistake?
>
> > def collatz(n):
> > r=[]
> > while n>1:
> > r.append(n)
> > n = 3
En Tue, 17 Jun 2008 03:15:11 -0300, pirata <[EMAIL PROTECTED]> escribió:
> I was trying to print a dot on console every second to indicates
> running process, so I wrote, for example:
>
> for i in xrange(10):
> print ".",
> time.sleep(1)
>
> Idealy, a dot will be printed out each second. B
101 - 147 of 147 matches
Mail list logo