Pattern Classification Frameworks?

2007-06-12 Thread Evan Klitzke
s. Has anyone worked with any of these frameworks? Are there any other frameworks I should be aware of? Also, as a sidenote, are there any texts that anyone can recommend to me for learning more about this area? I'm a mathematician by training, so I'm not afraid to jump into reasonably ad

Re: Convert String to Int and Arithmetic

2007-06-12 Thread Evan Klitzke
module to match regular expressions, but you may not have to use that module if you know the exact form of the strings you are parsing. Once you parse out the number into a string such as '100' you can just cast it as an integer using some code like x = int('100')

Re: how to kill a process

2007-06-12 Thread Evan Klitzke
nt process is your own python script, you might try a call to os.wait after the kill statement. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: a question about unicode in python

2007-06-12 Thread Evan Klitzke
be able to test for a UTF-8 encoded file using the "file" command, e.g. [EMAIL PROTECTED] ~ $ file ~/uni.py /home/evan/uni.py: UTF-8 Unicode text -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Pattern Classification Frameworks?

2007-06-12 Thread Evan Klitzke
fication problem (including the text > classification problems you're looking at). You just need to pick out a > set of relevant features to describe your data, and feed those features > along with your chosen labels to a machine learning algorithm. > > STeVe Thanks Steven

Re: How to save python codes in files?

2007-06-12 Thread Evan Klitzke
of your file and then chmod +x the file to make it into an executable script: #!/usr/bin/env python -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: How to save python codes in files?

2007-06-13 Thread Evan Klitzke
On 6/13/07, why? <[EMAIL PROTECTED]> wrote: > > Evan Klitzke wrote: > > On 6/12/07, why? <[EMAIL PROTECTED]> wrote: > > > Im working with Python 2.2 on my red hat linux system. Is there any > > > way to write python codes in separate files and save them

Re: a question about unicode in python

2007-06-13 Thread Evan Klitzke
which looks for me as the mail editor did > > not send the mail as utf. Try to attach a correct text file. > > That must be your mail client, not his text editor or mail client. I > do see two Chinese characters in the message. Nonetheless, the email is not UTF-8 encoded (it's encoded in gb2312, which is much more commonly used in China than UTF-8). It's likely that the source code file is encoded using GB characters as well. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: for web application development

2007-06-14 Thread Evan Klitzke
u want to build a a much bigger site you should obviously look into the other frameworks that are available, particularly Django. [1] http://www.python.org/dev/peps/pep-0333/ -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Moving items from list to list

2007-06-14 Thread Evan Klitzke
8, 9, 10] b = a[2:] + b a = a[:2] Now the contents of a and b respectively are a = [1, 2] and b = [3, 4, 5, 6, 7, 8, 9, 10]. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Want to learn Python

2007-06-15 Thread Evan Klitzke
ommend to people who want to learn the language. I started off with the O'Reilly book, and that book went too slow and didn't cover as many topic as the Apress book. If you are an experienced programmer and use the Apress book, you'll get a pretty good grasp of the language within

Re: How do I write to a CD?

2007-06-16 Thread Evan Klitzke
a CD, you need to put a bootloader (and a kernel, of course) onto the device. If you are putting a Linux kernel onto the CD, the most common bootloader to use is ISOLINUX, although a recent release of GRUB will work as well. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: a_list.count(a_callable) ?

2007-06-16 Thread Evan Klitzke
a true value other than True or the number 1 > (which are technically the same), it is not 'equal' to True. Either If you're _really_ pedantic, 1 and True are _not_ the same, and this can be an important distinction in some situations. >>> 1 == True True >>> 1 is True False -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: avoid script running twice

2007-06-18 Thread Evan Klitzke
ome predetermined port (presumably above 1024), and then have your program try to connect to that port and "talk" to the other program to determine whether or not to run (or whether to do some of the remaining work, etc.). -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: avoid script running twice

2007-06-18 Thread Evan Klitzke
On 6/18/07, Tim Williams <[EMAIL PROTECTED]> wrote: > On 18/06/07, Evan Klitzke <[EMAIL PROTECTED]> wrote: > > On 6/18/07, Robin Becker <[EMAIL PROTECTED]> wrote: > > > I wish to prevent a python script from running twice; it's an hourly job, > >

Line Wrapping

2007-06-18 Thread Evan Klitzke
odule that is unknown to me. Does anyone have any clean, short solutions to this problem? -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Line Wrapping

2007-06-18 Thread Evan Klitzke
On 6/18/07, TeroV <[EMAIL PROTECTED]> wrote: > Evan Klitzke wrote: > > All, > > > > Mail messages should be wrapped at 78 characters (as suggested in RFC > > 2822). I want my python batch scripts/cron jobs to enforce this > > behavior, and format th

Re: avoid script running twice

2007-06-18 Thread Evan Klitzke
On 6/18/07, Robin Becker <[EMAIL PROTECTED]> wrote: > Evan Klitzke wrote: > > > > > > Another method that you can use is to open up a socket on some > > predetermined port (presumably above 1024), and then have your program > > try to connect to th

Re: Do U have anything to share with this students

2007-06-18 Thread Evan Klitzke
r something to be impossible, right? ;-) -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: caseless dictionary howto ?

