Re: variable arguments question

2005-03-14 Thread Swaroop C H
--- vegetax <[EMAIL PROTECTED]> wrote: > how can i pass it to a generic function that takes variable > keywords as > arguments? same thing with variable arguments, i need to pass a > list of > arguments to the function > > def asd(**kw): print kw > def efg(*arg): print arg > > asd(d) > doesnt wo

variable arguments question

2005-03-14 Thread vegetax
if i have a dictionary: d = {'a':2,'b':3 } l = (1,2) how can i pass it to a generic function that takes variable keywords as arguments? same thing with variable arguments, i need to pass a list of arguments to the function def asd(**kw): print kw def efg(*arg): print arg asd(d) doesnt work asd

Re: __getitem__ method on (meta)classes

2005-03-14 Thread Steven Bethard
Ron Garret wrote: And the code I ended up with is: # Inheriting from type, not object, is the key: class enum_metaclass(type): def __getitem__(self, index): return self.vals[index] def enum(vals): class enum(object): __metaclass__ = enum_metaclass def __init__(self, val): try:

Re: __getitem__ method on (meta)classes

2005-03-14 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Ron Garret <[EMAIL PROTECTED]> wrote: Wow, this is really cool: > What I'm really trying to do is to create enumerated types... And the code I ended up with is: # Inheriting from type, not object, is the key: class enum_metaclass(type): def __getitem__(self, i

Re: __getitem__ method on (meta)classes

2005-03-14 Thread Bengt Richter
On Mon, 14 Mar 2005 22:00:38 -0800, Ron Garret <[EMAIL PROTECTED]> wrote: >In article <[EMAIL PROTECTED]>, > Leif K-Brooks <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: >> > Why doesn't this work? >> > >> > >> def foo(lst): >> > >> > ... class baz(object): >> > ... def __ge

Re: __getitem__ method on (meta)classes

2005-03-14 Thread Steven Bethard
Ron Garret wrote: What I'm really trying to do is to create enumerated types such that if: e1 = enum(lst) and v = e1(x) then (x in lst) and (e1[v] == x) Use a class with __call__ and __getitem__: py> class enum(object): ... def __init__(self, vals): ... self.vals = vals ... def __ca

Re: a program to delete duplicate files

2005-03-14 Thread David Eppstein
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (John J. Lee) wrote: > > If you read them in parallel, it's _at most_ m (m is the worst case > > here), not 2(m-1). In my tests, it has always significantly less than > > m. > > Hmm, Patrick's right, David, isn't he? Yes, I was only considering

Re: __getitem__ method on (meta)classes

2005-03-14 Thread Ron Garret
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Bengt Richter) wrote: > On 14 Mar 2005 17:43:53 -0800, [EMAIL PROTECTED] wrote: > > > > >Why doesn't this work? > > > def foo(lst): > >... class baz(object): > >... def __getitem__(cls, idx): return cls.lst[idx] > >... __getitem__

Re: __getitem__ method on (meta)classes

2005-03-14 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Leif K-Brooks <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Why doesn't this work? > > > > > def foo(lst): > > > > ... class baz(object): > > ... def __getitem__(cls, idx): return cls.lst[idx] > > ... __getitem__=classmethod(__getitem__

Re: Turning String into Numerical Equation

2005-03-14 Thread Michael Spencer
Giovanni Bajo wrote: Michael Spencer wrote: * this means that, eval("sys.exit()") will likely stop your interpreter, and there are various other inputs with possibly harmful consequences. Concerns like these may send you back to your original idea of doing your own expression parsing. I use somet

Re: How can I load a module when I will only know the name 'on the fly'

2005-03-14 Thread renwei
use built-in function: __import__ m = __import__('sys', globals()) print m.platform weir "Tobiah" <[EMAIL PROTECTED]> > > > m = get_next_module() > > some_nice_function_somehow_loads( m ) > > Thanks, > > Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: Web framework

2005-03-14 Thread Benji York
Joe wrote: On 13 Mar 2005 01:13:00 -0800, [EMAIL PROTECTED] wrote: You should definitely have a look at Zope 3. There is good documentation available and it can do a lot of good stuff. But then, the thing I hate about Zope, is that source code is not accessible with normal development tools since

RuntimeError: restricted attribute

