Re: The type/object distinction and possible synthesis of OOP and imperative programming languages

2013-04-18 Thread Neil Cerutti
based_programming. > You can emulate an OOP system with a prototype-based language. > > I highly recommend you read a book on formal programming > language theory and concepts. Let me recommend Concepts, Techniques and Models of Computer Programming, Van Roy and Haridi. http://www.info.

Re: equivalent to C pointer

2013-04-18 Thread Neil Cerutti
ions until it actually tries to call them. At that time, if either one isn't defined properly Python will raise an exception. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Is Unicode support so hard...

2013-04-20 Thread Neil Hodgson
bytes per character decided at runtime 4) Python 3.2 -- 2 or 4 bytes per character decided at Python build time 5) Something else Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools.groupby

2013-04-22 Thread Neil Cerutti
while True: try: e = lst.index(header, b) except ValueError: yield lst[b:] break yield lst[b:e] b = e+1 for group in headered_groups([line.strip() for line in open('data.txt')], "Starting a new group"): print(group) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: There must be a better way

2013-04-22 Thread Neil Cerutti
ere is a rationale for the change from csv.reader.next > to csv.reader.__next__. > > If next is not acceptable for the version 3 csv.reader, perhaps __next__ > could be added to the version 2 csv.reader, so that the same code can be > used in the two versions. > > This would avoid the kluge I used above. Would using csv.DictReader instead a csv.reader be an option? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools.groupby

2013-04-22 Thread Neil Cerutti
On 2013-04-22, Oscar Benjamin wrote: > On 22 April 2013 15:24, Neil Cerutti wrote: >> >> Hrmmm, hoomm. Nobody cares for slicing any more. >> >> def headered_groups(lst, header): >> b = lst.index(header) + 1 >> while True: >>

Re: There must be a better way

2013-04-23 Thread Neil Cerutti
7;DIV') for rec in reader: major = rec[majr_index] rec[div_index] = DIVISION_TABLE[major] But a csv.DictReader might still be more efficient. I never tested. This is the only place I've used this "optimization". It's fast enough. ;) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Weird python behavior

2013-04-24 Thread Neil Cerutti
n session. It's a mystery why even that program threw an > error. Regardless, why should that session throw an import > error in this session? Weird. Any help is appreciated. Thanks, 'Cause Python's import statement looks in the current directory first for files to import. So yo

Re: My gui

2013-04-24 Thread Neil Cerutti
nce, but it's usual to call mainloop of the root window, rather than tkinter.mainloop. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the source of an exception in a python multiprocessing program

2013-04-24 Thread Neil Cerutti
crash your program. This is hiding the actual context. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the source of an exception in a python multiprocessing program

2013-04-25 Thread Neil Cerutti
On 2013-04-24, William Ray Wing wrote: > On Apr 24, 2013, at 4:31 PM, Neil Cerutti wrote: > >> On 2013-04-24, William Ray Wing wrote: >>> When I look at the pool module, the error is occurring in >>> get(self, timeout=None) on the line after the final else: >

Re: Comparison Style

2013-04-25 Thread Neil Cerutti
gt; inaudible. Well I've never heard either one. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: xml.etree.ElementTree if element does not exist?

2013-04-29 Thread Neil Cerutti
www.huawei.com.cn/schema/common/v2_1}sepid";) if sepelem is not None: sepid = sepid.text else: sepid = '' The empty string works for my purposes. Your script might need something else. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: [pyxl] Re: xlrd 0.9.2 released!

2013-04-29 Thread Neil Cerutti
ade the life of a few of my coworkers incrementally easier. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: xml.etree.ElementTree if element does not exist?

