imes a list then change the 2nd line to
self.listOfObjects = list( self.currentObject )
HTH :)-- Tim Williams
--
http://mail.python.org/mailman/listinfo/python-list
On 22/12/05, Tim Williams (gmail) <[EMAIL PROTECTED]> wrote:
On 22 Dec 2005 10:14:10 -0800, KraftDiner <
[EMAIL PROTECTED]> wrote:
Is there a cleaner way to implement this code?if
len(self.listOfObjects) == 0:self.listOfOb
e_read)
Note: you must specify the binary option for binary files or you may not get the whole file.HTH :)
-- Tim Williams
--
http://mail.python.org/mailman/listinfo/python-list
On 26/12/05, Mark Carter <[EMAIL PROTECTED]> wrote:
What I would like to do it type something like > myscript.pyinstead of > python myscript.py
Open an explorer window or open "My Computer"
Click on TOOLS then FOLDER OPTIONS
Select the "FILE TYPES tab and click on NEW
Enter PY as the file
gt;> for x in range(len(numbers)):
... numbers[x] = numbers[x]*2
>>> numbers
[2, 4, 6]
HTH :)-- Tim Williams
--
http://mail.python.org/mailman/listinfo/python-list
On 30/12/05, rbt <[EMAIL PROTECTED]> wrote:
What's a good way to write a dictionary out to a file so that it can beeasily read back into a dict later? I've used realines() to read textfiles into lists... how can I do the same thing with dicts? Here's some
sample output that I'd like to write to fil
On 30/12/05, Giovanni Bajo <[EMAIL PROTECTED]> wrote:
>>> d = {'.\\sync_pics.py': 1135900993, '.\\file_history.txt': 1135900994, '.\\New Text Document.txt': 1135900552}>>> file("foo", "w").write(repr(d))>>> data = ""
>>> data"{'.sync_pics.py': 1135900993, '.file_history.txt': 1135900994
A further thought, if you write the data to a file in the correct
format, you can use import and reload to access the data later instead
of repr.
On 12/29/05, Tim Williams (gmail) <[EMAIL PROTECTED]> wrote:
> On 30/12/05, Giovanni Bajo <[EMAIL PROTECTED]> wrote:
&g
-
Then:
import dictfile
print dictfile.mydict.keys()
>>>['key1','key2']
reload(dictfile)
HTH :-)
--
Tim Williams
--
http://mail.python.org/mailman/listinfo/python-list
On 30/12/05, Chris F.A. Johnson <[EMAIL PROTECTED]> wrote:
On 2005-12-30, Tim Williams (gmail) wrote:> Apologies for the top post, it was my first attempt at using gmail's> pda-enabled web interface. There is no option to bottom post.Can you not move the cursor?
Nope, th
In <[EMAIL PROTECTED]>, rbt wrote:
> What's a good way to compare values in dictionaries?
Do you need to compare dictionaries, if its an option it would be
simpler/cheaper to compare each entry from your file
listing with entries in a single dict and act accordingly, mainly
because you will alrea
On 30/12/05, rbt <[EMAIL PROTECTED]> wrote:
What's a good way to compare values in dictionaries? I want to find[snip]My key-values pairs are filepaths and their modify times. I want toidentify files that have been updated or added since the script last ran.
You don't need to store each file's upda
prompt
c:\> telnet localhost 25 (return)
you should get some response from your server beginning with "220", if not then Python isn't the problem.
in the telnet session, type "quit " + return to end the session.
HTH :)
-- Tim Williams
--
http://mail.python.org/mailman/listinfo/python-list
s
going on and happily put it forward).
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
n the
home page. Makes it look like some useless corporate website or (even
worse) PowerPoint presentation IMO. And I've seen way too many of those,
working in Australia for an American multinational company ...
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
On 12 Jan 2006 04:28:44 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
hey I need help in sending email,It seems that while using this set of commands
from smtplib import SMTP s = SMTP() s.set_debuglevel(1) s.connect('outmail.huji.ac.il')I should be able to get a connection but what I get is
On 11/01/06, Mike Meyer <[EMAIL PROTECTED]> wrote:
"py" <[EMAIL PROTECTED]> writes:> Say I have...> x = "132.00"> but I'd like to display it to be "132" ...dropping the trailing
> zeros...I currently try this
Is it likely that x might not have any decimal
places? If so all the above solutions f
On 12 Jan 2006 09:04:21 -0800, fynali <[EMAIL PROTECTED]> wrote:
Hi all,I have two files: - PSP320.dat (quite a large list of mobile numbers), - CBR319.dat (a subset of the above, a list of barred bumbers)# head PSP320.dat CBR319.dat
==> PSP320.dat <==96653696338
On 12/01/06, Tim Williams (gmail) <[EMAIL PROTECTED]> wrote:
On 12 Jan 2006 09:04:21 -0800, fynali <
[EMAIL PROTECTED]> wrote:
Hi all,I have two files: - PSP320.dat (quite a large list of mobile numbers), - CBR319.dat (a subset of the above, a list of barred bumber
on 1/12/06, Tim Williams (gmail) <
[EMAIL PROTECTED]> wrote:
On 12 Jan 2006 04:28:44 -0800,
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
hey I need help in sending email,It seems that while using this set of commands
from smtplib import SMTPs = SMTP()s.set_debuglevel
you raise this as a bug on Sourceforge?
Cheers,
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
mented explaining exactly what it is doing,
and why a non-clever solution was not used. Most of the time there's
still a better non-clever way to do it, but the coder is not clever
enough to find it ;)
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
ist = eval('import shutil; shutil.rmtree('/')')
Terry's approach is much better. Another alternative is to create a
dictionary mapping an action name to a function. Basically the same as
Terry's solution, but the dictionary lookup is explicit (as opposed to
being hidden as
Bruno Desthuilliers wrote:
> What I wonder here is why __iter__ has been added to lists and tuples
> but not to strings (not that I'm complaining, it's just curiousity...)
Because someone got around to doing it.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
Carl Banks wrote:
> Delaney, Timothy (Tim) wrote:
>> Steve Lianoglou wrote:
>>
>>> So, for instance, you can write:
>>> my_list = eval('[1,2,3,4]')
>>
>> This is just asking for trouble.
>>
>> my_list = eval('import shu
equivalent was.
I guess that I had a few more that I cannot think of right now.
Thanks
Tim
--
http://mail.python.org/mailman/listinfo/python-list
I am new to python and I want to compare 2 strings, here is my code:
[start]
import active_directory
import re
lstUsers = []
users = active_directory.root()
for user in users.search ("sn='gallagher'"):
lstUsers.append(user.samAccountName)
print "--
I was wondering if there was a way to add a user in active directory to
a folder and set the permissions.
Thanks,
Tim
Timothy F. Gallagher
CSC Systems Engineer
--
http://mail.python.org/mailman/listinfo/python-list
Hey all I am learning Python
and having a fun time doing so. I have a question for y'all, it has to do with
active directory.
I want to get the last login
for a computer from Active Directory. I am using the active_directory module
and here is my code.
[START
ect.
>
> for example:
>
> A = [0,1,2,3,4,5,6,7,8,9,10]
> B = [2,3,7,8]
>
> desired_result = [2,3,7,8,0,1,4,5,6,9,10]
c = set(B)
a.sort(key=c.__contains__, reverse=True)
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
documents an implementation detail of
> CPython.
This is a requirement for all implementations claiming to be 2.3 or
higher.
The "key" parameter was only introduced in 2.4 ...
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> Delaney, Timothy (Tim) wrote:
>
>> This is a requirement for all implementations claiming to be 2.3 or
>> higher.
>
> the language reference only guarantees this for CPython:
>
> The C implementation of Python 2.3 introduced a stable
being
INCREFed correctly somewhere. Extension module, etc ...
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
to smack the offenders on
> the head with a hardcover copy of the GoF.
Thankfully that book retains some usefulness as a LART, because about 90% of
what's not printed on the inside front and rear covers is made redundant by
using Python .
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
3000))" "sum(g)"
1000000 loops, best of 3: 1.09 usec per loop
The generator comprehension needs to create a new generator each time
around.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
Kent Johnson wrote:
> Reusing the generator doesn't give a correct answer; after the first
> sum() the generator is exhausted:
Duh - good point. I forgot it was returning a generator object, not
generator function.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
pparently helpful, tends to
encourage further off-topic postings :(
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
mething I've seen a lot ;)
try:
int(val)
except ValueError:
raise MyValueError('Bad value: ' + val)
The most important problem here is that you've lost the stack trace from
the original exception. The next most important is that anything else
that believe
Fredrik Lundh wrote:
> Delaney, Timothy (Tim) wrote:
>
>> The most important problem here is that you've lost the stack trace
from
>> the original exception.
>
> which, in many cases, is a good thing, especially if you replace "int"
> with a call to some
*Very* strong suggestion - read the following link:
http://www.catb.org/~esr/faqs/smart-questions.html
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
ock occurs.
>
> The issue can be fixed by substituting a threading.RLock for the
> threading.Lock object that Queue instantiates by default.
Please a patch on SourceForge, and send an email to python-dev to alert
people of this issue (SourceForge isn't sending notification emails).
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
opy by calling
list(dict.keys()).
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
> "Delaney, Timothy (Tim)" <[EMAIL PROTECTED]> writes:
>> The eventual consensus was that keys(), etc should return views on
>> the dictionary. These views would be re-iterable and will have
>> basically the same behaviour as the lists return
Paul Rubin wrote:
> "Delaney, Timothy (Tim)" <[EMAIL PROTECTED]> writes:
>> If you want an independent data set, you have to take a snapshot.
>> For the above, that's doing:
>>
>> k0 = list(d.keys())
>
> I don't understand. Why
it's
modified. The vast majority of uses of data structures does not involve
concurrent modification.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
Scott David Daniels wrote:
> Delaney, Timothy (Tim) wrote:
>> Plus copy-on-write isn't something you want in general - it's *much*
>> slower since it needs to copy the internal data every time it's
>> modified. The vast majority of uses of data struc
I am trying to pull all my information from outlook calendar so I can send
calendar information to my phone via email. I have created a python script
that will gather Outlook Calendar information and display it. I am new to
python and this is something that I am working on so I can get better.
w an exception
> doStuff();
> }
RIIA - Resource Initialisation is Acquisition
Python is adding an RIIA mechanism in 2.5 - look at the "with"
statement.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
But I can pretty much guarantee that my
preferred editor will not ever understand "python format".
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
th program source.
In practice, such a blanket statement can be made because the Python
Software License is so liberal. However, anyone who is distributing any
part of Python should definitely read the license themselves.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
walterbyrd wrote:
> If so, I doubt there are many.
>
> I wonder why that is?
Well, I'm not qualified to analyse the reasons for your doubts, but I'd
guess it's because you have preconceived notions.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
o
it 10 times, you could well pay for a new Core 2 Duo machine.
As an alternative, do you have multiple machines you could use? Perhaps
you could use distributed compilation.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
ike a post from someone who *had* read:
http://www.catb.org/~esr/faqs/smart-questions.html
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
obviously clearer than the other, as well as being faster.
Of course (getting back to the original question), in current python:
x in dict
is obviously the clearest, and fastest method, and should always be
preferred over either of the above.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
n allocates memory for integers).
The canonical way to deal with this is to use xrange().
for i in xrange(iterations):
This simply maintains an internal counter, rather than instantiating a
list of all the integers.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
Ken Tilton wrote:
>> But this is not a case where a function can't handle the job.
>
> Is, too.
And Ken moves one step closer towards Python ...
http://www.google.com.au/search?q=monty+python+argument+sketch
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
esr/faqs/smart-questions.html
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
cross-compiling for a different architecture,
so it's possible in my case that alignment optimisations that -Os
doesn't do were causing the problem.
But a missing INCREF or extra DECREF are the most likely causes.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
em with a DMCA-style lawsuit ...
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
Mike C. Fletcher wrote:
> ctypes re-re-implementation of the same Python API to OpenGL. My
> intention is that the ctypes implementation will become the 3.0.0
> release when it is finished and optimised.
You should be aware then that it's likely that ctypes will be included
in Py
x27;t turned up the actual limit for me unfortunately.
I suppose I could go check the code ...
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
ined on the class (or type) - not on
the instance. A module is an instance of .
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
(self):
print 'Hello, world!'
m = sys.modules[__name__]
mc = type(m)
mc.__call__ = hello
Traceback (most recent call last):
File "D:\Python\modules\testclasscall.py", line 7, in ?
mc.__call__ = hello
TypeError: can't set attributes of built-in/extension type 'module'
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
oesn't make it callable", that's just avoiding
> the question.
My reading of the OP sounded like he wanted to know the *technical*
reason for why it doesn't work - which is what I provided.
If you can come up with a convincing argument, after re-reading the OP
(as I've
Rene Pijlman wrote:
> dirvine:
>> I would like to create a dictionary based on a variable [...]
>
> And what seems to be the problem?
He forgot to read http://www.catb.org/~esr/faqs/smart-questions.html.
And *you* forgot to point him to it ;)
Tim Delaney
--
http://mail.pyt
slogging_away wrote:
> Delaney, Timothy (Tim) wrote:
>
>> I'm pretty sure the OP has hit the python script line limit (32767?).
>
> The script is 4903 lines long.
Well blow that idea out of the water. I was then going to suggest
looping over tests, but noticed s
those areas.
FWIW, there are some of us who do occasionally do bytecode
optimisations, but we know it's just a bit of fun. I've yet to do any
bytecode manipulation that's significantly improved performance. You're
best of leaving such things to Pysco, and concentrating on a
Delaney, Timothy (Tim) wrote:
> Adding such optimisations to Python may improve it's benchmark scores,
Blegh! Time to give myself a good kicking!
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
27;m going to download it. :)
>
> IMO, it's not as good as the dead-parrot skit, but it's still a
> classic.
And of course, neither are a patch on the Fish-Slapping Dance.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
est way to test for non-membership in a
container.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
Farel wrote:
> Tim, Are you saying that:
> not (b in m)
> is faster than:
> b not in m
On the contrary. `not (b in m)` requires negating the result of `b in m`
(via an additional bytecode operation). `b not in m` doesn't. However,
the difference in performance is mi
;>>
Damn - I missed that change. Peephole optimiser I guess.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
mail(HOST,SENDER, RECIPIENTS, FROM,TO,SUBJECT ,BODY,CC=None):
import smtplib import string, sys body = string.join(( "From: %s" % FROM, "To: %s" % TO, "Subject: %s" % SUBJECT, "CC: %s" % CC,
"", BODY), "\r\n")
On 20/02/06, Rene Pijlman <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED]:>was wondering how to modify the code so as i can send to multiple email
>recipients using "TO"? thanks.You add RFC 2822 headers.http://www.ietf.org/rfc/rfc2822.txt("3.6.3. Destination address fields")
RFC 2822 relates to the f
n source offline and just distributing the
bytecode (and this is commonly done) - although in that case you are
usually tied to a specific PVM major version.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
quicker to become productive than with CP.
see http://quentel.python-hosting.com/wiki/index.pih and http://karrigell.sourceforge.net/
-- Tim Williams
--
http://mail.python.org/mailman/listinfo/python-list
lar to why some projects need the JDK rather than the JRE -
they have to be able to compile things on the fly.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
On 24 Feb 2006 05:10:37 -0800, per9000 <[EMAIL PROTECTED]> wrote:
SHORT VERSION:I tried three variants of "from ../brave.py import sir_robin", oneworks. I want to use it in a py-file to execute command-line-style andthat does not work.Can someone please give me, not a bucket with the desert(s) on t
7;\n').split('\n') ])
'erewr\nafjdskl\n\npythonlist'
Which right-strips the line endings, tabs and spaces from the ends of
lines in a string derived from either Windows, Mac and Unix or
mixed files
HTH :)
-- Tim Williams
--
http://mail.python.org/mailman/listinfo/python-list
st results using Pyrex and
on-the-fly bytecode modification ... interestingly, the fastest approach
I could find with Python (excluding the bytecode modifications) was
slightly different to the fastest approach in Pyrex.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
mentation accident - based entirely on the hash values of
the objects you've used (i.e. small integers). As you add more data to
the dictionary, you will definitely reach the point where you no longer
get keys out in sorted order.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
d a an HTML parser. But the following would work better than strip()
>>> a = ' Hughes. John\r\n'
>>> a.replace(' ', '' ) # '' = 2 single quotes not 1 double quote
'Hughes. John\r\n'
HTH :)
-- Tim Williams
--
http://mail.python.org/mailman/listinfo/python-list
[email protected] wrote:
> To delete all the elements of a list, should one do:
>
>lst[:] = []
> or
>del(lst[:])
del lst[:]
Note that del is not a function - the parentheses are not needed, and in
fact obscure the intent.
Tim Delaney
--
http://mail.python.org/mailman/
looks same as
> lst.sort()
You missed that the OP wants only unique values from the original list.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
valid access to memory location.
>
> I downloaded the latest sqlite3.dll from http://www.sqlite.org and
> this fixes the problem. (This dll isn't stripped)
Could you raise a bug report on SourceForge please?
http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=add
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
Delaney, Timothy (Tim) wrote:
> Josh Ritter wrote:
>
>> A number of our Windows customers have an issue with the sqlite3
>> module included with Python 2.5.1
>>
>> We've tracked the problem down to the sqlite3.dll included with the
>> Python
>&
return the entire list.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
(your code doesn't show us what weights_array is, but I'm guessing it's
actually a list), but parentheses are not the syntax for element access
(subscripting) in Python.
You should read the python tutorial:
http://docs.python.org/tut/tut.html
especially the sections on lists:
http
;t get collected for a
> long time. Is there any way I can force collection of these objects? I
> know in Python 2.5 there's gc.collect(2), but I want to keep it
> compatible with previous versions of Python.
Best way is to not create cycles. See if you can change some strong
reference
eleated the bios when I added memory
> (shocked the motherboard?)
http://www.catb.org/~esr/faqs/smart-questions.html#forum
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
ave a company-mandated use of Outlook, which does *not* give me the
above options (it only has "reply" and "reply to all"). And I still
prefer mailing lists to do the right thing.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
middle of the night and delete you 2.x installation.
>
> Is that a breakaway group from the PSU?
Splitters!
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
John Nagle wrote:
>One can argue over tab vs. space indentation, but mixing the two
> is just wrong. Why not have CPython report an error if a file has
> both leading tabs and leading spaces? I know that was proposed at
> some point, but I don't think it ever went in. That would catch a
> co
/
jython.jar
Lib/
...
os.py
...
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
me
(e.g. by iterating over the result from an xrange() call) you would only
be using (continually re-using) a single entry in the free list in total
and the python memory usage would be much smaller.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
ces, I suggest turning GC off, at least during
> construction.
This is good advice, but another question is whether you really want
such a list. You may well be better off with a database of some kind -
they're designed for manipulating large amounts of data.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
"Your father was a hamster, and your mother smelled of elderberry."
Oh - unit testing.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
e that is
asked just causes problems, and the kind of thread this has degenerated
into.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
ould check the archives to see if there was a resolution on it,
and if not I'd suggest putting a PEP together, rather than just raising
it again.
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
Carsten Haese wrote:
> assert current_player in p
> opponents = tuple(x for x in p if x is not current_player)
That would perform better as:
opponents = tuple(x for x in p if x is not current_player)
assert opponents
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
7401 - 7500 of 7730 matches
Mail list logo