Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Dan Bishop
[EMAIL PROTECTED] wrote: > What languages besides Python use the Python slicing convention? Java uses it for the "substring" method of strings. > In C starting at > 0 may be justified because of the connection between array subscripting > and pointer arithmetic, but Python is a higher-level lang

regarding main function

2005-04-21 Thread praba kar
Dear All, I want to know the difference between calling a function directly and through main function compose() if __name__ == __main__: compose() Yahoo! India Matrimony: Find your life partner online Go to: htt

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Antoon Pardon
Op 2005-04-20, Peter Hansen schreef <[EMAIL PROTECTED]>: > Terry Hancock wrote: >> However, I used to make "off by one" errors all the time in both C and >> Fortran, >> whereas I hardly ever make them in Python. > > This should probably be the overriding concern in this > case. > > I can't remembe

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Antoon Pardon
Op 2005-04-20, Terry Hancock schreef <[EMAIL PROTECTED]>: > On Wednesday 20 April 2005 07:52 am, Antoon Pardon wrote: >> Personnaly I would like to have the choice. Sometimes I prefer to >> start at 0, sometimes at 1 and other times at -13 or +7. > > Although I would classify that as a "rare use ca

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Raymond Hettinger
[Antoon Pardon] > I don't see why the start index can't be accessible through > a method or function just like the length of a list is now. > > My favourite would be a range method so we would have > the following idiom: > > for i in lst.range(): > do something with lst[i] After going to all

Re: regarding main function

2005-04-21 Thread [EMAIL PROTECTED]
if you run in the same file there is no difference. Block under "__main__" will be executed if you run that file only but if you import that file from another file, then if you don't put your code inside "__main__" your code it will be executed (this is not what you want). Example: You have 1 fi

Re: PyObject_New not running tp_new for iterators?

2005-04-21 Thread Gregory Bond
I wrote: [snip] > What am I missing? The fundamental problem is that this: if (!(ro = PyObject_New(MyIter, &MyIterType))) return NULL; is really only a malloc() - it doesn't call the tp_new function at all. This is not really clear in the 2.3 version of the C API document that I was con

deprecation of has_key?

2005-04-21 Thread nicksjacobson
I haven't heard of any plans to deprecate the dictionary has_key method, as the "in" keyword makes it obsolete. i.e. if key in dict: instead of if dict.has_key(): Is there some reason to keep has_key? --Nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Antoon Pardon
Op 2005-04-20, Terry Hancock schreef <[EMAIL PROTECTED]>: > On Wednesday 20 April 2005 12:28 pm, Roy Smith wrote: >> Terry Hancock wrote: >> >> I used to make "off by one" errors all the time in both C and Fortran, >> >> whereas I hardly ever make them in Python. >> >> Part of the reason may be t

Re: Lex