2007-06-19 Thread Evan Klitzke
gt; or are there better ways ? Since you want an almost dictionary, you should create a new class that inherits from dict and overloads the methods that you want to change. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

stftime %z time conversion character

2007-06-19 Thread Evan Klitzke
then use the %Z token on that. Is there another (or better) way? -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: stftime %z time conversion character

2007-06-19 Thread Evan Klitzke
On 6/19/07, Paul Boddie <[EMAIL PROTECTED]> wrote: > Evan Klitzke wrote: > > Although it is not present in ANSI C, the GNU version of stftime > > supports the conversion character %z, which is a time offset from GMT. > > The four digit time offset is required in R

Re: Python IDE

2007-06-19 Thread Evan Klitzke
machine screen is running on, the load information, and the time) as well, plus support for 256 colors, which lets you use those nice 256 color vim colorschemes. If you're interested you can grab it at http://eklitzke.org/files/.screenrc -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Execute script on remote computer

2007-06-19 Thread Evan Klitzke
x27;bar' on that machine (rather than launching a shell, which is what ssh will do if no command is specified). When the command exits, ssh will exit as well. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: determine 32 or 64 bit architecture with python 2.2

2007-06-19 Thread Evan Klitzke
e() and check what architecture the kernel is built for. For example, [EMAIL PROTECTED] ~ $ python -c 'import os; print os.uname()[4]' i686 As you can see, I'm on a 32 bit system. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Python IDE

2007-06-20 Thread Evan Klitzke
On 6/19/07, Evan Klitzke <[EMAIL PROTECTED]> wrote: > On 6/19/07, Bjoern Schliessmann > <[EMAIL PROTECTED]> wrote: > > BartlebyScrivener wrote: > > > VIM > > > > *clap-clap* > > > > BTW, are there tutorials on the more arcane vim function

Re: Python and (n)curses

2007-06-20 Thread Evan Klitzke
s.sourceforge.net/. I have the fortune not to have a need to do Windows curses programming ;-) so I'm not sure how good the Python support is, but a quick Google search showed a number of ad hoc Python wrappers for it. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: The Modernization of Emacs

2007-06-20 Thread Evan Klitzke
were available due to the lack of features like this one. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: The Modernization of Emacs

2007-06-20 Thread Evan Klitzke
On 6/20/07, Evan Klitzke <[EMAIL PROTECTED]> wrote: > On 6/20/07, Martin Gregorie <[EMAIL PROTECTED]> wrote: > > Amongst its benefits are that you can do anything its capable of by > > using only a standard QUERTY keyboard plus ESC - no function keys, etc > > are n

Re: Downloading from a clean url

2007-06-20 Thread Evan Klitzke
age's data without > knowing the file of the url's path. For instance http://kde.org If the page is omitted, as in your example of http://kde.org, the page is / -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-06-20 Thread Evan Klitzke
to deal with type errors in this context. So it's not that this issue is useless, but rather that it isn't useful enough to warrant someone implementing it. If there was a good implementation, and people really liked it and saw how great it was, I don't think there's any fundamental opposition to its inclusion in the language. But this hasn't happened yet. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Downloading from a clean url