2005-03-14 Thread Steven Bethard
Does anyone know where the documentation for "restricted environments" is? I see this referred to in the documentation for eval[1], but not explained. Does eval use rexec? I thought that was deprecated, but I get the following error: py> eval('sub.func_globals', dict(__builtins__=None, ...

RotatingFileHandler and logging config file

2005-03-14 Thread Rob Cranfill
Hello, I've successfully coded Python to do what I want with a RotatingFileHandler, but am having trouble getting the same behavior via a config file. I wanted to create one log file each time I run my app, with up to 10 files kept from the last invocations. This was accomplished with self._

Wing IDE 2.0.2 Released

2005-03-14 Thread Stephan Deibel
Hi, I'm happy to announce the release of Wing IDE 2.0.2. This is a free upgrade for Wing IDE 2.0 users. The release can be downloaded from: http://wingware.com/downloads Wing IDE provides powerful debugging, editing, code intelligence, and search capabilities that reduce development and debugg

Re: __getitem__ method on (meta)classes

2005-03-14 Thread Michele Simionato
Leif Brooks: >with new-style classes, x[y] and type(x).__getitem__(y) are >synonymous. Yes, but check the discussion around SF789262. The call ``x[y]`` is converted to ``type(x).__getitem__(x,y)`` *only if* ``__getitem__`` is explicitely defined in ``type(x)``. If ``type(x)`` does not define ``__

Re: super with only one argument

2005-03-14 Thread Michele Simionato
No, you should use the version with two arguments for that. The second argument would be a class however, not an instance. Example: class C(object): @staticmethod def f(): print "C.f" class D(C): @staticmethod def f(): print "D.f" super(D, D).f() D.f() Ju

Re: Python info

2005-03-14 Thread Swaroop C H
--- Dave Zhu <[EMAIL PROTECTED]> wrote: > I would like to have a broad knowledge on Python. > Basically, I would like to know Python is designed, > how parsing, compilation, and interpretation take > place, how memory management works, how the Python > interpreter performs compared to others, etc.

Re: yum repository

2005-03-14 Thread Swaroop C H
--- "Donald L. Dietmeyer" <[EMAIL PROTECTED]> wrote: > What yum repository do you use to pick up > python rpms? Search for 'Yum' at: http://www.python.org/2.4/rpms.html Cheers, Swaroop C H Blog: http://www.swaroopch.info Book: http://www.byteofpython.info -- http://mail.python.org/mailman/listi

Re: __getitem__ method on (meta)classes

2005-03-14 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: Why doesn't this work? def foo(lst): ... class baz(object): ... def __getitem__(cls, idx): return cls.lst[idx] ... __getitem__=classmethod(__getitem__) ... baz.lst = lst ... return baz ... I thought x[y] and x.__getitem__(y) were supposed to always be synonym

Re: __getitem__ method on (meta)classes

2005-03-14 Thread Bengt Richter
On 14 Mar 2005 17:43:53 -0800, [EMAIL PROTECTED] wrote: > >Why doesn't this work? > def foo(lst): >... class baz(object): >... def __getitem__(cls, idx): return cls.lst[idx] >... __getitem__=classmethod(__getitem__) >... baz.lst = lst >... return baz >... f = foo([1,2,3]) >

Re: decorating classes with metaclass

2005-03-14 Thread Simon Percivall
Class decoration was discussed back when (you can search for the thread in python-dev); not as an alias to metaclasses but discussed as having exactly the same semantics as function decoration. Maybe the idea has more merit as being another way of setting the __metaclass__ attribute; on the other h

distutils setup ignoring scripts

2005-03-14 Thread Jack Orenstein
I'm using Python 2.2 on RH9. I have a set of Python modules organized into a root package and one other package named foobar. setup.py looks like this: from distutils.core import setup setup( name = 'foobar', version = '0.3', description = 'Foo Bar', author =

Re: Python info

2005-03-14 Thread Simon Percivall
Well, the source code is pretty well documented if you want to get to know the implementation. Read the "Extending and Embedding" tutorial and the "Python/C API" reference, then start digging through the code. Performance comparisons are broadly available, and always suspect. -- http://mail.pyth

Re: __getitem__ method on (meta)classes

2005-03-14 Thread Simon Percivall
Well, they're not synonymous. At least not in that context. If you haven't already tried it, what you're doing will fail for instances as well. Look in typeobject.c to see why. The gist of it is that the special methods are looked up on the type rather than the instance (on the metaclass rather tha

Re: getting data with proper encoding to the finish

2005-03-14 Thread John Machin
Serge Orlov wrote: > Looking at the following function in pyXLWriter > def _asc2ucs(s): > """Convert ascii string to unicode.""" > return "\x00".join(s) + "\x00" > > I can guess several things: > a) pyXLWriter author is an ascii guy :) Shrewd guess :-) > b) unicode strings are not suppor