2005-04-21 Thread jozo
I NEED HELP!!! -- http://mail.python.org/mailman/listinfo/python-list

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Ron
[EMAIL PROTECTED] wrote: Many people I know ask why Python does slicing the way it does. Can anyone /please/ give me a good defense/justification??? I'm referring to why mystring[:4] gives me elements 0, 1, 2 and 3 but *NOT* mystring[4] (5th element). Many people don't like idea that 5th elemen

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Paul Rubin
Antoon Pardon <[EMAIL PROTECTED]> writes: > I sometimes think python should have been more explicite here, > using a marker for the start-index and end-index, may '^' and > '$'. So if you wanted the last element you had to write: > > lst[$] > > And for the next to last element: > > lst[$ - 1

python LEX

2005-04-21 Thread jozo
I have to work on python lexical definition in Lex. I spent lots of my time to find regular expresions written for Lex of Python language but nothing. Can somebody help me? I nEED hELP -- http://mail.python.org/mailman/listinfo/python-list

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Antoon Pardon
Op 2005-04-21, Raymond Hettinger schreef <[EMAIL PROTECTED]>: > [Antoon Pardon] >> I don't see why the start index can't be accessible through >> a method or function just like the length of a list is now. >> >> My favourite would be a range method so we would have >> the following idiom: >> >> f

Re: (Python newbie) Using XP-SP2/MSVC6: No Python24_d.lib, winzip barfs on Python-2.4.1.tar, cannot download bzip2

2005-04-21 Thread Bill Davy
Hi Scott, Nice idea. Tried that but no more information about where the file was (not) found (see below). But many thanks for a useful flag. I did not see them in the documentation. What should I be lkooking for? [StopPres: Ah ha -h why did I not think of that?] Bill # installing zipimport ho

Re: building a small calculator

2005-04-21 Thread Steve Holden
[EMAIL PROTECTED] wrote: Thats great info. Thanks. I guess I would know about this if I read through all the manuals, but I'm awefull at reading that kind of stuff. I'll just have to plow through it somehow. Take your time. Feel free to ask questions. Simon Brunning recommended the tutor list - th

Re: python LEX

2005-04-21 Thread Tim Daneliuk
jozo wrote: I have to work on python lexical definition in Lex. I spent lots of my time to find regular expresions written for Lex of Python language but nothing. Can somebody help me? I nEED hELP http://systems.cs.uchicago.edu/ply/ --

Re: inner sublist positions ?

2005-04-21 Thread tiissa
Bernard A. wrote: > maybe have you some better / faster ideas / implementations ? or even > a more pythonic to help me learning that You may want to look at string matches algorithm (a good review: [1]). In particular there are classics like Boyer-Moore and some involving minimal automatons simila

Re: python LEX

2005-04-21 Thread Tim Daneliuk
Tim Daneliuk wrote: jozo wrote: I have to work on python lexical definition in Lex. I spent lots of my time to find regular expresions written for Lex of Python language but nothing. Can somebody help me? I nEED hELP http://systems.cs.uchicago.edu/ply/ Whoops - I did not read your question carefull

Can an object of a C type have random members added? tp_dictoffset?

2005-04-21 Thread Gregory Bond
One of the cool things about Python is the ability to "decorate" objects with random extra members: class C: def __init__(self): self.foo = 0 c = C() c.bar = 1 I have a class implemented in C using tp_members to specify (read-only) access to data members in the C struct. I'd like to be a

Re: goto statement

2005-04-21 Thread Maxim Kasimov
1. comment for debug It can be used in the same way, as the comments for debugging are used, but it will be easier than to use """ or ''', or using features of text-editors, when it is necessary to comment piece of code which already contains ''' or/and """ strings already, or there is anot

Re: Using Jython in Ant Build Process

2005-04-21 Thread Simon Brunning
On 4/21/05, Maurice LING <[EMAIL PROTECTED]> wrote: > I am looking for a way to use Jython in Ant build process. I have some > pure Python scripts (not using any C extensions) that I'll like to > incorporate into Java using Jython. I heard that this can be done but > you can I set up Ant to do this

Re: goto statement

2005-04-21 Thread Tim Daneliuk
Reinhold Birkenfeld wrote: John Bokma wrote: Mage wrote: praba kar wrote: Dear All, In Python what is equivalent to goto statement You shouldn't use goto in high-level languages. Nonsense +1 Thank you! Above all your claim is well justified. These brilliant arguments you have put forth really

Re: pyGTK on Mouse over event ?

2005-04-21 Thread [EMAIL PROTECTED]
the POINTER MOTION MASK doesn't do the trick either. This is the first time i'm using python and pyGTK and it's really sad to see that a simple mouseover is hard to program. :s -- http://mail.python.org/mailman/listinfo/python-list

Re: Enumerating formatting strings

2005-04-21 Thread Steve Holden
Michael Spencer wrote: Andrew Dalke wrote: I see you assume that only \w+ can fit inside of a %() in a format string. The actual Python code allows anything up to the balanced closed parens. Gah! I guess that torpedoes the regexp approach, then. Thanks for looking at this Michael While Andrew may

Re: ANN: Python 2.3.2 for PalmOS available

2005-04-21 Thread Fraca7
On Tue, 19 Apr 2005 08:03:15 -0700, Lucio Torre wrote: > Do you have any experience on PODS? The whole thing is based on > Codewarrior and Codewarrior for palm is dead. Nope. Actually, I'm kind of reluctant to use IDEs and it seems PODS is targeted towards Eclipse users; I'd rather use prc-tools

Re: deprecation of has_key?

2005-04-21 Thread Steve Holden
[EMAIL PROTECTED] wrote: I haven't heard of any plans to deprecate the dictionary has_key method, as the "in" keyword makes it obsolete. i.e. if key in dict: instead of if dict.has_key(): Is there some reason to keep has_key? Two words: backward compatibility. To lose that method now would break t

Re: Python instances

2005-04-21 Thread Bengt Richter
On Wed, 20 Apr 2005 08:33:48 -0400, Kent Johnson <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] wrote: >> Guess i shouldn't think of the __init__(self) function as a constructor >> then. > >No, that's not it. You shouldn't think of variables defined outside of a >method as instance variables. > >I

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Raymond Hettinger
> > [Antoon Pardon] > >> I don't see why the start index can't be accessible through > >> a method or function just like the length of a list is now. > >> > >> My favourite would be a range method so we would have > >> the following idiom: > >> > >> for i in lst.range(): > >> do something wit