2007-06-21 Thread Evan Klitzke
On 6/21/07, D.Hering <[EMAIL PROTECTED]> wrote: > > Evan Klitzke wrote: > > On 6/20/07, D.Hering <[EMAIL PROTECTED]> wrote: > > > General: > > > How do I download a page's data from a clean url. > > > > > > Specific: > > &

Re: How to create a file with read access rights

2007-06-21 Thread Evan Klitzke
es) and os.chmod (for existing files). -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Internationalised email subjects

2007-06-21 Thread Evan Klitzke
mit Chinese characters). Your email header shows: Content-Type: text/plain; charset="us-ascii" You probably need to reconfigure your mail client to send Chinese characters. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

rsync module?

2007-06-21 Thread Evan Klitzke
ectly. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Google breaks international charset messages (was: Internationalised email subjects)

2007-06-21 Thread Evan Klitzke
ndard for SMTP, so it's a reasonable default character encoding to send MIME encoded messages in -- and it's trivial to change the outgoing character set to UTF-8 in Gmail/Google Apps. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Error while installing Python2.5.1

2007-06-21 Thread Evan Klitzke
On 6/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I dont understand What are my distribution repositories? AFAIK there aren't any repositories for Red Hat 9. But there should be a gcc rpm on your installation media. -- Evan Klitzke <[EMAIL PROTECTED]> -- ht

Re: "assert" annoyance

2007-06-21 Thread Evan Klitzke
quot;...world!" > You can only pass one argument to a command that you invoke with the shebang sequence, so this won't work the way you wrote it. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: "assert" annoyance

2007-06-22 Thread Evan Klitzke
On 6/22/07, Miles <[EMAIL PROTECTED]> wrote: > On Jun 22, 2:45 am, "Evan Klitzke" <[EMAIL PROTECTED]> wrote: > > On 6/21/07, Miles <[EMAIL PROTECTED]> wrote: > > > > > On Jun 22, 1:31 am, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > &g

Tailing a log file?

2007-06-22 Thread Evan Klitzke
ethod blocks until a new line appears in the file, unlike the standard readline() method which returns an empty string on EOF. Does anyone have any suggestions on how to do this? Thanks in advance! -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: howto run a function w/o text output?

2007-06-22 Thread Evan Klitzke
em you can do os.close(1); os.close(2) to suppress output to stdout and stderr. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Tailing a log file?

2007-06-22 Thread Evan Klitzke
On 6/22/07, Evan Klitzke <[EMAIL PROTECTED]> wrote: > Everyone, > > I'm interested in writing a python program that reads from a log file > and then executes actions based on the lines. I effectively want to > write a loop that does something like this: >

Re: automatical pdf generating

2007-06-25 Thread Evan Klitzke
tools for manipulating pdfs (and I believe you can also use ImageMagick and treat them as images). It might be worthwhile to install Cygwin and explore this option. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing python under the linux

2007-06-26 Thread Evan Klitzke
here-and-a-version-number (make the changes you want to make) sudo dpkg-buildpackage -rfakeroot -b If you need more help building the deb, you should ask on the Ubuntu mailing lists. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Hi How to implement switch case statement.

2007-06-26 Thread Evan Klitzke
of viruses. The company > accepts no liability for any damage caused by any virus transmitted by this > email. > > www.wipro.com > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Chroot Jail Not Secure for Sandboxing Python?