2013-04-29 Thread Neil Cerutti
On 2013-04-29, Neil Cerutti wrote: > find returns None when it doesn't find what you asked for. So you > can't check the .text attribute right away unless you want an > exception thrown. I deal with these annoyances like this: > > sepelem = > content.find("./

Re: "python.exe has stopped working" when os.execl() runs on Windows 7

2013-05-02 Thread Neil Cerutti
s directed. In any case, on Windows I would normally need to do something like this instead: os.execlp('cmd.exe', 'cmd.exe', '/K', 'ping.exe') -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: First python program, syntax error in while loop

2013-05-03 Thread Neil Cerutti
my number in", tries, "tries" > else: > print "\nSorry, you took too many tries to guess my number!" > raw_input("\n\n Press any key to exit..") > > ## Maybe now I can work on a useful project Not quite yet. Players who guess correctly on the fifth try don't get credit. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: First python program, syntax error in while loop

2013-05-06 Thread Neil Cerutti
On 2013-05-03, John Gordon wrote: > In Neil Cerutti writes: > >> Not quite yet. Players who guess correctly on the fifth try don't >> get credit. > > Are you sure? tries is initialized to zero and isn't > incremented for the initial guess. while (numb

Re: calculate system disk space

2005-12-10 Thread Neil Hodgson
Heiko Wundram: > Under Windows you don't have sparse files though, so there > are no fields ... Does too! http://msdn.microsoft.com/library/en-us/fileio/fs/fsctl_set_sparse.asp They're fairly rare though. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: mail attachment with non-ascii name

2005-12-11 Thread Neil Hodgson
p?=') How can I turn that into > simply 'somefile.zip' ? I have looked into email.Utils and > codecs, but cannot find what should work. >>> import email.Header >>> x = '=?iso-8859-1?q?somefile=2ezip?=' >>> email.Header.decode_header(x

Re: Difference between ActivePython and Python.org

2005-12-14 Thread Neil Hodgson
's Included" page listed which parts of the python.org distribution are not included. http://aspn.activestate.com/ASPN/docs/ActivePython/2.4/about.html Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: access to preallocated block of memory?

2005-12-15 Thread Neil Hodgson
d be quicker to write a special-purpose library for your job rather than port ctypes. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Visual Python : finished ?

2005-12-16 Thread Neil Hodgson
http://affiliate.vsipmembers.com/downloads/41/UserFileDownload.ashx Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Application Portability?

2005-12-30 Thread Neil Benn
namic languages then you can use Jytjon, there is an unofficial port of Jython for Personal Profile - I'm not sure how robust it is but you could take a look at that. Cheers, Neil -- Neil Benn Senior Automation Engineer Cenix BioScience BioInnovations Zentrum Tatzberg 46 D-01307 Dresden Ger

Re: Win32 Binary-only for 2.3.x?

2006-01-05 Thread Neil Benn
MSI out of silent mode is not an option, if your installer starts firing up other windows (command prompt or otherwise) - it looks amateurish and cheap. Certainly installing python on a box for a developer or to support/install an in-house app, the MSI is fine and preferable. Cheer

Re: Calling foreign functions from Python? ctypes?

2006-01-06 Thread Neil Hodgson
Paul Watson: > Is there any plan to get ctypes batteries into > the standard Python build? It is unlikely that ctypes will be included in the standard Python build as it allows unsafe memory access making it much easier to crash Python. Neil -- http://mail.python.org/m

Re: Encoding sniffer?

2006-01-06 Thread Neil Hodgson
differ in that ISO-8859-1 includes the control codes in 128-159 (as well as the low control codes) as defined by ISO 6429. ISO 6429 is not freely available online but the equivalent ECMA standard ECMA 48 is: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf Neil -- http

Re: Calling foreign functions from Python? ctypes?

2006-01-06 Thread Neil Hodgson
Paul Watson: > Neil Hodgson wrote: >>It is unlikely that ctypes will be included in the standard Python >> build as it allows unsafe memory access making it much easier to crash >> Python. > Does extending Python with any C/C++ function not do the same t

Re: Calling foreign functions from Python? ctypes?

2006-01-09 Thread Neil Hodgson
Paul Watson: > I cannot find any way to get to GetVersionInfo in VBScript (cscript). Set objFSO = CreateObject("Scripting.FileSystemObject") Wscript.Echo objFSO.GetFileVersion("c:\bin\SciLexer.dll") Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: (Fucking) Unicode: console print statement and PythonWin: replacement for off-table chars HOWTO?

2006-01-10 Thread Neil Hodgson
t for Unicode on the next line. Change this to 1 and restart and you may see >>> x = u'sytest3\\\u041f\u043e\u0448\u0443\u043a.txt' >>> print x sytest3\Пошук.txt >>> This is dependent on using fonts that contain the required characters. Tested on Wind

Re: Client side web programming

2006-01-10 Thread Neil Hodgson
t'll be interesting to see if it completes or whether orkut has a load limiter that stops you after a certain amount of traffic. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: A bug for unicode strings in Python 2.4?

2006-01-10 Thread Neil Hodgson
Thomas Moore: >>>>u=u'\u9019\u662f\u4e2d\u6587\u5b57\u4e32' >>>>u.split() > > [u'\u9019\u662f\u4e2d\u6587\u5b57\u4e32'] > > > I think u should get split. Where do you think "這是中文字串" should be split and why? Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: (Fucking) Unicode: console print statement and PythonWin: replacement for off-table chars HOWTO?

2006-01-11 Thread Neil Hodgson
e people interested in working on this library. http://mail.python.org/mailman/listinfo/python-win32 Patches that improve MessageBox in particular or larger sets of functions in a general way are likely to be welcomed. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode style in win32/PythonWin

2006-01-13 Thread Neil Hodgson
ow identification and removal of default characters as any given default character may also appear naturally in the output. 'strict' and 'error' would be easier to implement by checking both the return status and lpUsedDefaultChar which is set when any default character insertion is done. The relevant code is in dist\src\Objects\unicodeobject.c. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Shrinky-dink Python (also, non-Unicode Python build is broken)

2006-01-16 Thread Neil Hodgson
since it is currently broken, document that it isn't supported. Other platforms may need to continue allowing non Py_USING_UNICODE builds. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Shrinky-dink Python (also, non-Unicode Python build is broken)

2006-01-16 Thread Neil Hodgson
rogram optimization was turned on. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Shrinky-dink Python (also, non-Unicode Python build is broken)

2006-01-17 Thread Neil Hodgson
you willing to monitor and fix new Py_USING_UNICODE issues or are you proposing just to produce a patch now and then expect contributors to maintain this feature? Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: The Python cross? Was New Python.org website

2006-01-18 Thread Neil Hodgson
or syntax, the GIL, and the pressing need to merge the dictionary and list types), are feeling very +cross+, and have turned their backs on each other. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: problem in executing a file

2006-07-13 Thread Neil Hodgson
me the permission, but I can also > use > ed execute files in my folder. so, is there a way to execute a file in my > folder > using python and not the os module? Try using os.exec* as they shouldn't need an intermediate copy of cmd.exe to run your file. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: building an index for large text files for fast access

2006-07-24 Thread Neil Hodgson
;n' is adjusted to fit your data into memory. If this uses too much memory or scanning the file to build the index each time uses too much time then you can use an index file with the same layout instead. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Intermittent "permission denied" errors when using os.rename and a recently deleted path??

2006-07-26 Thread Neil Hodgson
e Google Desktop Search or an anti-virus application? If so, try turning them off as a test. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Intermittent "permission denied" errors when using os.rename and a recently deleted path??

2006-07-26 Thread Neil Hodgson
e an "OSError: [Errno 17] File exists" for that case, not a permission error. A permission error could occur, for example, if GDS has the source open or locked when you call os.rename. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Backup GMAIL Messages with Python

2006-08-05 Thread Neil Hodgson
Gregory Piñero: > I was wondering what methods you experts > would reccomend for this task? While you can write a script, its quite easy to turn on POP and run a client side mail client like Thunderbird. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Proposal: [... for ... while cond(x)]

2006-08-08 Thread Neil Hodgson
al route of writing a PEP so that a detailed proposal and its reasons for (probable) rejection would be available for others. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: (Boost.Python) How to load header files?

2006-08-08 Thread Neil Hodgson
his with extra stuff removed: extension SinkWorld : # sources SinkWorld.cpp : ../../base ../../lexers ; I'm not a Jam or Boost expert and the best place for Boost.Python questions is http://mail.python.org/mailman/listinfo/c++-sig Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode/utf-8 data in SQL Server

2006-08-08 Thread Neil Hodgson
can find it... http://www.microsoft.com/globaldev/reference/lcid-all.mspx Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: knowing when file is flushed to disk

2006-08-09 Thread Neil Hodgson
ermail/zodb-dev/2004-July/007689.html Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Boost Install

2006-08-11 Thread Neil Hodgson
=2.4] and just get a > statement saying that bjam is not recognized. Really is no batch file > or executable with that name in the boost directory. IIRC it was an extra step although I remember getting quite confused installing Boost.Python. http://www.boost.org/more/getting_started.

