Re: PEP 359: The "make" Statement

2006-04-14 Thread Steven Bethard
Duncan Booth wrote: > Steven Bethard wrote: > >> Should users of the make statement be able to determine in which dict >> object the code is executed? The make statement could look for a >> ``__make_dict__`` attribute and call it to allow things like:: >> >> make Element html: >> ma

Re: Loop with float increments (frange)?

2006-04-14 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hi! > > what's the standard way for a "for" loop with float increments? AFAIK there is no, but you should be easily able to write an frange yourself: def frange(from, to, step): while from < to: yield from from += step for x in frange(10.5, 23.4, 0

Re: nested functions

2006-04-14 Thread Fredrik Lundh
Thomas Bartkus wrote: > I, for one, am so glad to have nested functions again ;-) again ? Python has always supported nested functions. it's the scoping rules that have changed; before the change from LGB to LEGB, you had to explictly import objects from outer scopes. -- http://mail.pytho

Re: Loop with float increments (frange)?

2006-04-14 Thread Dan Sommers
On 14 Apr 2006 06:11:38 -0700, [EMAIL PROTECTED] wrote: > what's the standard way for a "for" loop with float increments? Use a while loop instead: f = initial_value while f <= final_value: process(f) f = f + increment Note that there is no general guarantee that f will

Re: nested functions

2006-04-14 Thread Thomas Bartkus
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > hi > just curious , if i have a code like this? > > def a(): > def b(): > print "b" > def c(): > print "c" > > how can i call c() ?? Your function 'a' is it's own little world where functions 'b' and 'c' exist. Your code ins

zlib && zip files

2006-04-14 Thread Jan Prochazka
Hi, I need to decompress zip archive. I wrote a parser of zip file, i obtain the compressed data, but when i call zlib.decompress(data) on them, it throws this error: decbuf = decompressor.decompress(compressed_data) error: Error -3 while decompressing: unknown compression method I try to compr

zlib and zip files

2006-04-14 Thread Jan Prochazka
Hi, I need to decompress zip archive. I wrote a parser of zip file, i obtain the compressed data, but when i call zlib.decompress(data) on them, it throws this error: decbuf = decompressor.decompress(compressed_data) error: Error -3 while decompressing: unknown compression method I try to compre

Re: nested functions

2006-04-14 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > just curious , if i have a code like this? > > def a(): > def b(): > print "b" > def c(): > print "c" > > how can i call c() ?? in the same way as you'd access the variable "c" in this example: def a(): c = 10 (that is, by calling the function

Re: telnet read_sb_data

2006-04-14 Thread Grant Edwards
On 2006-04-14, Arne <[EMAIL PROTECTED]> wrote: > Yes I have read the documentation. But I am not sure what is > the SB/SE suboption. Is this a suboption on the remote machine > or for Python. Maybe you could be so kind and explain it to me > with a little code example. SB/SE are used for telnet p

Re: Upgrading and modules

2006-04-14 Thread BartlebyScrivener
Are you saying you're on Windows? If so, try: http://www.activestate.com/Products/ActivePython/ It's a one-click, msi install with everything you need for win32, including IDE etc. Only thing to watch for is that sometimes the msi file won't install from a logical drive other than c:\. So if yo

Re: %g not the same as %e or %f

