Re: A simple list question.

2005-12-22 Thread Tim Williams (gmail)
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

Re: A simple list question.

2005-12-22 Thread Tim Williams (gmail)
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

Re: File object question

2005-12-22 Thread Tim Williams (gmail)
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

Re: Windows and python execution

2005-12-26 Thread Tim Williams (gmail)
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

Re: Modifying values in a list

2005-12-29 Thread Tim Williams (gmail)
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

Re: reading files into dicts

2005-12-29 Thread Tim Williams (gmail)
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

Re: reading files into dicts

2005-12-29 Thread Tim Williams (gmail)
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

Re: reading files into dicts

2005-12-29 Thread Tim Williams (gmail)
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

Re: reading files into dicts

2005-12-29 Thread Tim Williams (gmail)
- Then: import dictfile print dictfile.mydict.keys() >>>['key1','key2'] reload(dictfile) HTH :-) -- Tim Williams -- http://mail.python.org/mailman/listinfo/python-list

Re: reading files into dicts

2005-12-30 Thread Tim Williams (gmail)
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

Re: compare dictionary values

2005-12-30 Thread Tim Williams (gmail)
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

Re: compare dictionary values

2006-01-03 Thread Tim Williams (gmail)
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

Re: smtplib error('Connection reset by peer')

2006-01-05 Thread Tim Williams (gmail)
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

RE: Calling foreign functions from Python? ctypes?

2006-01-09 Thread Delaney, Timothy (Tim)
s going on and happily put it forward). Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

RE: New Python.org website ?

2006-01-11 Thread Delaney, Timothy (Tim)
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

Re: python create mail

2006-01-12 Thread Tim Williams (gmail)
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

Re: how to improve this simple block of code

2006-01-12 Thread Tim Williams (gmail)
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

Re: How to remove subset from a file efficiently?

2006-01-12 Thread Tim Williams (gmail)
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  

Re: How to remove subset from a file efficiently?

2006-01-12 Thread Tim Williams (gmail)
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

Re: python create mail

2006-01-12 Thread Tim Williams (gmail)
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

RE: Bug? Certainly a new *behavior* from subprocess in 2.5 on Win32

2006-07-20 Thread Delaney, Timothy (Tim)
you raise this as a bug on Sourceforge? Cheers, Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

RE: Programming newbie coming from Ruby: a few Python questions

2006-08-01 Thread Delaney, Timothy (Tim)
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

RE: Question about using python as a scripting language

2006-08-06 Thread Delaney, Timothy (Tim)
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

RE: Newbie - How to iterate list or scalar ?

2006-08-09 Thread Delaney, Timothy (Tim)
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

RE: Question about using python as a scripting language

2006-08-09 Thread Delaney, Timothy (Tim)
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

New to python

2006-08-17 Thread Gallagher, Tim (NE)
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

Search or compai problem

2006-08-18 Thread Gallagher, Tim (NE)
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 "--

Add users to directory/folder and set permissions in Windows

2006-08-21 Thread Gallagher, Tim (NE)
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

Unicode Error

2006-08-22 Thread Gallagher, Tim (NE)
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

RE: Sorting by item_in_another_list

2006-10-23 Thread Delaney, Timothy (Tim)
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

RE: Sorting by item_in_another_list

2006-10-24 Thread Delaney, Timothy (Tim)
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

RE: Sorting by item_in_another_list

2006-10-24 Thread Delaney, Timothy (Tim)
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

RE: Fatal Python error: deallocating None

2006-10-25 Thread Delaney, Timothy (Tim)
being INCREFed correctly somewhere. Extension module, etc ... Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

RE: Python development time is faster.

2006-11-14 Thread Delaney, Timothy (Tim)
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

RE: genexp performance problem?

2006-05-30 Thread Delaney, Timothy (Tim)
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

RE: genexp performance problem?

2006-05-30 Thread Delaney, Timothy (Tim)
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

RE: C# equivalent to range()