Re: Basic Boost.Python Question

2006-08-14 Thread Neil Hodgson
Hoop: > I am starting on an application that will developed in VS2005, probably > using C++/CLI. I haven't heard any reports of Boost.Python code being compatible with C++/CLI so you may need to add an adaptation layer. To run inside .NET, I'd choose IronPython.

Re: Reference Variables In Python Like Those In PHP

2006-08-15 Thread Neil Cerutti
t; 2 > 2 > > Is this available in python? If you store an item in a one-element list, you can use the list like a reference, but it's not syntactically transparent. >>> x = [1] >>> y = x Now x and y refer to the same list. Now you can change the elements in th

Re: Basic Boost.Python Question

2006-08-15 Thread Neil Hodgson
Hoop: > I have never heard of IronPython. Do you know if you can embedd the > Python interpreter ? I think so as I've read of people embedding the console on the mailing list. My experience is in using a C# library within a Python application. Neil -- http://mail.python.

Re: Printing n elements per line in a list

2006-08-17 Thread Neil Cerutti
shorter than length n.""" t = len(seq) for i in xrange(n, t+1, n): print isep.join(map(str, seq[i-n:i]))+rsep, t = t % n if t > 0: print isep.join(map(str, seq[-t:]))+rsep, That's probably similar to some of the other mostly non-functional solutions posted. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Python App Server

2006-08-18 Thread Neil Cerutti
s present, you can run a Python script with the :pyfile command. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular Expression question

2006-08-21 Thread Neil Cerutti
self.name_attrs = attrs p = MyHTMLParser() p.feed(""" """) print repr(p.result) p.close() There's probably a better way to search for attributes in attr than "for attr in attrs", but I didn't think of it, and th

Re: istep() addition to itertool? (Was: Re: Printing n elements per line in a list)

2006-08-21 Thread Neil Cerutti
itertool? Your note me curious enough to re-read the itertools documentation, and I found the following in 5.16.3 Recipes: def grouper(n, iterable, padvalue=None): "grouper(3, 'abcdefg', 'x') --> ('a','b','c'), ('d','e','f'), ('g','x','x')" return izip(*[chain(iterable, repeat(padvalue, n-1))]*n) Wish I'd found that yesterday. ;) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: List Splitting

2006-08-21 Thread Neil Cerutti
the list belongs together: > > Group 1 = 0, 3, 6 > Group 2 = 1, 4, 7 > Group 3 = 2, 5, 8 from itertools import islice grouped = [] grouped.append(list(islice(t, 0, None, 3)) grouped.append(list(islice(t, 1, None, 3)) grouped.append(list(islice(t, 2, None, 3)) grouped.sort() This can probably be simplified and generalized, but I'm a novice, and that's a start. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and STL efficiency

2006-08-23 Thread Neil Cerutti
On 2006-08-23, Amanjit Gill <[EMAIL PROTECTED]> wrote: > you should also include for ostream_operator. , actually. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: item access time: sets v. lists

2006-10-04 Thread Neil Cerutti
ot;list ->", t2.timeit(1000) print "\nRandom access to item in list/set when item exists" t1=timeit.Timer("500 in z","z = set(xrange(1))") t2=timeit.Timer("500 in z", "z = list(xrange(1))") print "set ->", t1.timeit(1000) print "list ->", t2.timeit(1000) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: item access time: sets v. lists

2006-10-04 Thread Neil Cerutti
On 2006-10-04, Paul McGuire <[EMAIL PROTECTED]> wrote: > "Neil Cerutti" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> Look at the code again. It's not testing what it says it's >> testing. > > It isnt? >

Re: Strange sorting error message

2006-10-05 Thread Neil Cerutti
r/faqs/smart-questions.html > Or are you just being plain rude? > A lack of a response from you implies the latter... SPOILER SPACE It was a joke, based on you hiding what you are doing, he decided to hide the solution to your problem. Get it? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: building strings from variables

2006-10-05 Thread Neil Cerutti
e_string_fmt(): > out = "cd %s ; %s %d %s %s" % ht Incidentally, changing the fmt test to be more similar to the Template version doesn't slow it down much. def make_string_fmt(): out = "cd %(working_dir)s ; %(ssh_cmd)s %(some_count)d %(some_param1)s"\ "%(some_param2)s" % hd -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange sorting error message

2006-10-06 Thread Neil Cerutti
On 2006-10-06, hanumizzle <[EMAIL PROTECTED]> wrote: > On 10/5/06, Neil Cerutti <[EMAIL PROTECTED]> wrote: > >> It was a joke, based on you hiding what you are doing, he decided >> to hide the solution to your problem. Get it? > > What if it was for a proprieta

Re: n-body problem at shootout.alioth.debian.org

2006-10-06 Thread Neil Cerutti
se, perhaps that's the right way to do it in Perl. A python solution that indexed lists instead of looking up attributes of objects might be faster. -- Neil Cerutti We're not afraid of challenges. It's like we always say: If you want to go out in the rain, be prepared to

Re: Names changed to protect the guilty

2006-10-06 Thread Neil Cerutti
th soldering iron ala Chris Walken. :) I agree on both points. It's a style issue, and that hidden tests (taking advantage of how certain objects convert to boolian values) is harder to read. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Names changed to protect the guilty

2006-10-06 Thread Neil Cerutti
n the original case, I'd agree that "if X.has_key():" is quite clear, already yielding a boolian value, and so doesn't need to be tested for if it's False. But I wouldn't like to test for an empty list or for None implicitly. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Names changed to protect the guilty

2006-10-07 Thread Neil Cerutti
On 2006-10-07, MonkeeSage <[EMAIL PROTECTED]> wrote: > > On Oct 6, 8:34 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> And in the original case, I'd agree that "if X.has_key():" is >> quite clear, already yielding a boolian value, and so doesn&#x

Re: does raw_input() return unicode?

2006-10-11 Thread Neil Cerutti
m all mindboggley. Just when I thought I was starting to understand how this character encoding stuff works. Are PythonWin's stdout and stdin implementations is incomplete? -- Neil Cerutti A song fest was hell at the Methodist church Wednesday. --Church Bulletin Blooper -- http://mail.python.org/mailman/listinfo/python-list

Re: Encode differences between idle python and python

2006-10-11 Thread Neil Cerutti
''.join(chr(a) for a in range(0xc0, 0xdf)).decode('ISO 8859-1') # Print it to stdout, converting to the terminal's encoding, replacing # unprintable characters with '?'. print some_string.encode(sys.stdout.encoding, 'replace') -- Neil Cerutti That&

Re: does raw_input() return unicode?

2006-10-12 Thread Neil Cerutti
On 2006-10-11, Martin v. Löwis <[EMAIL PROTECTED]> wrote: > Neil Cerutti schrieb: >> I'm all mindboggley. Just when I thought I was starting to >> understand how this character encoding stuff works. Are >> PythonWin's stdout and stdin implementations is incom

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Neil Cerutti
On 2006-10-12, Paul Rubin wrote: > Tarjan discovered a guaranteed O(n) algorithm in the 1970's(?) Huhn! I thought Tarjan was just the big bad evil guy in Bard's Tale 2 who was creating eternal winter. I'm glad he also contributed to our stock of *useful* algorithms. -- Ne

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Neil Cerutti
7; right away! As far as I know, he just forgot to strip out the tab characters before pasting and posting. -- Neil Cerutti We will not have an all volunteer army. We *will* have an all volunteer army. --George W. Bush -- http://mail.python.org/mailman/listinfo/python-list

Re: paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread Neil Cerutti
def parseline(line,format): > xlat = {'x':None,'s':str,'f':float,'d':int,'i':int} > result = [ xlat[f](w) for f,w in zip(format,line.split()) > if xlat.get(f,None) ] > if len(result) == 0: return None > if len

Re: Appropriate way to quit Tkinter

2006-10-13 Thread Neil Cerutti
way if I run from IDLE or from the DOS > command prompt. I had some fun trying to run Tkinter from from the Python embedded in Vim. My advice: Do not do that. -- Neil Cerutti The majority of time, it seems to be one thing or the other. --Ron Mercer -- http://mail.python.org/mailman/listinfo/python-list

Re: Best IDE?

2006-10-13 Thread Neil Cerutti
free * Totally configurable. > Disadvantages: > > * No UI builder...for this you can use Glade or maybe Boa Constructor > * Not many else...none other that I can think of right now, actually * Totally configurable. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Best IDE?

2006-10-13 Thread Neil Cerutti
On 2006-10-13, Gerrit Holl <[EMAIL PROTECTED]> wrote: > On 2006-10-13 16:31:37 +0200, Ahmer wrote: >> Subject: Best IDE? > > cat > foo.py > >> How much does it cost? > > 0 On Windows this editor is invoked like this: COPY CON: FOO.PY HTH! HAND! --

Re: COM error

2006-10-13 Thread Neil Cerutti
eriously, the function you called expected a COM object and you passed it something else. Without seeing more code, it's hard to be any helpfuller. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: comparing Unicode and string

2006-10-16 Thread Neil Cerutti
ng an error here is unnecessary. I guess that > the comparison operator decides to convert s2 to a Unicode but > forgets that I said #coding: iso-8859-1 at the beginning of the > file. It's trying to interpret s2 as ascii, and failing, since 129 and 225 code points are out of range. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange Behavior

2006-10-16 Thread Neil Cerutti
complicated calculations: I'd say the feature is "usable" rather than "useful", like bitfields in C. -- Neil Cerutti Next Sunday Mrs. Vinson will be soloist for the morning service. The pastor will then speak on "It's a Terrible Experience." --Church Bulletin Blooper -- http://mail.python.org/mailman/listinfo/python-list

Re: Alphabetical sorts

2006-10-16 Thread Neil Cerutti
Check out strxfrm in the locale module. >>> a = ["Neil", "Cerutti", "neil", "cerutti"] >>> a.sort() >>> a ['Cerutti', 'Neil', 'cerutti', 'neil'] >>> import locale >>> loca

Re: Need a strange sort method...

2006-10-16 Thread Neil Cerutti
rcus Peanuts (Turkish Delight for you non-Yanks). -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Alphabetical sorts

2006-10-17 Thread Neil Cerutti
On 2006-10-17, Ron Adam <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: >> On 2006-10-16, Ron Adam <[EMAIL PROTECTED]> wrote: >>> I have several applications where I want to sort lists in >>> alphabetical order. Most examples of sorting usually sort on >

Re: COM Error -- Urgent help

2006-10-17 Thread Neil Hodgson
gving an error. After all the trouble of marshalling the interface into this thread you aren't using it. Pass my_ie to MyNavigate. I also had some errors before changing from thread to threading. Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: making a valid file name...

2006-10-17 Thread Neil Cerutti
n. Even after applying psyco find was still faster (though I could beat the bisect functions by a little bit by replacing a divide with a shift). -- Neil Cerutti This is not a book to be put down lightly. It should be thrown with great force. --Dorothy Parker -- http://mail.python.org/mailman/listinfo/python-list

Re: Faulty encoding settings

2006-10-17 Thread Neil Cerutti
On 2006-10-17, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Neil Cerutti wrote: >> I'm writing an application that needs all internal character data >> to be stored in iso-8859-1. It also must allow input and output >&g

Re: making a valid file name...

2006-10-17 Thread Neil Cerutti
re I come from, a portable filename is only 8 chars long and matches the regex [A-Z][A-Z0-9]*, i.e., capital letters and numbers, with no extension. That way it'll work on old DOS machines and on Risc-OS. Wait... is there Python for Risc-OS? -- Neil Cerutti > > HTH, cu l8r, Edgar. -- http://mail.python.org/mailman/listinfo/python-list

Re: python's OOP question

2006-10-18 Thread Neil Cerutti
ot; It's pity it didn't get called quack typing. One ckecks if some unknown noun can quack, not if a duck can do something unknown. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

codecs.EncodedFile

2006-10-18 Thread Neil Cerutti
. As it is it silently causes interactive applications to apparently hang forever, and breaks the line-buffering expectation of non-interactive applications. If raising the exception is too much to ask, then at least it should be documented better. -- Neil Cerutti The choir invites any mem

Re: codecs.EncodedFile

2006-10-18 Thread Neil Cerutti
On 2006-10-19, Leo Kislov <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: >> It turns out to be troublesome for my case because the >> EncodedFile object translates calls to readline into calls to >> read. >> >> I believe it ought to raise a NotImplement

Re: making a valid file name...

2006-10-18 Thread Neil Cerutti
k()-t, 2) > > t = clock() > sgood = set(good) > for c in data: > c in sgood > print round(clock()-t, 2), "\n" > > main() On my Python2.4 for Windows, they are often still neck-and-neck for len(good) = 26. set's disadvantage of having to be constructed is heavily amortized over 100,000 membership tests. Without knowing the usage pattern, it'd be hard to choose between them. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: UTF-8 to unicode or latin-1 (and yes, I read the FAQ)

2006-10-19 Thread Neil Cerutti
\xb6ni'.decode('utf-8') returns a Unicode > object. With print this is implicitly converted to string. The > char set used depends on your console No, the setting of the console encoding (sys.stdout.encoding) is ignored. It's a good thing, too, since it's pretty flaky. It

Re: UTF-8 to unicode or latin-1 (and yes, I read the FAQ)

2006-10-19 Thread Neil Cerutti
On 2006-10-19, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Neil Cerutti wrote: > >>> Note that 'K\xc3\xb6ni'.decode('utf-8') returns a Unicode >>> object. With print this is implicitly converted

Re: UTF-8 to unicode or latin-1 (and yes, I read the FAQ)

2006-10-19 Thread Neil Cerutti
On 2006-10-19, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Neil Cerutti wrote: >>> Note that 'K\xc3\xb6ni'.decode('utf-8') returns a Unicode >>> object. With print this is implicitly converted to strin

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

2006-10-19 Thread Neil Cerutti
string') > invert({1:2, 3:4}) Shoot, now you'll have to remember where in heck you stashed that function the next time you need to reverse something. ;-) You'll still be better off in the long run memorizing the slice notation. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: comparing Unicode and string

2006-10-19 Thread Neil Cerutti
characters. My current project (an implementation of the Glk API in Python) would be more troublesome to write if I had to store all my latin-1 character strings as lists or arrays of bytes. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

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

2006-10-19 Thread Neil Cerutti
On 2006-10-19, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > James Stroud wrote: > > > without requiring an iterator > > can we perhaps invent some more arbitrary constraints while > we're at it? No letter G. I don't like them. They wet their nests. --

Re: proper format for this database table

2006-10-20 Thread Neil Cerutti
t; Wrong newsgroup, then. comp.database.* is right next door... > > I know, I'm sorry. It's just that this newsgroup server doesn't > have any database ngs on it. :( Try Google Groups for these annoying cases. -- Neil Cerutti The audience is asked to remain seated until

doctest and exposing internals.

2006-10-20 Thread Neil Cerutti
checking if an event is queued in Glk, so I resorted to exposing the internal state main.char_request in the doc string. What are the alternatives? In addition, the last test in the docstring is only there to ensure that other tests can open a window themselves (this version of the library only allows one window to be open at a time). -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: doctest and exposing internals.

2006-10-20 Thread Neil Cerutti
On 2006-10-20, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > At Friday 20/10/2006 16:29, Neil Cerutti wrote: >>The example of correct usage it what's wrong with the >>docstring. >> >>There's no interface for checking if an event is queued in Glk, >

Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-22 Thread Neil Cerutti
i.org/ > > but none have Python support (or again maybe im wrong) PyGame for SDL, I think. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Arrays? (Or lists if you prefer)

2006-10-22 Thread Neil Cerutti
) and then fill it in afterwards. >>> b =[range(2), range(2)] >>> b [0, 1], [0, 1]] >>> b[0][1] = "OK." >>> b [0, 'OK.'], [0, 1]] A flexible way to do it instead might be to make your data attributes of objects, instead

<    4   5   6   7   8   9   10   11   12   13   >