2006-04-14 Thread Fredrik Lundh
Kent Johnson wrote: > According to the docs, %g formatting is "Same as "e" if exponent is > greater than -4 or less than precision, "f" otherwise." So I would > expect that for any num, '%g'%num == '%e'%num or '%g'%num == '%f'%num. > But this is not the case in fact: > > Python 2.4.3 (#69, Mar 29

Discover Medieval Romania /Vlad the Impaler/Dracula/ /www.medievaltours.ro

2006-04-14 Thread Medieval Tours
http://www.medievaltours.ro/en/about.php";>http://www.medievaltours.ro/en/about.php";>http://www.medievalart.ro/img/img-cavaler.gif"; border="0" height="155" width="92">Discover Medieval Romaniahttp://www.medievalart.ro/img/logo-medieval.gif"; height="139" width="99">http://www.medievaltours.ro/

Re: Why new Python 2.5 feature "class C()" return old-style class ?

2006-04-14 Thread Christophe
Aahz a écrit : > In article <[EMAIL PROTECTED]>, > Felipe Almeida Lessa <[EMAIL PROTECTED]> wrote: > >>Em Ter, 2006-04-11 Ã s 07:17 -0700, Aahz escreveu: >> >>>Can, yes. But should it? The whole point of adding the () option to >>>classes was to ease the learning process for newbies who don't >

Re: best way to install python modules on linux

2006-04-14 Thread Fabian Braennstroem
Hi Harry, * Harry George <[EMAIL PROTECTED]> wrote: > Fabian Braennstroem <[EMAIL PROTECTED]> writes: > >> Hi, >> >> I am pretty new to python and will use it mainly in >> combination with scientific packages. I am running ubuntu >> breezy right now and see that some packages are out of date. >>

Re: Kross - Start of a Unified Scripting Approach

2006-04-14 Thread Jerry
Awesome, thanks for the explaination. It was very informative. -- http://mail.python.org/mailman/listinfo/python-list

Loop with float increments (frange)?

2006-04-14 Thread forum
Hi! what's the standard way for a "for" loop with float increments? Anton -- http://mail.python.org/mailman/listinfo/python-list

Searching and MySQL module stuff

2006-04-14 Thread broz
Thx for the help in finding the search page for this mailing list!! BartlebyScrivener pointed me to the right place. >From there http://groups.google.com/group/comp.lang.python , I found what I needed I also discovered I can load mysql-python on my mac fairly easily, if I use Darwin Ports. http:

IMPORTANT 2.5 API changes for C Extension Modules and Embedders

2006-04-14 Thread Neal Norwitz
If you don't write or otherwise maintain Python Extension Modules written in C (or C++) or embed Python in your application, you can stop reading. Python 2.5 alpha 1 was released April 5, 2006. The second alpha should be released in a few weeks. There are several changes which can cause C extens

Re: List of all syntactic sugar?

2006-04-14 Thread Diez B. Roggisch
> That kind of depends on what you mean by syntactic sugar. For instance, I > wouldn't call any of your examples syntactic sugar. AFAIK that is exactly what syntactic sugar means. Apart from non-strictness, all syntax can be expressed by function application. Even foo.bar() is nothing but bar

Re: requestion regarding regular expression

2006-04-14 Thread Kent Johnson
Kelie wrote: > Hello, > > I'm trying to analyze some autolisp code with python. In the file to > be analyzed there are many functions. Each function begins with a > "defun" statement. And before that, there may or may not have comment > line(s), which begins with ";". My goal is to export each

Re: list.clear() missing?!?

2006-04-14 Thread Ben C
On 2006-04-14, Sergei Organov <[EMAIL PROTECTED]> wrote: > Dennis Lee Bieber <[EMAIL PROTECTED]> writes: >> It always means bind... But if the LHS is a mutable object, AND you >> have specified a component of that object, it is the component that is >> being rebound... >> >> lst[:] = []

Re: GdkColor : the phantom class ?

2006-04-14 Thread Thomas Girod
I found an answer : color = gtk.gdk.Color() and then use color for fg et bg -- http://mail.python.org/mailman/listinfo/python-list

Re: nested functions

2006-04-14 Thread Szabolcs Berecz
On 14 Apr 2006 04:37:54 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > def a(): > def b(): > print "b" > def c(): > print "c" > > how can i call c() ?? Function c() is not meant to be called from outside function a(). That's what a nested function is for: localizing it's usage a

Re: nested functions

2006-04-14 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > hi > just curious , if i have a code like this? > > def a(): > def b(): > print "b" > def c(): > print "c" > > how can i call c() ?? c is a name in the local scope of a(). You can call c from within a, where the name is in scope, or you can return c or in

Re: Kross - Start of a Unified Scripting Approach

2006-04-14 Thread has
Jerry wrote: > Kind of like AppleScript then? Same fundamental goal, i.e. language-independent application scripting. They seem to have a similar sort of approach to decoupling a scripting language from its host application (Kross::API::ScriptManager vs. the Open Scripting Architecture API) but a

%g not the same as %e or %f

2006-04-14 Thread Kent Johnson
According to the docs, %g formatting is "Same as "e" if exponent is greater than -4 or less than precision, "f" otherwise." So I would expect that for any num, '%g'%num == '%e'%num or '%g'%num == '%f'%num. But this is not the case in fact: Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 b

Re: telnet read_sb_data

2006-04-14 Thread Arne
Thank you for your reply. Yes I have read the documentation. But I am not sure what is the SB/SE suboption. Is this a suboption on the remote machine or for Python. Maybe you could be so kind and explain it to me with a little code example. Thany you very much! Arne "Dennis Lee Bieber" <[EMAIL

GdkColor : the phantom class ?

2006-04-14 Thread Thomas Girod
Hi. No matter how I try, I just can't find this GdkColor class. I'm trying to convert some data into a pixmap in order to display it. Here is my code : import pygtk pygtk.require('2.0') import gtk xbm = """#define dump_width 4 #define dump_height 4 static unsigned char dump_bits[] = { 0xaa, 0x6c,

nested functions

2006-04-14 Thread micklee74
hi just curious , if i have a code like this? def a(): def b(): print "b" def c(): print "c" how can i call c() ?? -- http://mail.python.org/mailman/listinfo/python-list

Re: List of all syntactic sugar?

2006-04-14 Thread Bas
>That kind of depends on what you mean by syntactic sugar. Mightbe I was misusing the name of syntactic sugar, but I what I intended to say was "all the possible 'transformations' that can be made to reduce all the 'advanced' syntax to some sort of minimal core of the language". Bas -- http://m

Future Warning with Negative Int

2006-04-14 Thread brianlum
Hi, If I try to print a negative integer as a hexadecimal, I get the following error: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up For example: >>> print "%X" % -1 __main__:1: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in

Re: A problem with exec statement

2006-04-14 Thread TPJ
> > So when you exec 'a = "B"' in globals(), locals() you might think you > were changing the local namespace. In fact you are changing a copy of > the local namespace: > Well, that explains much, but not all that I want to be explained. Why? Because now I understand, that by invoking exec "a =

Re: List of all syntactic sugar?

2006-04-14 Thread Steven D'Aprano
On Fri, 14 Apr 2006 02:54:11 -0700, Bas wrote: > Hi group, > > just out of curiosity, is there a list of all the syntactic sugar that > is used in python? If there isn't such a list, could it be put on a > wiki somewhere? The bit of sugar that I do know have helped me a lot in > understanding the

Re: List of all syntactic sugar?

2006-04-14 Thread Rene Pijlman
Bas: >just out of curiosity, is there a list of all the syntactic sugar that >is used in python? http://docs.python.org/ref/specialnames.html -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: sending email with charset utf-8 but subject is not coded properly

2006-04-14 Thread Rene Pijlman
Grzegorz ¦lusarek: >I sending email using standard python modules smtplib, email, >coding email in utf but subject of message is not coded properly. In >subject i use my national characters (polish) and after send i get XX in >place these characters. >Here is the code > >Message = email.message_

Re: Remove Whitespace

2006-04-14 Thread Roel Schroeven
Fredrik Lundh schreef: > John Machin wrote: > >>> $ python2.4 -mtimeit -s "str = 'D c a V e r \" = d w o r d : 0 0 0 0 0 6 >>> 4 0'" 'str.replace(" ", "")' >> Oi! The OP mentioned "whitespace" ... > > yeah. but as is obvious from his examples, he really means "UTF-16", not > whitespace. Yes, tha

Re: A problem with exec statement

2006-04-14 Thread TPJ
> Use the exec statement without the in-clause to get the desired effect: > > >>> def f(): > ... a = "a" > ... exec "a = 'B'" > ... print a > ... > >>> f() > B > Well... I *do* realize that. But this is *not* my problem. I have a function with another nested one. If I used "exec ..."

List of all syntactic sugar?

2006-04-14 Thread Bas
Hi group, just out of curiosity, is there a list of all the syntactic sugar that is used in python? If there isn't such a list, could it be put on a wiki somewhere? The bit of sugar that I do know have helped me a lot in understanding the inner workings of python. To give a few examples (might no

Re: create pixmap from data

2006-04-14 Thread Eric Deveaud
Thomas Girod wrote: > Hi there. > > I have a list containing integer values from 0 to 255. With this list I > have informations width and height, as width * height = len(my_list) > > What I want to do is to convert this array into a pixmap of dimension > width * height in order to draw it in

sending email with charset utf-8 but subject is not coded properly

2006-04-14 Thread Grzegorz Ślusarek
Hi all. I sending email using standard python modules smtplib, email, coding email in utf but subject of message is not coded properly. In subject i use my national characters (polish) and after send i get XX in place these characters. Here is the code Message = email.message_from_string(pMessa

Re: namespace issue

2006-04-14 Thread Daniel Nogradi
> def _gn(x): > return x.upper() > > great_name = _gn > > class myclass: > def mymethod(self, great_name=False): > if great_name: > return _gn('something') > else: > return 'something' > >>> def great_name(x): > ... return x.upper() > ... > >>

Re: whitespace again

2006-04-14 Thread Fredrik Lundh
"david brochu jr" wrote: > still having problemsi have the following in a txt file: > > Windows Registry Editor Version 5.00 if this is a regedit export, the data is encoded as UTF-16. treating that as plain ASCII doesn't really work. > for line in new_line.readlines(): > line = re.sub('"'

Re: Remove Whitespace

2006-04-14 Thread Fredrik Lundh
John Machin wrote: > > $ python2.4 -mtimeit -s "str = 'D c a V e r \" = d w o r d : 0 0 0 0 0 6 > > 4 0'" 'str.replace(" ", "")' > > Oi! The OP mentioned "whitespace" ... yeah. but as is obvious from his examples, he really means "UTF-16", not whitespace. -- http://mail.python.org/mailman/l

Upgrading and modules

2006-04-14 Thread Brian Elmegaard
Hi, Every time I upgrade python I also have to download all packages and reinstall them. http://www.voidspace.org.uk/python/articles/upgrading_python.html tells me that this is only a problem on windows for some reasons that have to do with binary distributions, compiling and more. This leads m

requestion regarding regular expression

2006-04-14 Thread Kelie
Hello, I'm trying to analyze some autolisp code with python. In the file to be analyzed there are many functions. Each function begins with a "defun" statement. And before that, there may or may not have comment line(s), which begins with ";". My goal is to export each function into separate f

__getattribute__ and __slots__

2006-04-14 Thread pascal . parent
Hi, I try to define a (new-style) class who: - have a __slots__ defined to be strict attributes, - return None if the attribute is 'ok' but not set, or raise a 'normal' error if the attribute isn't in __slots__. This code runs, but is it the good way? Thanks. class test(object): __slots__ =

Re: Python editing with emacs/wordstar key bindings.

2006-04-14 Thread Sergei Organov
"BartlebyScrivener" <[EMAIL PROTECTED]> writes: > Yes, but for some reason, I get more and better help here with Python > than on xemacs. Or maybe I've just had bad luck. Something like the > following just leaves me scratching my head. I'm on Windows XP and > never compiled anything that I know

create pixmap from data

2006-04-14 Thread Thomas Girod
Hi there. I have a list containing integer values from 0 to 255. With this list I have informations width and height, as width * height = len(my_list) What I want to do is to convert this array into a pixmap of dimension width * height in order to draw it inside a pygtk GUI. Any suggestions abou

Re: list.clear() missing?!?

2006-04-14 Thread Sergei Organov
Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > On Fri, 14 Apr 2006 09:17:05 +0400, Sergei Organov <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> >> I, as a newcomer, don't have much trouble understanding the binding vs >> the assignment by themselves. What does somewhat

Re: reading files in small chunks?

2006-04-14 Thread Amit Khemka
On 4/14/06, Rajesh Sathyamoorthy <[EMAIL PROTECTED]> wrote: > Hi, > > I wanted to know why it is more efficient to read a file in smaller chunks ( > using file() or open() )? If this is not done, will this lead to errors in > the data read or just results in slower performance? > > Thank You. It

Re: reading files in small chunks?

2006-04-14 Thread Rajesh Sathyamoorthy
Hi,Could I have some links? It would be very helpful.Thank You.On 4/14/06, Felipe Almeida Lessa wrote: Em Sex, 2006-04-14 às 13:45 +0800, Rajesh Sathyamoorthy escreveu:> I wanted to know why it is more efficient to read a file in smaller> chunks ( using file() or open() )?It's more efficient in som

Re: PEP 359: The "make" Statement

2006-04-14 Thread Duncan Booth
Steven Bethard wrote: > Should users of the make statement be able to determine in which dict > object the code is executed? The make statement could look for a > ``__make_dict__`` attribute and call it to allow things like:: > > make Element html: > make Element body: >

Pattern_Recognition_School+Conf_2006:Deadline

2006-04-14 Thread heather
PATTERN RECOGNITION EVENTS THIS SUMMER, 2006 ___ 4TH INTERNATIONAL SUMMER SCHOOL ON PATTERN RECOGNITION (ISSPR, 2006), 23-28 JULY, UK WWW.PatternRecognitionSchool.com The 4th International Summer School on Pattern Recognition will be organised at the University of Plymouth, UK

whitespace again

2006-04-14 Thread david brochu jr
hello again,   still having problemsi have the following in a txt file:   Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\software\compete\dca]"UserId"="92005851""PanelId"="mayflower""PanelName"="Consumer Input Toolbar""CaptureType"=dword:0002 "CapTypOvr"=dword:0001"ExePath"="

Re: PEP 359: The "make" Statement

2006-04-14 Thread Steven Bethard
Nicolas Fleury wrote: > Steven Bethard wrote: >> Ok, I finally have a PEP number. Here's the most updated version of >> the "make" statement PEP. I'll be posting it shortly to python-dev. >> >> Thanks again for the previous discussion and suggestions! > > I find it very interesting. > > My onl

Re: A problem with exec statement

2006-04-14 Thread Steve Holden
TPJ wrote: > I have the following code: > > --- > def f(): > > def g(): > a = 'a' # marked line 1 > exec 'a = "b"' in globals(), locals() > print "g: a =", a > > a = 'A' # marked line 2 > exec 'a = "B"' in globals(), loc

Re: A problem with exec statement

2006-04-14 Thread Peter Otten
TPJ wrote: > I have the following code: > > --- > def f(): > >   def g(): > a = 'a' # marked line 1 > exec 'a = "b"' in globals(), locals() > print "g: a =", a > >   a = 'A'   # marked line 2 >   exec 'a = "B"' in globals(), lo

[廣告]徵人~兼職工作全職收入(可在家工作)

2006-04-14 Thread
Part-time job Full-time income 美商高科技生化公司加州百大企業來台拓展亞太市場 誠徵兼職人員,每日2~3小時,月入1萬~3萬 http://www.moonnini.com/w/nica/ 上面為在家工作系統網站 若對在家工作有興趣者可去索取電子書 -- 夫兵者不祥之器物或惡之故有道者不處君子居則貴左用兵則貴右兵者不祥之器非君子 之器不得已而用之恬淡為上勝而不美而美之者是樂殺人夫樂殺人者則不可得志於天下 矣吉事尚左凶事尚右偏將軍居左上將軍居右言以喪禮處之殺人之眾以哀悲泣之戰勝以

<    1   2