Dictionary question.

2005-04-21 Thread hawkesed
Hi, I am semi new to Python. Here is my problem : I have a list of 100 random integers. I want to be able to construct a histogram out of the data. So I want to know how many 70's, 71's, etc. I can't figure out how to do this. A dictionary is supposedly can do key value pairs right? I want to be

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Antoon Pardon
Op 2005-04-21, Raymond Hettinger schreef <[EMAIL PROTECTED]>: >> > [Antoon Pardon] >> >> I don't see why the start index can't be accessible through >> >> a method or function just like the length of a list is now. >> >> >> >> My favourite would be a range method so we would have >> >> the followin

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Steve Holden
[EMAIL PROTECTED] wrote: Terry Hancock wrote: So I like Python's slicing because it "bites *less*" than intervals in C or Fortran. I disagree. Programming languages should not needlessly surprise people, and a newbie to Python probably expects that x[1:3] = [x[1],x[2],x[3]] . Array-oriented langua

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Reinhold Birkenfeld
Antoon Pardon wrote: > I sometimes think python should have been more explicite here, > using a marker for the start-index and end-index, may '^' and > '$'. So if you wanted the last element you had to write: > > lst[$] > > And for the next to last element: > > lst[$ - 1] > > > This would

Re: goto statement

2005-04-21 Thread Reinhold Birkenfeld
Maxim Kasimov wrote: >1) goto exempts from necessity to install new software > (it is critical for remote working, for example, installing X11 may be > impossible at all) Attributing the need for a language feature to restrictions of your ambience is hilarious. Reinhold -- http://mail.pytho

Re: Dictionary question.

2005-04-21 Thread Simon Brunning
On 21 Apr 2005 02:47:42 -0700, hawkesed <[EMAIL PROTECTED]> wrote: > I am semi new to Python. Here is my problem : I have a list of 100 > random integers. I want to be able to construct a histogram out of the > data. So I want to know how many 70's, 71's, etc. I can't figure out > how to do this.

Re: Dictionary question.

2005-04-21 Thread Steve Holden
Simon Brunning wrote: On 21 Apr 2005 02:47:42 -0700, hawkesed <[EMAIL PROTECTED]> wrote: I am semi new to Python. Here is my problem : I have a list of 100 random integers. I want to be able to construct a histogram out of the data. So I want to know how many 70's, 71's, etc. I can't figure out ho

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Antoon Pardon
Op 2005-04-21, Reinhold Birkenfeld schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: > >> I sometimes think python should have been more explicite here, >> using a marker for the start-index and end-index, may '^' and >> '$'. So if you wanted the last element you had to write: >> >> lst[$] >>

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Antoon Pardon
Op 2005-04-21, Steve Holden schreef <[EMAIL PROTECTED]>: > [EMAIL PROTECTED] wrote: >> Terry Hancock wrote: >> >> >> >>>So I like Python's slicing because it "bites *less*" than intervals >> >> in C or Fortran. >> >> I disagree. Programming languages should not needlessly surprise >> people, a

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Reinhold Birkenfeld
Antoon Pardon wrote: > Op 2005-04-21, Reinhold Birkenfeld schreef <[EMAIL PROTECTED]>: >> Antoon Pardon wrote: >> >>> I sometimes think python should have been more explicite here, >>> using a marker for the start-index and end-index, may '^' and >>> '$'. So if you wanted the last element you had t