__getitem__ method on (meta)classes

2005-03-14 Thread ron
Why doesn't this work? >>> def foo(lst): ... class baz(object): ... def __getitem__(cls, idx): return cls.lst[idx] ... __getitem__=classmethod(__getitem__) ... baz.lst = lst ... return baz ... >>> f = foo([1,2,3]) >>> f[0] Traceback (most recent call last): File "", line 1, in ? T

Re: super with only one argument

2005-03-14 Thread John Roth
"Michele Simionato" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I asked myself the same question and I am not convinced that using 'super' with one argument really makes sense (i.e. IMO it is more a liability than an asset). BTW, I have a set of notes on the tricky aspects of 'supe

Re: getting data with proper encoding to the finish

2005-03-14 Thread Serge Orlov
John Machin wrote: > Ksenia Marasanova wrote: >> Sorry, I meant: I use field of the type 'text' in a Postgres table to >> store my data. The data is a XML string. >> >>> Instead of "print data", do "print repr(data)" and show us what you >>> get. What *you* see on the screen is not much use for dia

Re: How can I load a module when I will only know the name 'on the fly'

2005-03-14 Thread Jeff Shannon
Tobiah wrote: m = get_next_module() some_nice_function_somehow_loads( m ) that'd be mymodule = __import__('modulename') Jeff Shannon -- http://mail.python.org/mailman/listinfo/python-list

Re: a program to delete duplicate files

2005-03-14 Thread Jeff Shannon
Patrick Useldinger wrote: David Eppstein wrote: When I've been talking about hashes, I've been assuming very strong cryptographic hashes, good enough that you can trust equal results to really be equal without having to verify by a comparison. I am not an expert in this field. All I know is that

Re: is there a problem on this simple code

2005-03-14 Thread John Machin
jrlen balane wrote: > @sir John > could you please show me how to do this exactly? it's in the "tip of > my toungue" but i just can get it, please... > You've had far too much help already for a school project. Asking for someone to write the code for you is "over the fence". -- http://mail.pyt

Re: Python becoming less Lisp-like

2005-03-14 Thread Valentino Volonghi aka Dialtone
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > It is actually. Ruby's syntax is mostly consistent and coherent, and > there is much less special cases than in Python. I'd be glad to know which special cases are you referring to. Please note that you wrote "much less" which means there are prob

How can I load a module when I will only know the name 'on the fly'

2005-03-14 Thread Tobiah
m = get_next_module() some_nice_function_somehow_loads( m ) Thanks, Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: getting data with proper encoding to the finish

2005-03-14 Thread John Machin
Ksenia Marasanova wrote: > Sorry, I meant: I use field of the type 'text' in a Postgres table to > store my data. The data is a XML string. > > > Instead of "print data", do "print repr(data)" and show us what you > > get. What *you* see on the screen is not much use for diagnosis; it's > > the va

Re: urllib (and urllib2) read all data from page on open()?

2005-03-14 Thread Jeff Shannon
Alex Stapleton wrote: Whilst it might be able to do what I want I feel this to be a flaw in urllib that should be fixed, or at least added to a buglist somewhere so I can at least pretend someone other than me cares. I'm not sure about this being a flaw. The point of urllib and urllib2 is to prov

Re: Turning String into Numerical Equation

2005-03-14 Thread Giovanni Bajo
Michael Spencer wrote: > * this means that, eval("sys.exit()") will likely stop your > interpreter, and > there are various other inputs with possibly harmful consequences. > > Concerns like these may send you back to your original idea of doing > your own expression parsing. I use something alon

Re: will it cause any problems to open a read-only file & not close it?

2005-03-14 Thread Jeff Shannon
Daniel Dittmar wrote: Fuzzyman wrote: Sara Khalatbari wrote: Will it cause any problems if you open a file to read & never close it? Under CPython the filehandle will be automatically garbage collected. Under JPython (Jython) it won't be... Isn't it rather that CPython will close the file as soo

Re: wxNotebook on a wxPanel.. how?

