Re: Tuple slices

2005-01-25 Thread Jeff Shannon
his purely abstract philosophy? Jeff Shannon Technician/Programmer Credit International -- http://mail.python.org/mailman/listinfo/python-list

Re: Another scripting language implemented into Python itself?

2005-01-25 Thread Jeff Shannon
n letting them script it in Python is a perfectly valid (and probably quite desirable) approach. Jeff Shannon Technician/Programmer Credit International -- http://mail.python.org/mailman/listinfo/python-list

Re: Browsing text ; Python the right tool?

2005-01-25 Thread Jeff Shannon
one of Python's RAD tools (Boa Constructor, or maybe PythonCard, as examples) you'd be able to get very nice results. Jeff Shannon Technician/Programmer Credit International -- http://mail.python.org/mailman/listinfo/python-list

Re: Help! Host is reluctant to install Python

2005-01-25 Thread Jeff Shannon
#x27;t be too horrible on resources/management, and that he shouldn't be so afraid to try something new... Jeff Shannon Technician/Programmer Credit International -- http://mail.python.org/mailman/listinfo/python-list

Re: python without OO

2005-01-25 Thread Jeff Shannon
h requires complex inheritance trees. In Python, an object is whatever type it acts like -- behavior is more important than declared type, so there's no value to having a huge assortment of potential types. Deep inheritance trees only happen when people are migrating from Java. ;) Jeff

Re: python without OO

2005-01-25 Thread Jeff Shannon
odes of expression, different ways of approaching the same problem. That's *why* we have so many different programming languages -- because no single approach is the best one for all problems, and knowing multiple approaches helps you to use your favored approach more effectively. J

Re: Browsing text ; Python the right tool?

2005-01-26 Thread Jeff Shannon
John Machin wrote: Jeff Shannon wrote: [...] If each record is CRLF terminated, then you can get one record at a time simply by iterating over the file ("for line in open('myfile.dat'): ..."). You can have a dictionary classes or factory functions, one for each record type

Re: inherit without calling parent class constructor?

2005-01-26 Thread Jeff Shannon
), then you can give D's __init__() a B parameter that defaults to None. Jeff Shannon Technician/Programmer Credit International -- http://mail.python.org/mailman/listinfo/python-list

Re: Browsing text ; Python the right tool?

2005-01-26 Thread Jeff Shannon
John Machin wrote: Jeff Shannon wrote: [...] For ~10 or fewer types whose spec doesn't change, hand-coding the conversion would probably be quicker and/or more straightforward than writing a spec-parser as you suggest. I didn't suggest writing a "spec-parser". No (mechanical)

Re: python without OO