Re: python LEX

2005-04-21 Thread Miki Tebeka
Hello jozo, > I have to work on python lexical definition in Lex. I spent lots of my > time to find regular expresions written for Lex of Python language but > nothing. > Can somebody help me? http://www.antlr.org/grammar/list (search for Python) You can search in projects like Pyrex and Parrot f

Re: memory profiler?

2005-04-21 Thread Diez B. Roggisch
Peter Hansen wrote: > John Reese wrote: >> Is there a memory or heap profiler for python programs? So that, for >> example, if a program was bloating over time I could see how many of >> each object there were and maybe even where the references were? > > The "gc" module has a variety of helpful

Re: deprecation of has_key?

2005-04-21 Thread Steve Holden
Luis Bruno wrote: Hello, Steve Holden wrote: Two words: backward compatibility. To lose that method now would break thousands of existing programs. The 2.4 library would probably experience breakage too ... let's see: $ find /lib/python2.4/ -name "*.py" -exec grep has_key {} \; | wc -l 587 Is t

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Antoon Pardon
Op 2005-04-21, Reinhold Birkenfeld schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: >> Op 2005-04-21, Reinhold Birkenfeld schreef <[EMAIL PROTECTED]>: >>> Antoon Pardon wrote: >>> I sometimes think python should have been more explicite here, using a marker for the start-index and end-

Re: goto statement