2006-06-04 Thread Delaney, Timothy (Tim)
pparently helpful, tends to encourage further off-topic postings :( Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

RE: Which exceptions are recommended to me handled?

2006-06-04 Thread Delaney, Timothy (Tim)
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

RE: Which exceptions are recommended to me handled?

2006-06-05 Thread Delaney, Timothy (Tim)
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

RE: C# equivalent to range()

2006-06-05 Thread Delaney, Timothy (Tim)
*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

RE: queue deadlock possibility

2006-06-26 Thread Delaney, Timothy (Tim)
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

RE: Dictionary .keys() and .values() should return a set [with Python3000 in mind]

2006-07-02 Thread Delaney, Timothy (Tim)
opy by calling list(dict.keys()). Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

RE: Dictionary .keys() and .values() should return a set [withPython3000 in mind]

2006-07-02 Thread Delaney, Timothy (Tim)
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

RE: Dictionary .keys() and .values() should return a set[withPython3000 in mind]

2006-07-03 Thread Delaney, Timothy (Tim)
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

RE: Dictionary .keys() and .values() should return a set [withPython3000 in mind]

2006-07-03 Thread Delaney, Timothy (Tim)
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

RE: Dictionary .keys() and .values() should return a set[withPython3000 in mind]

2006-07-03 Thread Delaney, Timothy (Tim)
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

Questoin about outlook calendar

2006-08-29 Thread Gallagher, Tim (NE)
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.

RE: python reference counting and exceptions

2006-09-12 Thread Delaney, Timothy (Tim)
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

RE: Are Python's reserved words reserved in places they dont need tobe?

2006-09-13 Thread Delaney, Timothy (Tim)
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

RE: Python programs always open source?

2006-09-19 Thread Delaney, Timothy (Tim)
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

RE: does anybody earn a living programming in python?

2006-09-25 Thread Delaney, Timothy (Tim)
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

RE: productivity and long computing delays

2006-09-27 Thread Delaney, Timothy (Tim)
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

RE: syntax error in sum(). Please explicate.

2006-11-19 Thread Delaney, Timothy (Tim)
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

RE: dict.has_key(x) versus 'x in dict'

2006-12-07 Thread Delaney, Timothy (Tim)
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

RE: problems caused by very large for-loop

2006-12-07 Thread Delaney, Timothy (Tim)
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

RE: merits of Lisp vs Python

2006-12-14 Thread Delaney, Timothy (Tim)
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

RE: trees

2006-12-17 Thread Delaney, Timothy (Tim)
esr/faqs/smart-questions.html Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

RE: glibc detected double free or corruption

2006-12-20 Thread Delaney, Timothy (Tim)
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

RE: Fall of Roman Empire

2006-12-21 Thread Delaney, Timothy (Tim)
em with a DMCA-style lawsuit ... Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

RE: OpenGL

2006-01-29 Thread Delaney, Timothy (Tim)
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

RE: Too Many if Statements?

2006-02-07 Thread Delaney, Timothy (Tim)
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

RE: module with __call__ defined is not callable?

2006-02-07 Thread Delaney, Timothy (Tim)
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

RE: module with __call__ defined is not callable?

2006-02-07 Thread Delaney, Timothy (Tim)
(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

RE: module with __call__ defined is not callable?

2006-02-08 Thread Delaney, Timothy (Tim)
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

RE: by reference

2006-02-09 Thread Delaney, Timothy (Tim)
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

RE: Too Many if Statements?

2006-02-09 Thread Delaney, Timothy (Tim)
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

RE: ordered sets operations on lists..

2006-02-12 Thread Delaney, Timothy (Tim)
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

RE: ordered sets operations on lists..

2006-02-12 Thread Delaney, Timothy (Tim)
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

RE: how do you pronounce 'tuple'?

2006-02-13 Thread Delaney, Timothy (Tim)
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

RE: Which is faster? (if not b in m) or (if m.count(b) > 0)

2006-02-15 Thread Delaney, Timothy (Tim)
est way to test for non-membership in a container. Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

RE: Which is faster? (if not b in m) or (if m.count(b) > 0)

2006-02-19 Thread Delaney, Timothy (Tim)
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

RE: Which is faster? (if not b in m) or (if m.count(b) > 0)

2006-02-19 Thread Delaney, Timothy (Tim)
;>> Damn - I missed that change. Peephole optimiser I guess. Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple email recipients

2006-02-20 Thread Tim Williams (gmail)
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")

Re: multiple email recipients

2006-02-20 Thread Tim Williams (gmail)
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

RE: Python vs. Lisp -- please explain

2006-02-20 Thread Delaney, Timothy (Tim)
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

Re: Zope/Plone - Is it the right solution?

2006-02-21 Thread Tim Williams (gmail)
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

RE: Python vs. Lisp -- please explain

2006-02-21 Thread Delaney, Timothy (Tim)
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

Re: problem(s) with import from parent dir: "from ../brave.py import sir_robin"

2006-02-24 Thread Tim Williams (gmail)
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

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-24 Thread Tim Williams (gmail)
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

RE: Use of __slots__

2006-02-26 Thread Delaney, Timothy (Tim)
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

RE: sort one list using the values from another list

2006-02-26 Thread Delaney, Timothy (Tim)
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

Re: string stripping issues

2006-03-03 Thread Tim Williams (gmail)
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

RE: style question: how to delete all elements in a list

2006-03-06 Thread Delaney, Timothy (Tim)
[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/

RE: lists - append - unique and sorted

2007-06-07 Thread Delaney, Timothy (Tim)
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

RE: Python 2.5.1 - sqlite3.dll issue

2007-06-07 Thread Delaney, Timothy (Tim)
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

RE: Python 2.5.1 - sqlite3.dll issue

2007-06-07 Thread Delaney, Timothy (Tim)
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 >&

RE: Q: listsort and dictsort - official equivalents?

2007-06-20 Thread Delaney, Timothy (Tim)
return the entire list. Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

RE: Probably simple syntax error

2007-07-01 Thread Delaney, Timothy (Tim)
(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

RE: Plugging a pseudo-memory leak

2007-07-04 Thread Delaney, Timothy (Tim)
;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

RE: deleated bios?

2007-07-04 Thread Delaney, Timothy (Tim)
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

RE: Broken MUA interactions

2007-07-09 Thread Delaney, Timothy (Tim)
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

RE: Trying to choose between python and java

2007-05-15 Thread Delaney, Timothy (Tim)
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

RE: All leading tabs or all leading spaces - why isn't that enforced?

2007-08-06 Thread Delaney, Timothy (Tim)
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

RE: Jython - problem import os

2007-08-08 Thread Delaney, Timothy (Tim)
/ jython.jar Lib/ ... os.py ... Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

RE: How to free memory ( ie garbage collect) at run time with Python2.5.1(windows)

2007-08-28 Thread Delaney, Timothy (Tim)
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

RE: creating really big lists

2007-09-05 Thread Delaney, Timothy (Tim)
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

RE: Mocking OpenOffice in python?

2007-03-14 Thread Delaney, Timothy (Tim)
"Your father was a hamster, and your mother smelled of elderberry." Oh - unit testing. Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

RE: how can I clear a dictionary in python

2007-04-04 Thread Delaney, Timothy (Tim)
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

RE: RFC: Assignment as expression (pre-PEP)

2007-04-09 Thread Delaney, Timothy (Tim)
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

RE: tuples, index method, Python's design

2007-04-10 Thread Delaney, Timothy (Tim)
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

<    70   71   72   73   74   75   76   77   78   >