2005-01-27 Thread Jeff Shannon
te, and you have the very essence of object-oriented programming. (What you describe here *is* object-oriented programming, you're just trying to avoid the 'class' statement and use module-objects where 'traditional' OO would use class instances.) Jeff Shannon Techn

Re: how to comment out a block of code

2005-01-27 Thread Jeff Shannon
just for this! Normally it's a large round button, with perhaps a green backlight. Press the button and hold it in for about 3 seconds, and the rest of your code/writing will be ignored just as it should be. Jeff Shannon Technician/Programmer Credit International -- http://mail.python.o

Re: subprocess.Popen() redirecting to TKinter or WXPython textwidget???

2005-01-27 Thread Jeff Shannon
our GUI widgets directly from the worker (i/o) thread -- very few GUI toolkits are threadsafe, so you need to make all GUI calls from a single thread. Jeff Shannon Technician/Programmer Credit International -- http://mail.python.org/mailman/listinfo/python-list

Re: String Fomat Conversion

2005-01-27 Thread Jeff Shannon
me size for your test is a reflection of buffering. The next question is, which provides the most *conceptual* simplicity? (The answer to that one, I think, depends on how your brain happens to see things...) Jeff Shannon Technician/Programmer Credit International -- http://mail.python.org/mailman/listinfo/python-list

Re: inherit without calling parent class constructor?

2005-01-27 Thread Jeff Shannon
Christian Dieterich wrote: On Dé Céadaoin, Ean 26, 2005, at 17:09 America/Chicago, Jeff Shannon wrote: You could try making D a container for B instead of a subclass: Thank you for the solution. I'll need to have a closer look at it. However it seems like the decision whether to do

Re: inherit without calling parent class constructor?

2005-01-27 Thread Jeff Shannon
Christian Dieterich wrote: On Déardaoin, Ean 27, 2005, at 14:05 America/Chicago, Jeff Shannon wrote: the descriptor approach does. In either case, the calculation happens as soon as someone requests D.size ... Agreed. The calculation happens as soon as someone requests D.size. So far so good

Re: Question about 'None'

2005-01-27 Thread Jeff Shannon
flamesrock wrote: I should also mention that I'm using version 2.0.1 (schools retro solaris machines :( ) At home (version 2.3.4) it prints out 'True' for the above code block. That would explain it -- as /F mentioned previously, the special case for None was added in 2.1

Re: tkinter: Can You Underline More Than 1 Char In A Menu Title

2005-01-27 Thread Jeff Epler
On Thu, Jan 27, 2005 at 06:38:22AM -0500, Tim Daneliuk wrote: > Is it possible to underline more than a single character as I am doing > with the 'underline=0' above. I tried 'underline=(0,2)' but that didn't > work. No. Jeff pgpFCNSGSpXA9.pgp D

Re: [Tkinter] problem

2005-01-29 Thread Jeff Epler
) and when it's imported ('python -c "import opt_newlogin"') Jeff pgpCSdrstdRnI.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Basic file operation questions

2005-02-03 Thread Jeff Shannon
be an issue in the vast majority of cases, but I'm naturally curious :) Disk access should be buffered, possibly both at the C-runtime level and at the file-iterator level (though I couldn't swear to that). I'm sure that the C-level buffering happens, though. Jeff Shannon Technic

Re: advice needed for simple python web app

2005-02-04 Thread Jeff Reavis
You might also want to try out Spyce. http://spyce.sourceforge.net/index.html It works in proxy mode, with mod_python, or even as cgi. Some examples: http://spyce.sourceforge.net/eg.html -- http://mail.python.org/mailman/listinfo/python-list

Re: returning True, False or None

2005-02-04 Thread Jeff Shannon
for item in lst: if item is True: return True if item is False: answer = False return answer But yeah, the original, straightforward way is probably enough clearer that I wouldn't bother with anything else unless lists might be long enough for performance to matter. Je

Re: returning True, False or None

2005-02-04 Thread Jeff Shannon
Jeremy Bowers wrote: On Fri, 04 Feb 2005 16:44:48 -0500, Daniel Bickett wrote: [ False , False , True , None ] False would be returned upon inspection of the first index, even though True was in fact in the list. The same is true of the code of Jeremy Bowers, Steve Juranich, and Jeff Shannon. As

Re: changing local namespace of a function

2005-02-04 Thread Jeff Shannon
ating dictionaries that'll be passed into functions, create class instances. class MyClass(object): def __init__(self, **kwargs): for key, val in kwargs: setattr(self, key, val) def fun(self): self.z = self.y + self.x a = MyClass(x=1, y=2) a.fun() print a.z Je

Re: [noob] Error!

2005-02-04 Thread Jeff Shannon
rpreter and try fiddling with things. You've got a lot of subexpressions there; pick some values and try each subexpression, one at a time, and take a look at what you get. I bet that it won't take you long to figure out why you're not getting the result you expect. J

Re: Embedding Python - Deleting a class instance

2005-06-21 Thread Jeff Epler
I wrote the following module to test the behavior of PyInstance_New. I called it something like this: import vedel class k: def __del__(self): print "deleted" vedel.g(k) I get output like: after creation, x->refcnt = 1 doing decref deleted after decref Unles

Re: eval() in python