2007-06-26 Thread Evan Klitzke
nd with some different outcomes. > > It looks the like only option available to me right now is fakechroot, > which really doesn't sound like it's going to work. So I'm going to > give Bett Cannon's stuff (http://sayspy.blogspot.com/2007/05/i-have- > finished-securing-python.html) a try. To launch a child process in a chroot you can easily just fork and then make the chroot syscall in the child process immediately after the fork. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Set builtin lookups

2007-06-26 Thread Evan Klitzke
table? -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading image dimensions before it is loaded from a web form using python.

2007-06-30 Thread Evan Klitzke
#x27;s no simple way to find out that information without uploading the entire image. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading image dimensions before it is loaded from a web form using python.

2007-06-30 Thread Evan Klitzke
On 6/30/07, Cameron Laird <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Evan Klitzke <[EMAIL PROTECTED]> wrote: > >On 6/30/07, Norman Khine <[EMAIL PROTECTED]> wrote: > >> Hello, > >> I am writing an application using python th

Re: object references/memory access

2007-06-30 Thread Evan Klitzke
ts. I'm not familiar enough with the Python C API to tell you how easy this would be, but that might be a good place to start your investigations. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Reversing a string

2007-07-01 Thread Evan Klitzke
reads more like a textbook example which > is about where I am at. Is there any speed benefit from the one liner? The one line is quite a bit faster: [EMAIL PROTECTED] ~ $ python -m timeit 's = "onomatopoeia"; s = s.join(s[::-1])' 10 loops, best of 3: 6.24 usec per loop

Re: Python compilation ??

2007-07-02 Thread Evan Klitzke
s run to speed up subsequent executions of a script. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Python compilation ??

2007-07-03 Thread Evan Klitzke
On 7/3/07, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Evan Klitzke a écrit : > > On 7/2/07, Cathy Murphy <[EMAIL PROTECTED]> wrote: > >> Is python a compiler language or interpreted language. If it is > >> interpreter > >> , then why do we

Re: What is the most efficient way to test for False in a list?

2007-07-08 Thread Evan Klitzke
ist? In general, you can just do: if something in list: do_something() -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: 2**2**2**2**2 wrong? Bug?

2007-07-11 Thread Evan Klitzke
rators in question. For example, subtraction is always left associative -- you would be really surprised if 3 - 2 - 1 evaluated to 2. Python happens to choose right associativity for exponentiation because it is more useful for that operator, but that doesn't make the language itself right as

Re: 2**2**2**2**2 wrong? Bug?

2007-07-11 Thread Evan Klitzke
gt; | 9 > | 9 > | 9 > > Sorry, couldn't resist. But you can append ! (i.e. factorial) indefinitely without adding any digits to make the number arbitrarily large ;-) -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: How to create new files?

2007-07-12 Thread Evan Klitzke
ere is an implementation in mxtools, however). -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Fast powerset function

2007-07-12 Thread Evan Klitzke
pset = set() for num_tokens in xrange(1, len(s)): for combo in get_combinations(s, num_tokens): pset.add(combo) # These two are special cases pset.add(s) pset.add(tuple()) return pset if __name__ == '__main__': print powerset((1, 2, 3, 4)) -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Fast powerset function

2007-07-12 Thread Evan Klitzke
On 7/12/07, Evan Klitzke <[EMAIL PROTECTED]> wrote: > On 7/12/07, Arash Arfaee <[EMAIL PROTECTED]> wrote: > > I need a powerset generator function. It's really slow with recursion. Does > > anybody have any idea or code(!!) to do it in an acceptable time? > >

Re: Fast powerset function

2007-07-13 Thread Evan Klitzke
om a coworker: s = range(18) result = [] l = len(s) for i in range(2**l): n = i x = [] for j in range(l): if n & 1: x.append(s[j]) n >>= 1 result.append(x) print result -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Evan Klitzke
inline is a keyword in C since C99. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Semantics of file.close()

2007-07-17 Thread Evan Klitzke
try to close a file that isn't open. In Python you don't even have to worry about that -- if you close a regular file object more than once no exception will be thrown, _unless_ you are using os.close(), which mimics the C behavior. If you are out of space, in C you will get

Re: Semantics of file.close()

2007-07-17 Thread Evan Klitzke
On 7/17/07, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > "Evan Klitzke" <[EMAIL PROTECTED]> writes: > > > You should take a look at the man pages for close(2) and write(2) (not > > fclose). Generally you will only get an error in C if you try to close > &g

Re: Newbie: freebsd admin scripting

2007-07-18 Thread Evan Klitzke
t come up. If you're diligent with this you can start writing your own sysadmin python toolkit to make your job a lot easier. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Code objects

2007-07-23 Thread Evan Klitzke
an object/function foo components = [cc[1] for cc in inspect.getmembers(foo,\ inspect.iscode)] -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: python-fam documentation.