2005-03-14 Thread phark52
The above code I pasted was not correct. I pasted an older version. The sizer.Add() line should of been sizer.Add(self.nb) -- omit the (self). but I fixed the problem. I had to change that same line to sizer.add(self.nb, 1, wxEXPAND|wxALL) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python becoming less Lisp-like

2005-03-14 Thread Ulrich Hobelmann
Torsten Bronger wrote: HallÃchen! Tach! Moreover, I dislike the fact that new features are implemented partly in the interpreter and partly in Python itself. It reminds me of TeX/LaTeX, where the enormous flexibility of TeX is used to let it change itself in order to become a LaTeX compiler. Howe

Re: will it cause any problems to open a read-only file & not close it?

2005-03-14 Thread Terry Reedy
"Sara Khalatbari" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In a code, I'm opening a file to read. Like : >lines = open(filename).readlines() > & I'm never closing it. > I'm not writing in that file, I just read it. Since you do not save a reference to the file object, i

Re: Python becoming less Lisp-like

2005-03-14 Thread Bruno Desthuilliers
news.sydney.pipenetworks.com a Ãcrit : I looked for a new language for my hobby programming. I used to use Turbo Pascal for 10 years and then C++ for 6 years. A couple of weeks ago, I narrowed my decision to C#, Ruby, and Python. At the moment, I want to go with Python, but you can definitely s

Re: Python-list Digest, Vol 18, Issue 208

2005-03-14 Thread Jeff Shannon
Steven Bethard wrote: Jeff Shannon wrote: now that almost the entire industry has standardized on power-of-2 word sizes, octal is nearly useless but is still carried about for backwards compatibility. So do you think it's worth lobbying for its removal in Python 3.0 when we can break some backwa

Python info

2005-03-14 Thread Dave Zhu
Hello All, I would like to have a broad knowledge on Python. Basically, I would like to know Python is designed, how parsing, compilation, and interpretation take place, how memory management works, how the Python interpreter performs compared to others, etc. I already looked at Python's documenta

Re: getting data with proper encoding to the finish

2005-03-14 Thread John Machin
Ksenia Marasanova wrote: > > > There is some amount of data in a database (PG) that must be inserted > > > into Excel sheet and emailed. Nothing special, everything works. > > > Except that non-ascii characters are not displayed properly. > > > The data is stored as XML into a text field. > > > >

Re: Web framework

2005-03-14 Thread Carlos Ribeiro
On Mon, 14 Mar 2005 21:36:36 GMT, Lee Harr <[EMAIL PROTECTED]> wrote: > That said, how about a ZODB storage class that sits > on top of an svn store? That might be killer! I don't know very much about the ZODB, having using it very little. What you say seems to be possible -- implement the ZODB 'p

how to make money for music

2005-03-14 Thread tryntohard
MAKE $6,000 TO $30,000 IN JUST A FEW WEEKS!!! LEARN HOW TO TURN $6 INTO $6000OR EVEN $6!! TURN SIX DOLLARS INTO $6000 EASY AND HONESTLY!!! READING THIS MESSAGE WILL CHANGE YOUR LIFE FOREVER : I found this on a bulletin board and decided to try it. A little : while back, I was browsing through n

Re: some information

2005-03-14 Thread Terry Reedy
"Sandeep Avinash Gohad" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >Hi,I want to know weather python conducts any certification exams like the > >other programming languages - >Microsoft (MCP,MCSD) >Sun (sun certification) Those are corporations, not languages. And no, the PS

wxNotebook on a wxPanel.. how?

2005-03-14 Thread phark52
I have a wxFrame. On it is a wxNotebook, the Notebook ctrl has 5 tabs (Each one is a wxPanel.) On one of the tab pages (panels) I want to add another notebook ctrl. I get no errors but nothing shows up on the panel.. why is that? If I add a button or checkbox to the sizer on that panel, it shows. A

Re: is there a problem on this simple code

2005-03-14 Thread jrlen balane
@sir John could you please show me how to do this exactly? it's in the "tip of my toungue" but i just can get it, please... On 14 Mar 2005 14:06:15 -0800, John Machin <[EMAIL PROTECTED]> wrote: > > jrlen balane wrote: > > why is it that here: > > > > 1)rx_data = ser.read(10) > > (rx_command,

Re: Tkinter Bitmap Newbie question