2005-06-21 Thread Jeff Epler
On Tue, Jun 21, 2005 at 08:13:47AM -0400, Peter Hansen wrote: > Xah Lee wrote: > > the doc seems to suggest that eval is only for expressions... it says > > uses exec for statements, but i don't seem to see a exec function? > > Because it's a statement: http://docs.python.org/ref/exec.html#l2h-563

Re: utf8 silly question

2005-06-21 Thread Jeff Epler
s, then break when you go into production and have non-ASCII strings. Jeff pgpPxBy1C6yly.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP ? os.listdir enhancement

2005-06-22 Thread Jeff Epler
listdir_joined(path) if os.path.isfile(x)] Jeff pgpwXvnkgy6r4.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Loop until condition is true

2005-06-22 Thread Jeff Epler
def until(pred): yield None while True: if pred(): break yield None def example(): i = 0 for _ in until(lambda: x==0): x = 10 - i i += 1 print x, i example() pgpeP7iW6mcQm.pgp Description: PGP signature -- http://mail.python.org/mailman/l

Re: Is this a bug? I don't know where to start

2005-06-22 Thread Jeff Epler
t; items in the output contain one of the duplicated items from the input. Jeff pgpqzHdpM3xQ3.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Frame widget (title and geometry)

2005-06-24 Thread Jeff Epler
label container used to semantically group related widgets. "Frame" widgets are simply containers which are often useful for making the screen layout work the way you want with pack and grid. Jeff pgpdBiMtDJV5v.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Frame widget (title and geometry)

2005-06-24 Thread Jeff Epler
Tkinter.Frame instances are not created with "geometry" or "title" attributes. Whatever 'classtitle' and 'classtitle2' are, they are not written to work with Tkinter.Frame instances. Jeff pgppDkXNnBRVL.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner question: Converting Single-Element tuples to list

2005-06-27 Thread Jeff Epler
maybe you can at least push this into a single convenience function... def destupid(x, constructor=tuple, sequencetypes=(tuple, list)): if x is None: return constructor() if isinstance(x, sequencetypes): return x return constructor((x,)) Jeff pgpC9L79OCj2p.pgp Description: PGP s

Re: Dictionary to tuple