2007-07-25 Thread Evan Klitzke
On 7/25/07, Evan Klitzke <[EMAIL PROTECTED]> wrote: > On 7/23/07, Shriphani <[EMAIL PROTECTED]> wrote: > > Folks, > > I am trying to create an app which stares at a file and when the file > > is altered, the script joins a channel on freenode and reports that >

Re: python-fam documentation.

2007-07-25 Thread Evan Klitzke
rtunately i have been unable > to find documentation for it. Can someone please help me ? > Thanks, > Shriphani Palakodety. If you're running a newish version of Linux; this module has fairly complete documentation. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: making a variable available in a function from decorator

2007-07-30 Thread Evan Klitzke
f course, it would generally be better to write your own class for this sort of thing, so that you can set the variable in the instance scope. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

calling superclass __init__ when superclass is object

2007-08-01 Thread Evan Klitzke
Hi list, I was reading this article: http://fuhm.net/super-harmful/ and didn't understand the comment about calling super(Foo, self).__init__() when Foo inherits only from object. Can someone on the list elaborate more on why one should do this? -- Evan Klitzke <[EMAIL PROTECTED]&g

Re: access the name of my method inside it

2007-08-01 Thread Evan Klitzke
; Thanks. > james I would suggest instead setting an attribute on the function object via a decorator, and then have your mod_python handler check for the presence of that attribute on the function that is being called, rather than doing a DB lookup. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: calling superclass __init__ when superclass is object

2007-08-01 Thread Evan Klitzke
On 8/1/07, Evan Klitzke <[EMAIL PROTECTED]> wrote: > Hi list, > > I was reading this article: http://fuhm.net/super-harmful/ and didn't > understand the comment about calling super(Foo, self).__init__() when > Foo inherits only from object. Can someone on the list e

Re: (no) fast boolean evaluation ?

2007-08-02 Thread Evan Klitzke
print 'bar' def my_and(lh, rh): return a and b Then my_and(a(), b()) will evaluate both a and b and print both foo and bar even though a() is False. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Best programs written completly in Python

2007-08-05 Thread Evan Klitzke
drian code review system is written in Python and looks really amazing. I just wish I could try it out :-) -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Seek the one billionth line in a file containing 3 billion lines.

2007-08-07 Thread Evan Klitzke
split the log file into smaller chunks (split can split by line amounts), but since that still has to scan the file it will will be IO bound. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Misleading wikipedia article on Python 3?

2007-08-08 Thread Evan Klitzke
o stderr. As a function, you can convert print wholesale to another logging function, or wrap it transparently like this to provide additional logging functionality. What do you find wrong with this sort of "monkeypatching"? -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Assignments and Variable Substitution

2007-08-13 Thread Evan Klitzke
ng a loop. You can't assign a variable whose name is 123, but you can do this sort of thing with setattr. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: using super() to call two parent classes __init__() method

2007-08-17 Thread Evan Klitzke
because the super call doesn't really call the parent class' method, it actually calls the next method in the MRO. The MRO in this case will be Base -> Parent1 -> Parent2 -> object. You can read the details of Python's MRO here http://www.python.org/download/releases/2.3/mro/

Re: Retrieving a variable's name.

2007-08-20 Thread Evan Klitzke
for key, value in globals().iteritems(): if value is arg: d[key] = value break return d Note that this returns a dictionary, rather than a string, but this is trivial to modify. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Retrieving a variable's name.

2007-08-20 Thread Evan Klitzke
On 8/20/07, Evan Klitzke <[EMAIL PROTECTED]> wrote: > On 8/20/07, rodrigo <[EMAIL PROTECTED]> wrote: > > How would I go about retrieving a variable's name (not its value)? I > > want to write a function that, given a list of variables, returns a > > string w

Re: Extracting the traceback

2007-08-21 Thread Evan Klitzke
o a string for some other purpose (e.g. logging, email notifications) I believe that you must use a StringIO object. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Extracting the traceback