2005-03-14 Thread Neil Hodgson
Wim Goffin: > But just to make sure I'm on the right track, > - Is XBM the best way to for bitmaps? The ones I saw so far are all black > and white. Do they also exist in color? XPM is the version of XBM with colour. > - Is XBM also the best format for glyphs on the Windows platform? Or woul

Re: Second argument to super().

2005-03-14 Thread Steven Bethard
Steve Holden wrote: John Roth wrote: What happens with the second operand is a bit of sleight of hand. The object returned from super() gives you access to the methods on the next level up the mro, however when you use it to invoke a method, then the 'self' passed to that method is the second objec

Re: Building Python 2.4 with icc and processor-specific optimizations

2005-03-14 Thread Michael Hoffman
Martin v. Löwis wrote: OTOH, it could also be Python's failure to follow C's aliasing rules correctly; Python casts between C pointers which, in strict C, causes undefined behaviour. So if your compiler has something similar to GCC's -fno-strict-aliasing, you could see whether this helps. There's n

Re: getting data with proper encoding to the finish

2005-03-14 Thread Ksenia Marasanova
> > There is some amount of data in a database (PG) that must be inserted > > into Excel sheet and emailed. Nothing special, everything works. > > Except that non-ascii characters are not displayed properly. > > The data is stored as XML into a text field. > > This sentence doesn't make much sense

Re: Python becoming less Lisp-like

2005-03-14 Thread news.sydney.pipenetworks.com
I looked for a new language for my hobby programming. I used to use Turbo Pascal for 10 years and then C++ for 6 years. A couple of weeks ago, I narrowed my decision to C#, Ruby, and Python. At the moment, I want to go with Python, but you can definitely see that it's the oldest one: Many parts

Re: Python becoming less Lisp-like

2005-03-14 Thread Fernando
On Tue, 15 Mar 2005 00:01:09 +0100, Torsten Bronger <[EMAIL PROTECTED]> wrote: >> The new 'perlified' syntax for decorators, > >Python lost its innocence here: The first really special character, >disturbing the former syntax style. Not important, but irritating. > >> the new static type bonds >

decorating classes with metaclass

2005-03-14 Thread Bengt Richter
Just wondering whether anyone has discussed using decorator syntax to effect metaclass processing. E.g. @MC class Foo(object): pass would have the same effect as class Foo(object): __metaclass__ = MC pass ISTM fairly analogous to function decoration, just dif

Re: Python becoming less Lisp-like

2005-03-14 Thread Steven Bethard
Torsten Bronger wrote: the underlying constructs are utterly ugly, as are some of Python's features (e.g. __getattr__ and such, and decorators, in order to get nice class properties). What do you find ugly about __getattr__? I looked for a new language for my hobby programming. [snip] I want to go

Re: Python becoming less Lisp-like

2005-03-14 Thread Torsten Bronger
HallÃchen! Fernando <[EMAIL PROTECTED]> writes: > [...] > > [...] Python is going the C++ way: piling feature upon feature, > adding bells and whistles while ignoring or damaging its core > design. I'm new to Python, but I while I skimmed through the "What's new?" of recent versions, I saw the

Re: Python-list Digest, Vol 18, Issue 208

2005-03-14 Thread Steven Bethard
Jeff Shannon wrote: John Roth wrote: That's a reason, but I don't consider it a good reason. I cannot, in fact, think of a single time when I've wanted to enter an octal number. Hex numbers, yes, but not octal. [snip] I would agree with you, but it's there for historical reasons. [snip] now that a

Re: Python-list Digest, Vol 18, Issue 208

2005-03-14 Thread Bengt Richter
On Mon, 14 Mar 2005 14:12:40 -0800, Jeff Shannon <[EMAIL PROTECTED]> wrote: >John Roth wrote: > >> >> "Charles Hartman" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> I know this isnt that big of a problem, but i cannot think of one reason why they would not allow n

Re: command line args

2005-03-14 Thread Steven Bethard
[EMAIL PROTECTED] wrote: Hello, I have the following commands: testb -s testb -s -o testb -s -o How do i split the commands so that all three are valid. And how do i check for missing arguments? Use optparse. It's an improvement over the old getopt that makes writing option parsers easy:

Re: Tkinter Bitmap Newbie question