2005-06-28 Thread Jeff Epler
he same. Only if the dictionary is extremely large does the difference matter. (or if you're using an older version of Python without the iteritems method) Jeff pgpegdipnTdVc.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: It seems that ZipFile().write() can only write files, how can empty directories be put into it?

2005-07-01 Thread Jeff Epler
This has been discussed before. One thread I found was http://mail.python.org/pipermail/python-list/2003-June/170526.html The advice in that message might work for you. Jeff pgpPSqdIxsPgx.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Trapping user logins in python ( post #1)

2005-07-04 Thread Jeff Epler
ave an /etc/profile.d where you can drop a file that will be executed at login, too. This will, of course, be executed with the user's privilege level. Another problem with this approach is that /etc/profile is executed for a "login shell", but a graphical login is not a login

Re: importing pyc from memory?

2005-07-04 Thread Jeff Epler
This stupid code works for modules, but not for packages. It probably has bugs. import marshal, types class StringImporter: def __init__(self, old_import, modules): self._import = old_import self._modules = modules def __call__(self, name, *args): module = self.

Re: Tkinter + Tcl help

2005-07-05 Thread Jeff Epler
e character after the un-doubled backslash is one with special meaning (including the commonly-seen \r and \t, but also other letters) then you'll get a pathname and an error that leave you scratching your head. Jeff pgpnln1sZei9p.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: resume upload

2005-07-05 Thread Jeff Epler
probably by using REST. This stupid program puts a 200 line file by sending 100 lines, then using REST to set a resume position and sending the next 100 lines. import getpass, StringIO, ftplib lines = ["Line %d\n" % i for i in range(200)] part1 = "".join(lines[:100]) part2 = "".join(lines[:100])

Re: math.nroot [was Re: A brief question.]

2005-07-06 Thread Jeff Epler
y(y) else: perform_next_step_with_both(x, y) and at the very least duplicate the code for calculating 'y', possibly re-doing a lot of work at runtime too. Jeff pgpVUpJh4xufX.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange os.path.exists() behaviour

2005-07-06 Thread Jeff Epler
exist...: -1 C:\TMP\example>type nonexist The system cannot find the file specified. C:\TMP\example>type exist C:\TMP\example> As you can see, not only does Windows think that "exist" exists, but it can successfully "type" its

Re: Query

2005-07-08 Thread Jeff Epler
python-xlib includes an implementation of the xtest extension, which is enabled on most users' X servers, and can be used to send arbitrary keyboard or mouse events. jeff pgpo7pqhBafPe.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: calling python procedures from tcl using tclpython

2005-07-08 Thread Jeff Hobbs
{ import testfile } assuming it's on the module search path. Look in the python docs about Modules to get all the info you need. -- Jeff Hobbs, The Tcl Guy http://www.ActiveState.com/, a division of Sophos -- http://mail.python.org/mailman/listinfo/python-list

Re: About undisclosed recipient

2005-07-09 Thread Jeff Epler
s no relationship to the headers of the actual message---it simply calls rcpt() once for each address in to_addrs. The example in the docstring doesn't even *have* a To: header in the message! Jeff pgpHNq6sWEuR7.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Efficiency of using long integers to hold bitmaps

2005-07-10 Thread Jeff Melvaine
ion; perhaps the intention is that programmers should not rely on implementation details. Thanks in advance, Jeff -- http://mail.python.org/mailman/listinfo/python-list

Re: cursor positioning

2005-07-11 Thread Jeff Epler
Here's a simple module for doing progress reporting. On systems without curses, it simply uses "\r" to return the cursor to the first column. On systems with curses, it also clears to the end of the line. This means that when the progress message gets shorter, there aren't droppings left from the

Re: Parsing Data, Storing into an array, Infinite Backslashes

2005-07-11 Thread Jeff Epler
Slot=DIMM0/J11, ConfigurationType=2 Memory 1 Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM, Size=512, Slot=DIMM1/J12, ConfigurationType=2 the result is out of order because the result of calling .items() on a dict is in an arbitrary order. Jeff s = [['Memory', '0', 'Summ

Re: Efficiency of using long integers to hold bitmaps

2005-07-12 Thread Jeff Melvaine
Raymond, Thanks for your answers, which even covered the question that I didn't ask but should have. "A Python list is not an array()\n" * 100 :) Jeff "Raymond Hettinger" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [Jeff Melvaine] >

Re: Efficiency of using long integers to hold bitmaps

2005-07-12 Thread Jeff Melvaine
Bengt, Thanks for your informative reply, further comments interleaved. "Bengt Richter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mon, 11 Jul 2005 02:37:21 +1000, "Jeff Melvaine" > <[EMAIL PROTECTED]> wrote: > >>I note that

Re: Browser plug-in for Python?

2005-07-12 Thread Jeff Epler
on 2.1 if I remember correctly. Jeff pgpp6YhsWNcK0.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: ssh popen stalling on password redirect output?

2005-07-15 Thread Jeff Epler
s for more information. Jeff pgpYxuAq33BRa.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: stdin/stdout fileno() always returning -1 from windows service

2005-07-18 Thread Jeff Epler
cause there *is* no standard I/O for a windows service. You should be able to execute code like import sys sys.stdout = sys.stderr = open("some.log", "w") if you have code that expects the standard output files to be available. You could also open sys.stdin in a sim

Re: stdin/stdout fileno() always returning -1 from windows service

2005-07-18 Thread Jeff Epler
and verse on MSDN, more power to you. This page implies that the "standard handles" are only available when there is a console for the application. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getstdhandle.asp Jeff pgpD1VX32k6bY.pgp Description: PGP

Re: Windows command line problem

2005-07-18 Thread Jeff Epler
p1256 cp1257 cp1258 cp874 Windows is clearly doing something clever. Jeff pgpBF8oGcCMZc.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Opinions on KYLIX 3 (Delphi 4 Linux)

2005-07-18 Thread Jeff Epler
or decides they only want to sell a new, incompatible product. What do you do with your existing product when that happens? Re-train on a new platform, and re-write from scratch? Just say no to proprietary software. Jeff pgpiV5WmgG2I1.pgp Description: PGP signature -- http://mail.python.org/mai

Re: Image orientation and color information with PIL?

2005-07-18 Thread Jeff Epler
f() >>> if e: print e[274] 1 I have written a standalone Python module that reads and changes the EXIF orientation data. You can view it here: http://unpy.net/cgi-bin/viewcvs.cgi/aethertool/disorient.py?rev=1.2&content-type=text/vnd.viewcvs-markup It is available under the terms of th

Re: Image orientation and color information with PIL?

2005-07-18 Thread Jeff Epler
but instead I bought a digital camera with an orientation sensor. Jeff pgpJZsejWH68l.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: What is your favorite Python web framework?

2005-07-18 Thread Jeff Shell
Zope 3, far and away. There's great documentation, quite a few load handling options (different types of caching and ZEO to distribute ZODB caches to multiple machines). Zope 3 aggressively favors small cooperating objects (Zope 2 was inheritance heavy, making customization, extension, etc, a big c

Re: Filling up commands.getstatusoutput's buffer

2005-07-21 Thread Jeff Epler
thout any problem. (RedHat 9, Python 2.2) >>> len(commands.getoutput("dd if=/dev/zero bs=512 count=512000 2>/dev/null")) 262144000 >>> 512 * 512000 262144000 Jeff pgpwMseDka1nF.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: time.time() under load between two machines

2005-07-22 Thread Jeff Epler
our case, I suspect it is the operating system, not Python. Jeff import os, sys, time def serve(): while 1: data = struct.pack("!d", time.time()) os.write(1, data) time.sleep(1) def recv(fileno): while 1: data = struct.unpack("!d", o

Re: Mapping a drive to a network path

2005-07-22 Thread Jeff Epler
import os os.system(r"net use z: \\computer\folder") Something in the win32net module of win32all may be relevant if you don't want to do it through os.system: http://aspn.activestate.com/ASPN/docs/ActivePython/2.4/pywin32/win32net__NetUseAdd_meth.html Jeff pgp7mEoPdAfNP.

Re: Mapping a drive to a network path

2005-07-22 Thread Jeff Epler
in fact, see this thread, it may have something useful for you: http://mail.python.org/pipermail/python-win32/2003-April/000959.html Jeff pgprYPOH3yOyI.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting TypeError in Changing file permissions

2005-07-22 Thread Jeff Epler
If you are using Unix, and all you have is the file object, you can use os.fchmod(outfile.fileno(), 0700) Jeff pgp8U05e26RUt.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about namespaces and import. How to avoid calling os.system

2005-07-22 Thread Jeff Epler
gen.do(env_params) Jeff pgpUfjHyNbbRr.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: How to realize ssh & scp in Python

2005-07-24 Thread Jeff Epler
rd' it worked for me. In another recent thread, a different poster claimed it didn't work, so your results may vary. Jeff [1] http://pexpect.sourceforge.net/ pgprScaQubqXA.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter - Resizing a canvas with a window

2005-07-26 Thread Jeff Epler
) self.b1.pack(side=BOTTOM, anchor=E, padx=4, pady=4) root = Tk() app = testApp2(root) root.mainloop() Jeff PS thanks for including a full, runnable program in your post! pgpqy4uUUgiLH.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Stripping C-style comments using a Python regexp

2005-07-27 Thread Jeff Epler
s as are in the matched thing, or ' ' otherwise, so that line numbers remain unchanged. Basically, the regular expression is a tokenizer, and replace() chooses what to do with each recognized token. Things not recognized as tokens by the regular expression are left unchanged. Jeff PS t

Re: codecs.getencoder encodes entire string ?

2005-07-28 Thread Jeff Epler
On Thu, Jul 28, 2005 at 08:42:57AM -0700, nicolas_riesch wrote: > And a last question: can I call this "enc" function from multiple > threads ? Yes. Jeff pgphSka1eU9PQ.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: poplib.POP3.list() returns extra value?

2005-07-28 Thread Jeff Epler
. If you feel comfortable doing it, dive in and improve the documentation of poplib. Submitting a patch to the patch tracker on sf.net/projects/python is probably the best way to do this, if you have the necessary knowledge of cvs to produce a patch. Jeff pgpR6zOckMUPS.pgp Description: PGP sign

Re: A replacement for lambda

2005-07-30 Thread Jeff Epler
ovement. Even better if the keyword 'auto' could be made optional! (Of course, this is another break with C, where the declaration auto i; makes 'i' an int) And what's this got to do with Python? I dunno. Sorry. Jeff [1] http://www.informit.com/content/image

Re: Newb: Telnet 'cooked data','EOF' queries.

2005-07-31 Thread Jeff Epler
elnet is when the other side closes the socket. Jeff pgpnCbDvhyN27.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting not derived members of a class

2005-08-01 Thread Jeff Epler
elif f[i] > HAVE_ARGUMENT: i += 3 else: i += 1 return result >>> import franz >>> franz.find(y.__class__) ['__module__', 'who1', '__init__', '__doc__', '_b'] Jeff pgpU4zGsIJWPJ.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Request for Input re PyCon about Session Lengths

2005-08-02 Thread Jeff Rush
ly: http://mail.python.org/mailman/listinfo/pycon-organizers Please read the archives to come up to speed on the various viewpoints. -Jeff Rush -- http://mail.python.org/mailman/listinfo/python-list

Re: Proposed new collection methods

2005-08-06 Thread Jeff Schwab
Robert Kern wrote: > Robert Kern wrote: > >> Christopher Subich wrote: >> >> >>> Dear Zeus no. Find can be defined as: >>> def find(self, test=lambda x:1): >>>try: >>> item = (s for s in iter(self) if test(s)).next() >>>except StopIteration: >>> raise ValueError('No matching i

Re: Proposed new collection methods

2005-08-06 Thread Jeff Schwab
Robert Kern wrote: > (s for s in iter(self) is test(s)) is a generator expression. It is > roughly equivalent to > > def g(self, test=lambda x: True): > for s in iter(self): > if test(s): > yield s > > Now, if I were to do > > item = g(self, test).next() > > the generato

Re: Creating a virtual file system

2005-08-07 Thread Jeff Schwab
Atila Olah wrote: > I'm working on a project to implement a simple cross-platform file > sharing protocol (using Python) that is similar to HTTP, and I have to > write a GUI for Windows and Linux. But let's start with the harder one: > Windows. > > My question is: How do I implement a virtual part

Re: Creating a virtual file system

2005-08-09 Thread Jeff Schwab
Bryan Olson wrote: > > Atila Olah wrote: > > My question is: How do I implement a virtual partition that acts like a > > real file-system and is compleatly transparent to other programs? > > Should I make a virtual file allocation table for a FAT32 partition or > > simulate an NTFS? Or even fu

Re: Recommendations for CVS systems

2005-08-09 Thread Jeff Schwab
Mike Meyer wrote: > Well, the only thing that subversion does that I'd call bad is leave > turds in my development directory. I'm tired of having to tell > commands to ignore .svn files. Of course, Perforce is the only source > control system I know of that doesn't do this. ClearCase is really goo

Re: Is there a way of executing a command in a string?

2005-08-09 Thread Jeff Schwab
Jerry He wrote: > Hi, > suppose I have the following string > > cmdstr = "b = lambda s: s*s" > > Is there a way to execute this string other than > copying it onto a file and then importing it? >>> exec "b = lambda s: s*s" >>> b at 0x4d69cc> -- http://mail.python.org/mailman/listinfo/p

Re: Creating a virtual file system

2005-08-09 Thread Jeff Schwab
Bryan Olson wrote: > Jeff Schwab wrote: > > You don't have to pay Microsoft to develop a Windows-compatible > > filesystem. See http://ubiqx.org/cifs/. > > That's a different usage of "filesystem" than what is at issue > here. I agree that you &

Re: Help with Regular Expressions

2005-08-10 Thread Jeff Schwab
Harlin Seritt wrote: > I am trying to find some matches and have them put into a list when > processing is done. I'll use a simple example like email addresses. > > My input is the following: > wordList = ['myname1', '[EMAIL PROTECTED]', '[EMAIL PROTECTED]', > '[EMAIL PROTECTED]', '[EMAIL PROTECT

Re: how to write a line in a text file

2005-08-10 Thread Jeff Schwab
Calvin Spealman wrote: > On 7/31/05, James Dennett <[EMAIL PROTECTED]> wrote: > >>Peter Hansen wrote: >> >> >>>Steven D'Aprano wrote: >>> >>>Given that ZODB and PySQLite are simply Python extension modules, which >>>get bundled by your builder tool and are therefore installed >>>transparently alon

regex help

2005-08-10 Thread jeff sacksteder
Regex questions seem to be rather resistant to googling. My regex currently looks like - 'FOO:.*\n\n' The chunk of text I am attempting to locate is a line beginning with "FOO:", followed by an unknown number of lines, terminating with a blank line. Clearly the ".*" phrase does not match the sing

Re: What is Python?!

2005-08-10 Thread Jeff Schwab
bruno modulix wrote: > bash is a scripting language, Bash is a shell. It is frequently used for scripting, but that is only a secondary purpose. > javascript is a scripting language, Yes, but it's a particularly specialized one. > perl is a scripting language, Blasphemy! Perl is a dynamic l

Re: Regular expression to match a #

2005-08-11 Thread Jeff Schwab
John Machin wrote: > Search for r'^something' can never be better/faster than match for > r'something', and with a dopey implementation of search [which Python's > re is NOT] it could be much worse. So please don't tell newbies to > search for r'^something'. How else would you match the beginn

Re: Python Challenge on BBC

2005-08-11 Thread Jeff Schwab
Magnus Lie Hetland wrote: > Just saw this on the BBC World program Click Online: > > http://bbcworld.com/content/template_clickonline.asp?pageid=665&co_pageid=6 > > I must say, I think this is the first time I've heard Python discussed > on TV at all... Cool :) > > (Now maybe I'll have to fini

Re: How do these Java concepts translate to Python?

2005-08-11 Thread Jeff Schwab
Ray wrote: > Devan L wrote: > >>Fausto Arinos Barbuto wrote: >> >>>Ray wrote: >>> >>> 1. Where are the access specifiers? (public, protected, private) >>> >>>AFAIK, there is not such a thing in Python. >>> >>>---Fausto >> >>Well, technically you can use _attribute to mangle it, but technic

Re: Running one Python program from another as a different user

2005-08-12 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: > Greetings- > This is on Linux... I have a daemon running as root and I want to > execute another Python program as another user (a regular user). I have > the name of the user and can use the 'pwd' and 'grp' modules to get > that user's user and group ids. What I don't un

Re: Running one Python program from another as a different user

2005-08-12 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: > Thanks, that looks very promising... > Is there a solution for pre-Python v2.4? I have to have code that works > on 2.x, 0<=x<=4. Do I just use the os.popen instead? import os def run_as(username): pipe = os.popen("su %s" % username, 'w') pipe.write("w

Re: Spaces and tabs again

2005-08-13 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: > Hello, I know this topic was discussed a *lot* in the past, sorry if it > bores you... > >>From the Daily Python-URL I've seen this interesting Floating Point > Benchmark: > http://www.fourmilab.ch/fourmilog/archives/2005-08/000567.html > > This is the source pack: > ht

Re: Spaces and tabs again

2005-08-13 Thread Jeff Schwab
Christopher Subich wrote: > [EMAIL PROTECTED] wrote: > >> Are you kidding? You are going to MANDATE spaces? > > > Actually, future whitespace rules will be extensive. See: > http://64.233.187.104/search?q=cache:k1w9oZr767QJ:www.artima.com/weblogs/viewpost.jsp%3Fthread%3D101968 > > > (google

Re: How can I exclude a word by using re?

2005-08-14 Thread Jeff Schwab
could ildg wrote: > In re, the punctuation "^" can exclude a single character, but I want > to exclude a whole word now. for example I have a string "hi, how are > you. hello", I want to extract all the part before the world "hello", > I can't use ".*[^hello]" because "^" only exclude single char "

Re: get the return code when piping something to a python script?

2005-08-16 Thread Jeff Schwab
mhenry1384 wrote: > On WinXP, I am doing this > > nant.exe | python MyFilter.py > > This command always returns 0 (success) because MyFilter.py always > succeeds. ... > How do I set the return code from MyFilter.py based on the return of > nant.exe? Is this possible? I have googled around for

Re: Database of non standard library modules...

2005-08-19 Thread Jeff Schwab
Steve Holden wrote: > Robert Kern wrote: > >> Jon Hewer wrote: >> >>> Is there an online database of non standard library modules for Python? >> >> >> >> http://cheeseshop.python.org/pypi >> > While cheeseshop might resonate with the Monty Python fans I have to say > I think the name sucks in ter

Re: Python for Webscripting (like PHP)

2005-08-19 Thread Jeff Reavis
You might want to check out spyce. It uses a server page model (like jsp and php) so you can embed python in html. It has the standard stuff you would need for making a web site (session support, etc) and also contains features like custom tags. http://spyce.sourceforge.net/ -- http://mail.pytho

Re: stdin -> stdout

2005-08-20 Thread Jeff Schwab
max(01)* wrote: > i was wondering, what's the simplest way to echo the standard input to > the standard output, with no modification. ... > ps: in perl you ca do this: > > ... > while ($line = ) > { > print STDOUT ("$line"); > } > ... I guess you could, but there wouldn't be much point.

Re: Please Criticize My Code

2005-08-20 Thread Jeff Schwab
Christoph Rackwitz wrote: > i guess, it is pythonchallenge.com level 10? > if so, i used this thing: > > import re > def enc(s): > return ''.join('%s%s' % (len(a[0]),a[0][0]) for a in > re.findall('((.)\\2*)', s)) > Don't do that! -- http://mail.python.org/mailman/listinfo/python-list

Re: last line chopped from input file

2005-08-21 Thread Jeff Schwab
Eric Lavigne wrote: > Here is a shell command (MS-DOS): > debug\curve-fit output.txt > > And here is a Python script that *should* do the same thing (and almost > does): Python equivalent is roughly: import os import subprocess subprocess.Popen([os.path.join("debug", "

Re: Gimp-Python

2005-08-21 Thread Jeff Schwab
danilo wrote: > > Salve, > > qualcuno sa se è ancora in fase di sviluppo e qual'è il sito di > riferimento? > > Grazie > Danilo Gesundheit. -- http://mail.python.org/mailman/listinfo/python-list

Re: Binary Trees in Python

2005-08-21 Thread Jeff Schwab
Jorgen Grahn wrote: > On Sat, 20 Aug 2005 15:19:55 -0400, Roy Smith <[EMAIL PROTECTED]> wrote: > >>In article <[EMAIL PROTECTED]>, >> [diegueus9] Diego Andrés Sanabria <[EMAIL PROTECTED]> wrote: >> >> >>>Hello!!! >>> >>>I want know if python have binary trees and more? >> >>Python does not come wi

<    1   2   3   4   5   6   7   8   9   10   >