2007-08-21 Thread Evan Klitzke
On 8/21/07, codesite-noreply <[EMAIL PROTECTED]> wrote: > On 22 Ago, 02:09, "Evan Klitzke" <[EMAIL PROTECTED]> wrote: > > On 8/21/07, billiejoex <[EMAIL PROTECTED]> wrote: > > > > > > > > > Hi there, > > > I'm f

Re: Co-developers wanted: document markup language

2007-08-24 Thread Evan Klitzke
sions of documents, or do you plan to have a real PDF/Postscript backend? -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Co-developers wanted: document markup language

2007-08-24 Thread Evan Klitzke
p language. Are there any plans on adding provisions for layout and positioning? The difficulty of learning advanced layout has been one of my major frustrations with LaTeX (I'm referring to LaTeX's weird box system, I'm not sure exactly what the proper terminology for it is). --

Re: Check for dict key existence, and modify it in one step.

2007-08-28 Thread Evan Klitzke
CountingDictionary(dict): def increment(self, key, delta=1): self[key] = self.get(key, 0) + delta Hope this helps! -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Will Python 3.0 remove the global interpreter lock (GIL)

2007-09-02 Thread Evan Klitzke
;re running at about half the speed of CPython, and have a preliminary JIT that can translate certain integer operations into assembly, and will be expanded upon in future releases. If you're looking for a progressive alternative to CPython, I'd keep an eye on that project ;-) -- Evan Kl

Re: Why 'class spam(object)' instead of class spam(Object)' ?

2007-09-06 Thread Evan Klitzke
gt; Type 'type'? What is that supposed to mean? I'm not 100% sure how new style classes work, but my understanding is that while normally we refer to objects as instances of classes, classes are really instances of type objects! Types are treated specially (IIRC, types are

Re: 2 daemons write to a single file /w python file IO

2007-09-11 Thread Evan Klitzke
esses with the file descriptor open and writable at once. > I also wonder if one side locked the file, what happens if the other side > try to open this locked file? raise error? so i also need to write a loop to > wait for the file to release locking? The flock call will block if the file is already locked. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating HTML

2007-09-12 Thread Evan Klitzke
vy web application framework. See http://www.cheetahtemplate.org/ -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating HTML

2007-09-12 Thread Evan Klitzke
On Wed, 2007-09-12 at 09:54 +0200, Bruno Desthuilliers wrote: > Evan Klitzke a écrit : > > It's not applicable for everything, but if you're planning on using > > Python to generate web pages you should really be using Cheetah > > templates. Very simple to use te

Re: can Python be useful as functional?

2007-09-17 Thread Evan Klitzke
Haskell!), but I wouldn't try to write functional code in Python -- the language isn't optimized for this type of code, and the syntax it provides isn't very elegant, compared to other functional languages. If you want to write functional code, use a real functional language! -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: super() doesn't get superclass

2007-09-17 Thread Evan Klitzke
ss methods by passing in self (i.e. the old-style way of doing it), and in fact using super is far more flexible. There's no way to magically know when to call the superclass' method, and even if you knew when, there's no way to magically know when it needs to be called. If you're using multiple inheritance, and you're _not_ using super everywhere, then your code is broken anyway. Use super correctly in your own code, and you don't need to worry about other people using it incorrectly. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Preemption in python

2007-09-23 Thread Evan Klitzke
itch threads every 100 bytecode instructions (http://docs.python.org/api/threads.html). Note that if you are synchronizing around a lock, you may need to sleep before trying to reacquire the the lock to completely exit the critical section. A good overview of this (and the Python threading m

Re: comparing elements of a list with a string

2007-09-25 Thread Evan Klitzke
're using the string.find method to search for the file, I'd replace it with "if file in element", which is a bit more idiomatic. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: python project ideas

2007-10-25 Thread Evan Klitzke
age is sent out. You'd probably write this as an extension to Mako/Cheetah (and possibly extend something like mod_python/mod_wsgi, don't know whether these support chunked output or not), but you could also write your own templating engine for this. -- Evan Klitzke <[EMAIL PROTE

Re: modifying __class__

2007-10-26 Thread Evan Klitzke
s inherit from the metaclass rather than object, but I don't really have any experience doing this. -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

marshal vs pickle

2007-10-30 Thread Evan Klitzke
hat enough? -- Evan Klitzke <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list