2005-04-21 Thread Sergei Organov
Maxim Kasimov <[EMAIL PROTECTED]> writes: > 1. comment for debug > > It can be used in the same way, as the comments for debugging are > used, but it will be easier than to use """ or ''', or using > features of text-editors, when it is necessary to comment piece of > code which a

Python & Mayavi Problem

2005-04-21 Thread Alexej Goehring
Hi,   I read your Mayavi question from about a year ago, because I have exactly the same problem. I believe it has to do with windows, because I have seen it work under Linux. Did anyone reply to your query and if so, do you know why the screen goes red?   I attached your email so that

Re: goto statement

2005-04-21 Thread Sergei Organov
Tim Daneliuk <[EMAIL PROTECTED]> writes: [...] > Some HLLs almost have to have it by definition. I cut my teeth as programmer > writing for embedded realtime systems in a HLL (PL/M). While you could, > in theory, completely avoid 'goto' in a realtime environment, it would > make all manner of p

Re: Lex

2005-04-21 Thread Diez B. Roggisch
jozo wrote: > I NEED HELP!!! Shouting won't give you help. Reading this http://www.catb.org/~esr/faqs/smart-questions.html and coming back with a more elaborate question might. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: Define Constants

2005-04-21 Thread codecraig
Thanks for the input. i am renaming my module to be customthing. I noticed that is how many python modules are, so I will stick to the "convention". Thanks for the help. -- http://mail.python.org/mailman/listinfo/python-list

Design advice for unit test asserters

2005-04-21 Thread Gary
I'm working on a project where I'm doing various file manipulations. I'm not familiar with the idioms are common or good for this situation, so I'd appreciate advice and suggestions. Question 1: A number of checks apply to a set of files. So I'm wondering whether to have something like: de

Re: Python instances

2005-04-21 Thread Kent Johnson
Bengt Richter wrote: The following shows nothing static anywhere, yet a class has been defined, an instance created, and __init__ called with initial value, and the value retrieved as an attribute of the returned instance, and it's all an expression. >>> type('C', (), {'__init__': lambda self,v

Re: goto statement

2005-04-21 Thread Diez B. Roggisch
> implement. BTW, all modern systems come complete with 'goto' implemented > in *hardware* - they're called "interrupts". That's not goto - that is a asynchronous function call - much closer related to multithreading. In an interrupt, you can always jump back to the main program using rte (return

Re: goto statement

2005-04-21 Thread Maxim Kasimov
Sergei Organov wrote: Maxim Kasimov <[EMAIL PROTECTED]> writes: 1. comment for debug It can be used in the same way, as the comments for debugging are used, but it will be easier than to use """ or ''', or using features of text-editors, when it is necessary to comment piece of code wh

Re: Using Jython in Ant Build Process

2005-04-21 Thread Kent Johnson
Maurice LING wrote: I am looking for a way to use Jython in Ant build process. I have some pure Python scripts (not using any C extensions) that I'll like to incorporate into Java using Jython. I heard that this can be done but you can I set up Ant to do this? Sorry, I'm no expert with Ant. The

freeze and expat

2005-04-21 Thread Operation Latte Thunder
I am playing around with jabberpy, and on a lark decided to try to freeze one of the included samples, test_client.py The freeze/build worked fine, but when I attempted to run the resulting binary, I got an error hinting that it couldn't find parsers.expat: canal:/home/chris/build% ./test_client

Re: (Python newbie) Using XP-SP2/MSVC6: No Python24_d.lib, winzip barfs on Python-2.4.1.tar, cannot download bzip2

2005-04-21 Thread Jaime Wyant
If you're really desperate, write a python script that changes -> #include "python.h" to #ifdef _DEBUG #undef _DEBUG #include "python.h" #define _DEBUG #else #include "python.h" #endif Then run the script each time you generate a new wrapper file and everything ought to be OK. jw On 4/20/

Re: Design advice for unit test asserters

2005-04-21 Thread Kent Johnson
Gary wrote: I'm working on a project where I'm doing various file manipulations. I'm not familiar with the idioms are common or good for this situation, so I'd appreciate advice and suggestions. Question 1: A number of checks apply to a set of files. So I'm wondering whether to have something lik

Re: XML parsing per record

2005-04-21 Thread Willem Ligtenberg
I'll first try it using SAX, because I want to have as little dependancies as possible. I already have BioPython as a dependancy. And I personally don't like to install lot's of packages for a program to work. So I don't want to impose that on other people. But thanks anyway and I might go for the

Re: Define Constants

2005-04-21 Thread beliavsky
A "recipe" for "Constants in Python" by Alex Martelli is at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65207 . -- http://mail.python.org/mailman/listinfo/python-list

recording data between [ and ]

2005-04-21 Thread rbt
Output from 'netstat -b' on a win2003 server will show what binary is responsible for the connection. For example, it may list something like this along with other connection specific data: [lsass.exe] [System] [firefox.exe] [iexplorer.exe] How might I process the output so that anything within

Private class?

2005-04-21 Thread codecraig
Hi, First, I come from a Java background. Ok, so I have this idea that I want to create an EventBus...basically a central class where objects can register themselves as listeners for different events. This central class also has methods so that objects can fire events. Something like this...

Re: XML parsing per record

2005-04-21 Thread Willem Ligtenberg
Sorry I just decided that I want to use your solution, but I am wondering is cElemenTree in expat or is that something different? On Wed, 20 Apr 2005 08:03:00 -0400, Kent Johnson wrote: > Willem Ligtenberg wrote: >>>Willem Ligtenberg <[EMAIL PROTECTED]> wrote: >>> I want to parse a very large

Strings

2005-04-21 Thread Dan
I've having trouble coming to grip with Python strings. I need to send binary data over a socket. I'm taking the data from a database. When I extract it, non-printable characters come out as a backslash followed by a three numeric characters representing the numeric value of the data. I guess t

Re: Private class?

2005-04-21 Thread PA
On Apr 21, 2005, at 15:13, codecraig wrote: ...so that is what I am thinking. However, i guess my issue is how to make EventBus a singleton or prevent it from being instaniated and making it's methods statically accessible. Not directly related to your question, but... you may want to take a loo

Re: XML parsing per record

2005-04-21 Thread Simon Brunning
On 4/21/05, Willem Ligtenberg <[EMAIL PROTECTED]> wrote: > Sorry I just decided that I want to use your solution, but I am wondering > is cElemenTree in expat or is that something different? Nope, cElemenTree is very much its own man. See . -- Cheers, Si

Re: XML parsing per record

2005-04-21 Thread Paul McGuire
Don't assume that just because you have a 2.4G XML file that you have 2.4G of data. Looking at these verbose tags, plus the fact that the XML is pretty-printed (all those leading spaces - not even tabs! - add up), I'm guessing you only have about 5-10% actual data, and the rest is just XML tagging

__del__ and reference count problem

2005-04-21 Thread flupke
Hi, i'm starting work and a simple database layer and wanted to use the __del__ to open and close a connection. However, i get an erro when executing this script: class Table: refcount = 0 def __init__(self, name): self.name = name print "table %s " % repr(self) T

Re: goto statement

2005-04-21 Thread Grant Edwards
On 2005-04-21, Sergei Organov <[EMAIL PROTECTED]> wrote: > Well, I'm writing for embedded realtime systems in C/C++ and > have never encountered a single need to use goto. I have encountered situations in C programs where the best thing to use was a goto. Those situations have always been handle

python classes/file structure

2005-04-21 Thread codecraig
What is the best/common way to structure ur python code for an application? For example...if I create some custom GUI widgets I have this C:\stuff --> gui --: MyCustomWidget.py --: TestWidgets.py so MyCustomWidget.py has one class, class MyCustomWidget: ... so from TestWidgets.p

Re: Strings

2005-04-21 Thread keirr
I'd use the int and chr casts. e.g., new_string = "" a = '012' new_string += chr(int(a)) Just in case the 012 is an octal code I'll mention that to cast to int in general you can pass the base, as in int('034',8) or int('AF',16) Cheers, Keir. -- http://mail.python.org/mailman/listinfo/pytho

Re: goto statement

2005-04-21 Thread Michael Soulier
On 4/20/05, Maxim Kasimov <[EMAIL PROTECTED]> wrote: > > but what if i just can't to do this becouse i'm working thrue ssh, and have > to use > only installed editors (such as vi) Then learn to use vi. :.,+10s/^/# " comment the next 10 lines Mike -- Michael P. Soulier <[EMAIL PROTECTED]> h

Regular Expressions - Python vs Perl

2005-04-21 Thread codecraig
Hi, I am interested in regular expressions and how Perl and Python compare. Particulary, I am interested in performance (i.e. speed), memory usage, flexibility, completeness (i.e. supports simple and complex regex operations...basically is RegEx a strong module/library in Python?) Anyone have

Re: recording data between [ and ]

2005-04-21 Thread Peter Hansen
rbt wrote: Output from 'netstat -b' on a win2003 server will show what binary is responsible for the connection. For example, it may list something like this along with other connection specific data: [lsass.exe] [System] [firefox.exe] [iexplorer.exe] How might I process the output so that anyth

Re: goto statement

2005-04-21 Thread John Bokma
Do Re Mi chel La Si Do wrote: > +1 I am modded up :-D -- John MexIT: http://johnbokma.com/mexit/ personal page: http://johnbokma.com/ Experienced programmer available: http://castleamber.com/ Happy Customers:

Re: goto statement

2005-04-21 Thread John Bokma
Reinhold Birkenfeld wrote: > John Bokma wrote: >> Mage wrote: >> >>> praba kar wrote: >>> Dear All, In Python what is equivalent to goto statement >>> You shouldn't use goto in high-level languages. >> >> Nonsense > > Thank you! > > Above all your claim is wel

Re: Strings

2005-04-21 Thread Peter Hansen
Dan wrote: I've having trouble coming to grip with Python strings. I need to send binary data over a socket. I'm taking the data from a database. When I extract it, non-printable characters come out as a backslash followed by a three numeric characters representing the numeric value of the data.

Re: goto statement

2005-04-21 Thread Mage
Michael Soulier wrote: >On 4/20/05, Maxim Kasimov <[EMAIL PROTECTED]> wrote: > > >>but what if i just can't to do this becouse i'm working thrue ssh, and have >>to use >>only installed editors (such as vi) >> >> > >Then learn to use vi. > >:.,+10s/^/# >" comment the next 10 lines > > Or

Re: recording data between [ and ]

2005-04-21 Thread rbt
Peter Hansen wrote: rbt wrote: Output from 'netstat -b' on a win2003 server will show what binary is responsible for the connection. For example, it may list something like this along with other connection specific data: [lsass.exe] [System] [firefox.exe] [iexplorer.exe] How might I process the

Re: Private class?

2005-04-21 Thread Brian van den Broek
codecraig said unto the world upon 2005-04-21 09:13: Hi, First, I come from a Java background. ...so that is what I am thinking. However, i guess my issue is how to make EventBus a singleton or prevent it from being instaniated and making it's methods statically accessible. thanks. I don't come

Re: deprecation of has_key?

2005-04-21 Thread Denis S. Otkidach
On Thu, 21 Apr 2005 05:43:36 -0400 Steve Holden wrote: SH> Two words: backward compatibility. To lose that method now would SH> break thousands of existing programs. [...] SH> The method might disappear in Python 3.0, when we will be allowed to SH> break backward compatibility - you are correct in

Is there a package with convolution and related methods?

2005-04-21 Thread Charles Krug
List: Is there a Python package with Convolution and related methods? I'm working on modeling some DSP processes in Python. I've rolled one up, but don't feel much like reinventing the wheel, especially if there's already something like "Insanely Efficient FFT for Python" already. Thanks Char

How can I verify that a passed argument is an interible collection?

2005-04-21 Thread Charles Krug
List: I'm working on some methods that operate on (mathematical) vectors as in: def Convolution(x, y) """Returns a list containing the convolution of vectors x and y""" Is there any way to determine at runtime that x and y are iterible collections? Do I *coughs* simply *coughs* trap the excepti

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Rocco Moretti
Steve Holden wrote: The principle of least surprise is all very well, but "needless surprise of newbies" is a dangerous criterion to adopt for programming language design and following it consistently would lead to a mess like Visual Basic, which grew by accretion until Microsoft realized it was

Re: deprecation of has_key?

2005-04-21 Thread Steven Bethard
Denis S. Otkidach wrote: I believe it's a bad idea to remove this method, since behavior of both "item in dict" and "for item in dict" (especially the later) in Python does't seem sane to me. Just look at reverse operations: dict.fromkeys(seq) <-> d.keys(), d.iterkeys() - OK dict(iterable) <-> d.i

Re: Private class?

2005-04-21 Thread Kent Johnson
codecraig wrote: class EventListener: def eventOccurred(self, eventType): pass The EventListener class is not needed in Python; you can include it for its documentation value if you like but Python does not require interfaces the way Java does. class EventBus: EVENT_GROW_LEAVES = 0 __

Re: goto statement

2005-04-21 Thread Sergei Organov
Maxim Kasimov <[EMAIL PROTECTED]> writes: > Sergei Organov wrote: > > Maxim Kasimov <[EMAIL PROTECTED]> writes: > > > > >>1. comment for debug > >> > >>It can be used in the same way, as the comments for debugging are used, > >>but it will be easier than to use """ or ''', or using features of