2005-03-14 Thread Wim Goffin
Thanks for all reactions. I can load the bitmap now thanks to your help. But just to make sure I'm on the right track, - Is XBM the best way to for bitmaps? The ones I saw so far are all black and white. Do they also exist in color? - Is XBM also the best format for glyphs on the Windows platform

Re: Can't seem to insert rows into a MySQL table

2005-03-14 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Anthra Norell wrote: > Try to use % instead of a comma (a Python quirk) and quotes around your > strings (a MySQL quirk): > >cursor.execute("INSERT INTO edict (kanji, kana, meaning) VALUES ('%s', > '%s', '%s')" % ("a", "b", "c") ) AFAIK grumfish made the Right Thingâ.

Re: Python becoming less Lisp-like

2005-03-14 Thread Fernando
On Sun, 13 Mar 2005 18:23:05 GMT, Peter Seibel <[EMAIL PROTECTED]> wrote: >Looks like the BDFL is planning to take lambda, reduce, filter, and >map out of Python in the next big rev of Python (so called Python >3000): > > Basically, it sa

Re: Regular Expressions: large amount of or's

2005-03-14 Thread Daniel Yoo
Scott David Daniels <[EMAIL PROTECTED]> wrote: : I have a (very high speed) modified Aho-Corasick machine that I sell. : The calling model that I found works well is: : def chases(self, sourcestream, ...): : '''A generator taking a generator of source blocks, : yielding (

RE: Conversion to string: how do `s work?

2005-03-14 Thread Delaney, Timothy C (Timothy)
Chris Lasher wrote: > I'm working my way through _Learning_Python_ 2nd ed., and I saw > something peculiar which is not explained anywhere in the text. > > print " " + file + " size=" + `size` > > The `s appear to somehow automagically convert the integer to a string > for concatenation. How doe

Re: Add Properties to Instances?

2005-03-14 Thread Bengt Richter
On 14 Mar 2005 13:07:29 -0800, "Martin Miller" <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote, in part: >> On 14 Mar 2005 01:19:23 -0800, "Martin Miller" ><[EMAIL PROTECTED]> >> wrote, in part: >> >What still puzzles me, though, is why all the above to make >properties >> >work on instances is ne

Re: Python-list Digest, Vol 18, Issue 208

2005-03-14 Thread Jeff Shannon
John Roth wrote: "Charles Hartman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I know this isnt that big of a problem, but i cannot think of one reason why they would not allow numbers preceded with a 0 to have a number higher then a 7 in them... And it seems very inconsistant to

Re: is there a problem on this simple code

2005-03-14 Thread John Machin
jrlen balane wrote: > why is it that here: > > 1)rx_data = ser.read(10) > (rx_command, rx_msg_no, rx_no_databyte, temp1, temp2, pyra1, > pyra2, voltage, current, rx_checksum) = unpack('10B', rx_data) > print rx_command, rx_msg_no, rx_no_databyte, temp1, temp2, pyra1, > pyra2, voltage, curr

Re: OS X and Tkinter

2005-03-14 Thread Piet van Oostrum
> Mike Tuller <[EMAIL PROTECTED]> (MT) wrote: >MT> I recently purchased a book to learn python, and am at a part where I want >MT> to start working with GUIs. I have an OS X system, and am using the >MT> default python installed on the system. I have installed Tcl/Tk Aqua from >MT> http://t

Re: Building Python 2.4 with icc and processor-specific optimizations

2005-03-14 Thread "Martin v. Löwis"
Michael Hoffman wrote: Further investigation reveals that the function that sets sys.builtin_module_names sorts the list before turning it into a tuple. And binarysort() in Objects/listobject.c doesn't work when optimized in that fashion. Adding #pragma optimize("", off) beforehand solves the probl

Re: urllib's functionality with urllib2

2005-03-14 Thread Monty
No, there is no reason. I think I can import both, but I can't download the file I want using urllib.retrieve. And urllib2 lack the retrieve method (as much as I know at least) which very easily allow you to get a feedback of the download (transfert rate and so on). That was my problem. It's OK now

Re: PythonWin

2005-03-14 Thread Larry Bates
[EMAIL PROTECTED] wrote: > I have a Python program that collects user input using > > msg = "Enter the full path and name of the file to be processed: " > answer = raw_input(msg) > > If I run it in IDLE, the question is splashed across the execution > window, and if it is long, simply wraps to th

Re: Can't seem to insert rows into a MySQL table

2005-03-14 Thread Anthra Norell
Try to use % instead of a comma (a Python quirk) and quotes around your strings (a MySQL quirk): cursor.execute("INSERT INTO edict (kanji, kana, meaning) VALUES ('%s', '%s', '%s')" % ("a", "b", "c") ) Frederic - Original Message - From: "grumfish" <[EMAIL PROTECTED]> Newsgroups: comp

Re: [Python-Dev] RELEASED Python 2.4.1, release candidate 1

2005-03-14 Thread "Martin v. Löwis"
Richie Hindle wrote: If so, could it also be that the installer has told you that the target directory exists, and asked whether you want to proceed anyway? It probably did, yes. If this was a true upgrade (allusers to allusers), it didn't ask the question. It only asks if it thinks this is a fre

Re: Web framework

2005-03-14 Thread Lee Harr
On 2005-03-14, Joe <[EMAIL PROTECTED]> wrote: > On Sun, 13 Mar 2005 19:20:34 +0100, "Diez B. Roggisch" ><[EMAIL PROTECTED]> wrote: >>Plain wrong. You can access them via FTP and WEBDAV. > > Not wrong. I am aware of this, but it's not like that many development > tools can work through FTP or WebDav

Re: a program to delete duplicate files

2005-03-14 Thread John J. Lee
Patrick Useldinger <[EMAIL PROTECTED]> writes: > David Eppstein wrote: > > > The hard part is verifying that the files that look like duplicates > > really are duplicates. To do so, for a group of m files that appear > > to be the same, requires 2(m-1) reads through the whole files if you > > us

Re: getting data with proper encoding to the finish

2005-03-14 Thread John Machin
Ksenia Marasanova wrote: > Hi, > > I have a little problem with encoding. Was hoping maybe anyone can > help me to solve it. > > There is some amount of data in a database (PG) that must be inserted > into Excel sheet and emailed. Nothing special, everything works. > Except that non-ascii characte

Re: OS X and Tkinter

2005-03-14 Thread Robert Kern
Robert Kern wrote: Mike Tuller wrote: I recently purchased a book to learn python, and am at a part where I want to start working with GUIs. I have an OS X system, and am using the default python installed on the system. I have installed Tcl/Tk Aqua from http://tcltkaqua.sourceforge.net/. Do

Re: OS X and Tkinter

2005-03-14 Thread Robert Kern
Mike Tuller wrote: I recently purchased a book to learn python, and am at a part where I want to start working with GUIs. I have an OS X system, and am using the default python installed on the system. I have installed Tcl/Tk Aqua from http://tcltkaqua.sourceforge.net/. Download and install h

Re: How do I pass structures using a C extension?

2005-03-14 Thread Thomas Heller
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Thanks for all the replies so far. I'm starting to look at SWIG, but > the libraries I want access to are all static. I created a small > interface file and a setup.py file, but when I build it, I get > undefined symbols. It sounds like the pack/

Re: urllib's functionality with urllib2

2005-03-14 Thread Monty
Thanks very much Fuzzy, It's help a lot. That's exactly what I was looking for. I didn't know much about those handle stuff and what to do with. The next hurdle for me will be to understand and manage multiple threads, and it's good to know that one can find such helpful advices here.( and maybe al

Re: Getting the process list on win98

2005-03-14 Thread Thomas Heller
Ron <[EMAIL PROTECTED]> writes: > I've written a screen saver which opens multiple copies on windows > 98. I'm trying to check the process list to determine if it is already > running. > > So far all the example win32 routines I've found, through google, only > work on newer xp and nt versions of

Re: command line args

2005-03-14 Thread Tim Daneliuk
[EMAIL PROTECTED] wrote: Hello, I have the following commands: testb -s testb -s -o testb -s -o How do i split the commands so that all three are valid. And how do i check for missing arguments? Thanks, -Joe Look into the getopt module. It vastly simplifies parsing command line arguments. F

Re: Add Properties to Instances?

2005-03-14 Thread Martin Miller
Bengt Richter wrote, in part: > On 14 Mar 2005 01:19:23 -0800, "Martin Miller" <[EMAIL PROTECTED]> > wrote, in part: > >What still puzzles me, though, is why all the above to make properties > >work on instances is necessary in the first place. It's certainly not > >clear (to me) from what is said

Re: Conversion to string: how do `s work?

2005-03-14 Thread Chris Lasher
Ah, repr. Did not cross my mind. Good to see my suspicions about the use of ` being poor practice were correct. "Explicit is better than implicit." Thanks for the reply. -- http://mail.python.org/mailman/listinfo/python-list

Re: Conversion to string: how do `s work?

2005-03-14 Thread Michael Hoffman
Chris Lasher wrote: The `s appear to somehow automagically convert the integer to a string for concatenation. How does this work? Is this just a shortcut for str(size)? No, it's a shortcut for repr(size). Is it considered bad practice to use `s? Yes, please don't do it. I can't remember ever seeing

command line args

2005-03-14 Thread [EMAIL PROTECTED]
Hello, I have the following commands: testb -s testb -s -o testb -s -o How do i split the commands so that all three are valid. And how do i check for missing arguments? Thanks, -Joe -- http://mail.python.org/mailman/listinfo/python-list

Re: Determining the length of strings in a list

2005-03-14 Thread Michael Spencer
[EMAIL PROTECTED] wrote: I have a dictionary. Each key contains a list. I am using the contents of the list to build a portion of a command line. However, before I can build the command line, I have to make sure that the command isn't too long. Depending on how you join the list items, you may ju

Re: Listbox fill=BOTH expand=YES (Tkinter)

2005-03-14 Thread Harlin Seritt
either YES, True, or 1 should work. -- http://mail.python.org/mailman/listinfo/python-list

OS X and Tkinter

2005-03-14 Thread Mike Tuller
I recently purchased a book to learn python, and am at a part where I want to start working with GUIs. I have an OS X system, and am using the default python installed on the system. I have installed Tcl/Tk Aqua from http://tcltkaqua.sourceforge.net/. When I run the file called gui.py that c

Re: a program to delete duplicate files

2005-03-14 Thread Bengt Richter
On Mon, 14 Mar 2005 10:43:23 -0800, David Eppstein <[EMAIL PROTECTED]> wrote: >In article <[EMAIL PROTECTED]>, > "John Machin" <[EMAIL PROTECTED]> wrote: > >> Just look at the efficiency of processing N files of the same size S, >> where they differ after d bytes: [If they don't differ, d = S] > >

Re: is there a problem on this simple code

2005-03-14 Thread jrlen balane
why is it that here: 1)rx_data = ser.read(10) (rx_command, rx_msg_no, rx_no_databyte, temp1, temp2, pyra1, pyra2, voltage, current, rx_checksum) = unpack('10B', rx_data) print rx_command, rx_msg_no, rx_no_databyte, temp1, temp2, pyra1, pyra2, voltage, current, rx_checksum >>> type (rx_co

Re: Beware complexity

2005-03-14 Thread Ron
Philip Smith wrote: I wonder if anyone has any thoughts not on where Python should go but where it should stop? My feelings on this is, it's a problem of organization and documentation. Do both of these well, and things will be manageable. I would like to see a bit cleaner file organization fra

yum repository

2005-03-14 Thread Donald L. Dietmeyer
What yum repository do you use to pick up python rpms? Don -- http://mail.python.org/mailman/listinfo/python-list

Conversion to string: how do `s work?

2005-03-14 Thread Chris Lasher
I'm working my way through _Learning_Python_ 2nd ed., and I saw something peculiar which is not explained anywhere in the text. print " " + file + " size=" + `size` The `s appear to somehow automagically convert the integer to a string for concatenation. How does this work? Is this just a shortcu

Re: (Newbie) Restricting inherited methods to operate on element from same subclass

2005-03-14 Thread andy2O
Bruno Desthuilliers wrote: > You've already got the technical answer. About a possible design flaw, > it would seem to me that restricting the join() operation on specific > subclasses breaks the LSP. OTOH, Python being dynamically typed, > inheritence is merely an implementation detail, so that m

Re: Listbox fill=BOTH expand=YES (Tkinter)

2005-03-14 Thread Harlin Seritt
That was it Martin. I forgot to expand the parent. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Listbox fill=BOTH expand=YES (Tkinter)

2005-03-14 Thread Raseliarison nirinA
"Martin Franklin" wrote: > Harlin Seritt wrote: > > I am trying the following: > > > > Listbox(parent).pack(fill=BOTH, expand=YES) > > > > I notice that the listbox will fill on the X axis but will not on > > the Y axis unlike other widgets. > > Is there any way to force this? > > > > thanks, > >

  1   2   >