Re: goto statement

2005-04-21 Thread Sergei Organov
Grant Edwards <[EMAIL PROTECTED]> writes: > On 2005-04-21, Sergei Organov <[EMAIL PROTECTED]> wrote: > > > Well, I'm writing for embedded realtime systems in C/C++ and > > have never encountered a single need to use goto. > > I have encountered situations in C programs where the best > thing to

Re: How can I verify that a passed argument is an interible collection?

2005-04-21 Thread Fredrik Lundh
Charles Krug wrote: I'm working on some methods that operate on (mathematical) vectors as in: def Convolution(x, y) """Returns a list containing the convolution of vectors x and y""" Is there any way to determine at runtime that x and y are iterible collections? Do I *coughs* simply *coughs* trap t

Re: How can I verify that a passed argument is an interible collection?

2005-04-21 Thread Larry Bates
Others may know better ways but the 2 I know of are: 1) If you know that the arguments will be lists or tuples you can use isinstance(). if not isinsance(arg, (list, tuple): print "arg must be list or tuple) 2) Or if you not you could see if the argument has next and __iter__ methods (more g

Re: deprecation of has_key?

2005-04-21 Thread Denis S. Otkidach
On Thu, 21 Apr 2005 08:50:25 -0600 Steven Bethard wrote: SB> Huh? I'm not following your logic. Why is "item in dict" less SB> readable than "dict.has_key(item)"? Something to do with expecting SB> inverses that don't exist? SB> SB> Personally, I use "item in dict" because it's quite readable

Re: How can I verify that a passed argument is an interible collection?

2005-04-21 Thread Roy Smith
Charles Krug <[EMAIL PROTECTED]> wrote: > Do I *coughs* simply *coughs* trap the exception created by: > >for v in x: > >when v is a scaler quantity? Sure. Why not? If you're coming from a type-bondage language like C++ or Java, it probabliy feels strange, but it's the Python way. It looks

Re: goto statement

2005-04-21 Thread Grant Edwards
On 2005-04-21, Sergei Organov <[EMAIL PROTECTED]> wrote: > Grant Edwards <[EMAIL PROTECTED]> writes: > >> On 2005-04-21, Sergei Organov <[EMAIL PROTECTED]> wrote: >> >> > Well, I'm writing for embedded realtime systems in C/C++ and >> > have never encountered a single need to use goto. >> >> I ha

Re: recording data between [ and ]

2005-04-21 Thread Diez B. Roggisch
> Yes, it does... may take me a few minutes to get my head around it > though. Why do re's have to be so arcane and complicated... especially > in Python? > > It's hard to preach 'ease of use' with stuff such as this in the > language. Perhaps one day it can be rolled up into something that > *rea

Re: How can I verify that a passed argument is an interible collection?

2005-04-21 Thread Diez B. Roggisch
Charles Krug wrote: > List: > > I'm working on some methods that operate on (mathematical) vectors as > in: > > def Convolution(x, y) > """Returns a list containing the convolution of vectors x and y""" > > Is there any way to determine at runtime that x and y are iterible > collections? > > D

Re: How can I verify that a passed argument is an interible collection?

2005-04-21 Thread Steven Bethard
Charles Krug wrote: List: I'm working on some methods that operate on (mathematical) vectors as in: def Convolution(x, y) """Returns a list containing the convolution of vectors x and y""" Is there any way to determine at runtime that x and y are iterible collections? Do I *coughs* simply *coughs*

Re: deprecation of has_key?

2005-04-21 Thread Steven Bethard
Denis S. Otkidach wrote: On Thu, 21 Apr 2005 08:50:25 -0600 Steven Bethard wrote: SB> Huh? I'm not following your logic. Why is "item in dict" less SB> readable than "dict.has_key(item)"? Something to do with expecting SB> inverses that don't exist? SB> SB> Personally, I use "item in dict" beca

A smallish Tkinter question

2005-04-21 Thread mediocre_person
""" What I want: A little window to open with a 0 in it. Every second, the 0 should increment by 1. What I get: A one second delay, see the window with a 1 in it, and then nothing appears to happen. Never see the 0, never see a 2. Any quick clues? Thanks. Nick. (Python 2.4, Win98). """ from Tkint

Re: Meine geilen Bilder

2005-04-21 Thread Ariane
Hi, hier sind meine geilen Bilder! My nude Pics!!! http://www.geile-tipps.info/go/ -- Posted by News Bulk Poster Unregistered version -- http://mail.python.org/mailman/listinfo/python-list

Re: Can an object of a C type have random members added? tp_dictoffset?

2005-04-21 Thread Denis S. Otkidach
On Thu, 21 Apr 2005 17:55:24 +1000 Gregory Bond wrote: GB> I have a class implemented in C using tp_members to specify (read-only) GB> access to data members in the C struct. I'd like to be able to do the GB> decoration trick with objects of this class. Is this possible? GB> GB> [The documenta

Re: recording data between [ and ]

2005-04-21 Thread Fredrik Lundh
Diez B. Roggisch wrote: Welcome to the wonderful world of programming. Regular expressions are what they are because they are modeled after a certain theory - that of finite state automata and their correspondence to certain classes of grammars. (except that Python regexps are not always regular, o

Re: goto statement

2005-04-21 Thread Sergei Organov
Grant Edwards <[EMAIL PROTECTED]> writes: > On 2005-04-21, Sergei Organov <[EMAIL PROTECTED]> wrote: > > Grant Edwards <[EMAIL PROTECTED]> writes: > > > >> On 2005-04-21, Sergei Organov <[EMAIL PROTECTED]> wrote: > >> > >> > Well, I'm writing for embedded realtime systems in C/C++ and > >> > have

  1   2   3   >