Re: Token Error: EOF in multiline statement

2008-06-05 Thread Matimus
On Jun 5, 12:58 pm, maehhheeyy <[EMAIL PROTECTED]> wrote: > I'm not sure what it means but it always highlights the last line with > nothing on it. My program has 63 lines and it highlights the 64th > line. This keeps popping up whenever I try to run my program. Can you > please help me fix this?

Re: Question by someone coming from C...

2008-06-09 Thread Matimus
On Jun 9, 2:00 pm, Skye <[EMAIL PROTECTED]> wrote: > Writing this app in Python, not sure what the "best practice" would > be. > > I want a bitfield global logging level that allows me to turn specific > debugging modules on and off. If I was doing this in C, I'd just use > some globals like: > >

Re: can't assign to literal

2008-06-10 Thread Matimus
On Jun 10, 12:53 pm, maehhheeyy <[EMAIL PROTECTED]> wrote: > this is stopping my program from running properly. is there something > wrong in my code when that happens? yes Post your code, or at least the full error message if you want more details. Matt -- http://mail.python.org/mailman/listinf

Re: Simple and safe evaluator

2008-06-11 Thread Matimus
On Jun 11, 1:25 pm, bvdp <[EMAIL PROTECTED]> wrote: > Is there a simple/safe expression evaluator I can use in a python > program. I just want to pass along a string in the form "1 + 44 / 3" or > perhaps "1 + (-4.3*5)" and get a numeric result. > > I can do this with eval() but I really don't want

Re: Simple and safe evaluator

2008-06-11 Thread Matimus
On Jun 11, 4:38 pm, bvdp <[EMAIL PROTECTED]> wrote: > I'm finding my quest for a safe eval() quite frustrating :) > > Any comments on this: Just forget about getting python to do this and, > instead, grab my set of values (from a user supplied text file) and call > an external program like 'bc' to

Re: Simple and safe evaluator

2008-06-12 Thread Matimus
On Jun 11, 9:16 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jun 11, 8:15 pm, bvdp <[EMAIL PROTECTED]> wrote: > > > > > Matimus wrote: > > > > The solution I posted should work and is safe. It may not seem very > > > readable, but it i

Re: weird iteration/assignment problem

2008-06-13 Thread Matimus
On Jun 13, 8:07 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > cirfu schrieb: > > > for i in xrange(0, len(texts)): > > texts[i] = "yes" > > > for i in texts: > > i = "no" > > > why is the first one working but not the second. i mean i see why the > > firts one works but i dont udn

Re: Subclassing list, what special methods do this?

2008-06-13 Thread Matimus
On Jun 13, 11:38 am, Mike Kent <[EMAIL PROTECTED]> wrote: > For Python 2.5 and new-style classes, what special method is called > for mylist[2:4] = seq and for del mylist[2:4] (given that mylist is a > list, and seq is some sequence)? > > I'm trying to subclass list, and I'm having trouble determin

Re: Please explain Python "__whatever__" construct.

2008-06-16 Thread Matimus
When and why would I ever use > "__main__" or the many other "__whatever__" constructs? You don't generally use those names directly, they are 'magic'. The __add__ example is a good one. When you do `"hello " + "world"` behind the scenes python is actually calling "hello ".__add__("world"). There

Re: 2d graphics - drawing a vescica piscis in Python

2008-06-17 Thread Matimus
On Jun 17, 12:45 pm, Terrence Brannon <[EMAIL PROTECTED]> wrote: > Hello, I have written a program to draw a vescica piscis en.wikipedia.org/wiki/Vesica_piscis> > > from turtle import * > > def main(): >     setup(width=400, height=400) > >     r = 50 >     color("black") >     circle(r) >     col

Re: How to split a string containing nested commas-separated substrings

2008-06-18 Thread Matimus
On Jun 18, 10:19 am, Robert Dodier <[EMAIL PROTECTED]> wrote: > Hello, > > I'd like to split a string by commas, but only at the "top level" so > to speak. An element can be a comma-less substring, or a > quoted string, or a substring which looks like a function call. > If some element contains com

Re: How to split a string containing nested commas-separated substrings

2008-06-18 Thread Matimus
On Jun 18, 10:54 am, Matimus <[EMAIL PROTECTED]> wrote: > On Jun 18, 10:19 am, Robert Dodier <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > I'd like to split a string by commas, but only at the "top level" so > > to speak. An element

Re: PEP 372 -- Adding an ordered directory to collections

2008-06-18 Thread Matimus
On Jun 16, 1:37 am, Armin Ronacher <[EMAIL PROTECTED]> wrote: > Abstract > > > This PEP proposes an ordered dictionary as a new data structure for > the ``collections`` module, called "odict" in this PEP for short.  The > proposed API incorporates the experiences gained from working with >

Re: Noob: finding my way around the docs...

2008-06-19 Thread Matimus
On Jun 19, 2:06 pm, kj <[EMAIL PROTECTED]> wrote: > I'm a Python noob, and haven't yet figured out my way around the > Python documentation. > > For example, suppose I learn about some great module foo.bar.baz, > and when I run the python interpreter and type "import foo.bar.baz", > lo and behold,

Re: python/ruby question..

2008-06-19 Thread Matimus
On Jun 18, 8:33 pm, "bruce" <[EMAIL PROTECTED]> wrote: > hi... > > can someone point me to where/how i would go about calling a ruby app from a > python app, and having the python app being able to get a returned value > from the ruby script. > > something like > > test.py >  a = os.exec(testruby.r

Re: python/ruby question..

2008-06-19 Thread Matimus
On Jun 19, 4:00 pm, Matimus <[EMAIL PROTECTED]> wrote: > On Jun 18, 8:33 pm, "bruce" <[EMAIL PROTECTED]> wrote: > > > > > hi... > > > can someone point me to where/how i would go about calling a ruby app from a > > python app, and having the

Re: Hamming Distance

2008-06-19 Thread Matimus
On Jun 19, 4:27 pm, godavemon <[EMAIL PROTECTED]> wrote: > I need to calculate the Hamming Distance of two integers.  The hamming > distance is the number of bits in two integers that don't match.  I > thought there'd be a function in math or scipy but i haven't been able > to find one.  This is my

Re: Tkinter canvas drag/drop obstacle

2008-06-20 Thread Matimus
On Jun 20, 9:11 am, Peter Pearson <[EMAIL PROTECTED]> wrote: > Tkinter makes it very easy to drag jpeg images around on a > canvas, but I would like to have a "target" change color when > the cursor dragging an image passes over it.  I seem to be > blocked by the fact that the callbacks that might

Re: Tkinter canvas drag/drop obstacle

2008-06-20 Thread Matimus
On Jun 20, 11:10 am, Matimus <[EMAIL PROTECTED]> wrote: > On Jun 20, 9:11 am, Peter Pearson <[EMAIL PROTECTED]> wrote: > > > Tkinter makes it very easy to drag jpeg images around on a > > canvas, but I would like to have a "target" change color when > &g

Re: insertion sorts...

2008-06-23 Thread Matimus
On Jun 23, 11:52 am, python_newbie <[EMAIL PROTECTED]> wrote: > I don't know this list is the right place for newbie questions. I try > to implement insertion sort in pyhton. At first code there is no > problem. But the second one ( i code it in the same pattern i think ) > doesn't work. Any ideas

Re: percent string replacement with index

2008-06-24 Thread Matimus
On Jun 24, 12:26 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Ulrich Eckhardt wrote: > > What I'm surprised is that this isn't supported: > > >   "%(1)s %(2)s" % ("zero", "one", "two") > > > i.e. specifying the index in a sequence instead of the key into a map (maybe > > I would use [1] instead of

Re: Sequence iterators with __index__

2008-06-24 Thread Matimus
On Jun 24, 3:29 pm, schickb <[EMAIL PROTECTED]> wrote: > I think it would be useful if iterators on sequences had the __index__ > method so that they could be used to slice sequences. I was writing a > class and wanted to return a list iterator to callers.  I then wanted > to let callers slice from

Re: logging module's documentation lies?

2008-06-24 Thread Matimus
On Jun 24, 2:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Quote from the docs: > >     FORMAT = "%(asctime)-15s %(clientip)s %(user)-8s %(message)s" >     logging.basicConfig(format=FORMAT) >     d = {'clientip': '192.168.0.1', 'user': 'fbloggs'} >     logging.warning("Protocol problem:

Re: Sequence iterators with __index__

2008-06-25 Thread Matimus
On Jun 24, 4:19 pm, schickb <[EMAIL PROTECTED]> wrote: > On Jun 24, 3:45 pm, Matimus <[EMAIL PROTECTED]> wrote: > > > > > > I think it would be useful if iterators on sequences had the __index__ > > > method so that they could be used to slice sequences.

Re: python -regular expression - list element

2008-06-25 Thread Matimus
On Jun 25, 2:55 am, antar2 <[EMAIL PROTECTED]> wrote: > Hello, > > I am a beginner in Python and am not able to use a list element for > regular expression, substitutions. > > list1 = [ 'a', 'o' ] > list2 = ['star',  'day', 'work', 'hello'] > > Suppose that I want to substitute the vowels from list

Re: Newbie question about tuples and list comprehensions

2008-06-25 Thread Matimus
On Jun 25, 2:37 pm, idiolect <[EMAIL PROTECTED]> wrote: > Hi all - Sorry to plague you with another newbie question from a > lurker.  Hopefully, this will be simple. > > I have a list full of RGB pixel values read from an image.  I want to > test each RGB band value per pixel, and set it to somethi

Re: ConfigParser: Can I read(ConfigParser.get()) a configuration file and use it to call a funciton?

2008-06-26 Thread Matimus
On Jun 26, 7:41 am, [EMAIL PROTECTED] wrote: > Hello. I am a novice programmer and have a question > > I have a configuration file(configuration.cfg) > I read this from reading.py using ConfigParser > When I use ConfigParser.get() function, it returns a string. > I want to call a function that has

Re: embedding and extending python C API registering callback handler objects

2008-06-27 Thread Matimus
On Jun 27, 8:22 am, Tim Spens <[EMAIL PROTECTED]> wrote: > Hello all, > > I've been trying to get an example found > herehttp://codeidol.com/python/python3/Embedding-Python/Registering-Callb... > to work.  Every thing works fine except when I try to trigger an event from c > that will call a pyth

Re: How to "rebind" py2.5.1 to run from comprompt after uninstalling py3.0?

2008-06-27 Thread Matimus
On Jun 26, 8:13 pm, defn noob <[EMAIL PROTECTED]> wrote: > I installed python30 and so command prompt runs all pythonprograms > through that which i didnt want so i uninstalled it. > > now i cant start any pythonprograms through the commandprompt. > > how do I "rebind" python25 to luanch when clali

Re: raw_input into Tkinter ?

2008-06-30 Thread Matimus
On Jun 30, 9:55 am, [EMAIL PROTECTED] wrote: > Is there any way to type into a Tkinter frame window? > I want to use raw_input() within a Tkinter frame. `raw_input(prompt)` just calls `sys.stdout.write(prompt)` and returns `sys.stdin.readline()`. So, you can just create file-like objects to replac

Re: Please check my understanding...

2008-07-01 Thread Matimus
On Jul 1, 12:35 pm, Tobiah <[EMAIL PROTECTED]> wrote: > list.append([1,2]) will add the two element list as the next > element of the list. > > list.extend([1,2]) is equivalent to list = list + [1, 2] > and the result is that each element of the added list > becomes it's own new element in the orig

Re: How to make python scripts .py executable, not bring up editor

2008-07-08 Thread Matimus
On Jul 7, 2:56 pm, korean_dave <[EMAIL PROTECTED]> wrote: > From command Prompt, i type in a script,  "tryme.py". > > This, instead, brings up PythonWin editor and Interactive Window. > > Path variable is "C:\Python24". (I need Python 2.4 installed, not 2.5) > > How do I make it so that the script

Re: screencapture with PIL question

2008-07-14 Thread Matimus
On Jul 14, 8:11 am, greg <[EMAIL PROTECTED]> wrote: > Is there any way to capture the entire window?  specifically > the scrolled portion of a window that is _not_visible_on_the_screen_. I don't think there is. That is why it is called a _screen_ capture. Matt -- http://mail.python.org/mailman/

Bug when using with_statement with exec

2008-07-14 Thread Matimus
I think I'm going to create a new issue in Pythons issue database, but I wanted to run it by the news group first. See if I can get any useful feed back. The following session demonstrates the issue: Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Type "help"

Re: One step up from str.split()

2008-07-14 Thread Matimus
On Jul 14, 6:33 pm, "Joel Koltner" <[EMAIL PROTECTED]> wrote: > I normally use str.split() for simple splitting of command line arguments, but > I would like to support, e.g., long file names which-- under windows -- are > typically provided as simple quoted string. E.g., > > myapp --dosomething -

Re: 'if name is not None:' v. 'if name:'

2008-07-15 Thread Matimus
On Jul 15, 12:44 pm, "Victor Noagbodji" <[EMAIL PROTECTED]> wrote: > >>what's the difference between these two statement? > >one checks if the given object is not None, the other checks if it's a true > >value: > >http://docs.python.org/ref/Booleans.html#Booleans > >>And which one should one use?

Re: One step up from str.split()

2008-07-16 Thread Matimus
On Jul 15, 4:28 pm, "Joel Koltner" <[EMAIL PROTECTED]> wrote: > "Sion Arrowsmith" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > What's wrong with sys.argv ? > > Mainly that it doesn't exist.  :-)  The example was slightly contrived -- I'm > really dealing with commands inter

Re: Is this a valid use of 'import'?

2008-07-22 Thread Matimus
On Jul 22, 8:12 am, Frank Millman <[EMAIL PROTECTED]> wrote: > Hi all > > I am familiar enough with the normal use of 'import'. However, I have > found a use for it which seems effective, but I have not seen it used > like this before, so I am not sure if there are any downsides. > > I know that wh

Re: Question about inheritence

2008-07-22 Thread Matimus
On Jul 22, 9:26 am, Catherine Heathcote <[EMAIL PROTECTED]> wrote: > If I create a new class inherited from another with a constructor, what > happens with the new class's constructer? > Thanks for your time. Nothing, unless you call it in your constructor. class Base(object): def __init__(self)

Re: How do I compare files?

2008-07-22 Thread Matimus
On Jul 22, 4:27 pm, Clay Hobbs <[EMAIL PROTECTED]> wrote: > I am making a program that (with urllib) that downloads two jpeg files > and, if they are different, displays the new one.  I need to find a way > to compare two files in Python.  How is this done? > > -- Ratfink Do you just want to check

Re: Function editing with Vim throws IndentError

2008-07-23 Thread Matimus
On Jul 22, 2:02 pm, ptn <[EMAIL PROTECTED]> wrote: > Hi everybody, > > I have a weird problem.  Say I have a .py file with some functions in > it, like this: > >     # (...) >     def foo(): >         print("bar") > > When I open it and add a line to one of the functions, > >     # (...) >     def

Re: Function editing with Vim throws IndentError

2008-07-24 Thread Matimus
On Jul 24, 2:54 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > In message > <[EMAIL PROTECTED]>, > > Matimus wrote: > > That isn't the standard. With that setup tabs will show up as 4 > > spaces, and still confuse you. >

Re: Function editing with Vim throws IndentError

2008-07-25 Thread Matimus
On Jul 24, 9:32 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > In message > <[EMAIL PROTECTED]>, Matimus > wrote: > > > On Jul 24, 2:54 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] > > central.gen.new_zeala

Re: Missing exceptions in PEP 3107

2008-08-09 Thread Matimus
On Aug 9, 9:08 am, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > I'm just reading PEP 3107 (function annotations) and wonder why > exceptions are not mentioned there. I think it would be helpful if one > could specify which exceptions can be raised by a function, similarly to > how it is possibl

Re: Missing exceptions in PEP 3107

2008-08-11 Thread Matimus
> Maybe the following syntax would be even more intuitive: > > def foo(a: "a info", b: "b info") return "ret info" raise "exc info": >         return "hello world" > > I don't know how determined the "->" syntax is already. That seems much more intuitive and extensible. The "->" syntax has always

Re: Python 3.0 new integer division

2008-04-08 Thread Matimus
On Apr 8, 9:13 am, "Hutch" <[EMAIL PROTECTED]> wrote: > We now have a float result when two integers are divided in the same mannor > as 2.4 or 2.5. > I can handle that and use the Floor division but a simple question. > > Why in the world would you round down the last presented digit to a 6 > inst

Re: Multiple independent Python interpreters in a C/C++ program?

2008-04-11 Thread Matimus
On Apr 11, 9:24 am, [EMAIL PROTECTED] wrote: > This question was posed to me today. Given a C/C++ program we can clearly > embed a Python interpreter in it. Is it possible to fire up multiple > interpreters in multiple threads? For example: > > C++ main > thread 1 > Py_In

Re: How to make a "command line basd" interactive program?

2008-04-11 Thread Matimus
On Apr 11, 2:32 am, Evan <[EMAIL PROTECTED]> wrote: > Hope this hasn't been posted hundreds of times. I'm new for this. > > Before using python for this kind of script, I was using TCL to write > down a "command line based" interactive program. it likes a "tclsh", > or "python" command, after that

Re: Preferred method for "Assignment by value"

2008-04-15 Thread Matimus
On Apr 15, 10:23 am, [EMAIL PROTECTED] wrote: > As a relative new comer to Python, I haven't done a heck of a lot of > hacking around with it. I had my first run in with Python's quirky (to > me at least) tendency to assign by reference rather than by value (I'm > coming from a VBA world so that's

Re: Default parameter for a method... again

2008-04-16 Thread Matimus
On Apr 16, 9:26 am, [EMAIL PROTECTED] wrote: > I had posted this before but all the spam whipped it out... > > I wanted to know if there's any way to create a method that takes a > default parameter, and that parameter's default value is the return > value of another method of the same class. For e

Re: py3k concerns. An example

2008-04-18 Thread Matimus
On Apr 18, 8:58 am, Aaron Watters <[EMAIL PROTECTED]> wrote: > Why is the migration to py3k a concern? > For example I have libraries which use string%dictionary > substitution where the dictionary is actually an object > which emulates a dictionary. The __getitem__ for > the object can be very ex

Re: Code question

2008-04-21 Thread Matimus
On Apr 21, 12:05 pm, <[EMAIL PROTECTED]> wrote: > I've been trying to figure out a way to combine lists similar to how zip() > works. The main > difference though is I want to work with different length lists and combine > them. I came up with > the example below, which returns a list like I'm

Re: Code question

2008-04-21 Thread Matimus
On Apr 21, 4:16 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Apr 21, 4:42 pm, Matimus <[EMAIL PROTECTED]> wrote: > > > > > On Apr 21, 12:05 pm, <[EMAIL PROTECTED]> wrote: > > > > I've been trying to figure out a way to combi

Re: Subclassing list the right way?

2008-04-25 Thread Matimus
On Apr 25, 7:03 am, Kirk Strauser <[EMAIL PROTECTED]> wrote: > I want to subclass list so that each value in it is calculated at call > time. I had initially thought I could do that by defining my own > __getitem__, but 1) apparently that's deprecated (although I can't > find that; got a link?), a

Re: Given a string - execute a function by the same name

2008-04-28 Thread Matimus
On Apr 28, 9:33 am, [EMAIL PROTECTED] wrote: > I'm parsing a simple file and given a line's keyword, would like to call > the equivalently named function. > > There are 3 ways I can think to do this (other than a long if/elif > construct): > > 1. eval() > > 2. Convert my functions to methods and us

Re: Issue with regular expressions

2008-04-29 Thread Matimus
On Apr 29, 6:46 am, Julien <[EMAIL PROTECTED]> wrote: > Hi, > > I'm fairly new in Python and I haven't used the regular expressions > enough to be able to achieve what I want. > I'd like to select terms in a string, so I can then do a search in my > database. > > query = ' " some words" with an

Re: how to convert a multiline string to an anonymous function?

2008-04-29 Thread Matimus
On Apr 29, 3:39 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Danny Shevitz schrieb: > > > > > Simple question here: > > > I have a multiline string representing the body of a function. I have > > control > > over the string, so I can use either of the following: > > > str = ''' > > print st

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Matimus
On May 1, 4:37 am, Lance Gamet <[EMAIL PROTECTED]> wrote: > Hi, python beginner starting a new project here. > > This project will store most of its actual data in a shared-database, but > I have a small amount of user specific data that I need to be stored like > configuration or preferences for e

Re: help with list comprehension

2008-05-01 Thread Matimus
On May 1, 10:50 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On May 1, 11:46 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > > > > > Yves Dorfsman wrote: > > > > In the following script, m1() and m2() work fine. I am assuming m2() is > > > faster although I haven't checked that (loops through the

Re: Preventing 'bad' filenames from raising errors in os.path

2008-05-02 Thread Matimus
On May 2, 9:40 am, [EMAIL PROTECTED] wrote: > Bad file names, i.e. filenames the OS considers illegal, will cause > functions in the os.path module to raise an error. > > Example: > > import os.path > print os.path.getsize( 'c:/pytest/*.py' ) > > On Windows XP using Python 2.5.2 I get the following

Re: config files in python

2008-05-05 Thread Matimus
On May 5, 10:22 am, Francesco Bochicchio <[EMAIL PROTECTED]> wrote: > On Mon, 05 May 2008 00:35:51 -0700, sandipm wrote: > > Hi, > > In my application, I have some configurable information which is used > > by different processes. currently I have stored configration in a > > conf.py file as name=

Re: config files in python

2008-05-05 Thread Matimus
On May 4, 11:35 pm, sandipm <[EMAIL PROTECTED]> wrote: > Hi, > In my application, I have some configurable information which is used > by different processes. currently I have stored configration in a > conf.py file as name=value pairs, and I am importing conf.py file to > use this variable. it wo

Re: regexp help

2008-05-09 Thread Matimus
On May 9, 3:19 pm, globalrev <[EMAIL PROTECTED]> wrote: > i want to a little stringmanipulationa nd im looking into regexps. i > couldnt find out how to do: > s = 'poprorinoncoce' > re.sub('$o$', '$', s) > should result in 'prince' > > $ is obv the wrng character to use bu what i mean the pattern i

Re: Python one-liner??

2008-08-22 Thread Matimus
> Do we have python one-liner like perl one-liner 'perl -e'?? The answer is python -c... but python -h is useful too. Matt -- http://mail.python.org/mailman/listinfo/python-list

Re: Python in a Nutshell -- Book vs Web

2008-08-28 Thread Matimus
On Aug 28, 3:05 pm, "W. eWatson" <[EMAIL PROTECTED]> wrote: > I read an Amazon of Python in a Nutshell. The first edition is supposedly > much like the web site. What web site? The second edition apparently adds > more to the book than the web site. O'Reilly seems to just read all of the available

Re: eval() == evil? --- How to use it safely?

2008-08-28 Thread Matimus
On Aug 28, 3:09 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > On Thu, Aug 28, 2008 at 6:51 PM, Fett <[EMAIL PROTECTED]> wrote: > > I am creating a program that requires some data that must be kept up > > to date. What I plan is to put this data up on a web-site then have > > the program periodi

Re: creating a similar object from an derived class

2008-09-03 Thread Matimus
On Sep 3, 12:09 pm, Scott <[EMAIL PROTECTED]> wrote: > Let's say I have an object: > > class foo(): >    def create_another() >        return foo() > >    def blah(): >        x = self.create_another() >        ... do something with X > > Now I create a inherited class of this object: > > class bar

Re: Test if list contains another list

2008-09-08 Thread Matimus
On Sep 8, 12:32 am, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > mathieu a écrit : > > > Hi there, > > >   I am trying to write something very simple to test if a list > > contains another one: > > > a = [1,2,3] > > > b = [3,2,1,4] > > > but 'a in b' returns False. > > Indeed. Lists are not set

Re: Persuading ConfigParser to give me the section elements in the same order as the file

2008-09-10 Thread Matimus
On Sep 10, 1:52 pm, geoffbache <[EMAIL PROTECTED]> wrote: > Hi all, > > I recently needed to parse a file that was perfect for ConfigParser > apart from one thing: the elements in the sections, although > definitions, could in some cases clash with each other and therefore > it was important to be

Re: optparse

2008-09-16 Thread Matimus
I'm assuming you read at least some of the docs. This page makes it pretty clear: http://docs.python.org/lib/optparse-default-values.html Matt -- http://mail.python.org/mailman/listinfo/python-list

Re: What do you call a class not intended to be instantiated

2008-09-22 Thread Matimus
On Sep 21, 3:39 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > I have a class which is not intended to be instantiated. Instead of using > the class to creating an instance and then operate on it, I use the class > directly, with classmethods. Essentially, the class is used as

Re: a short-cut command for globals().clear() ??

2008-09-22 Thread Matimus
On Sep 22, 2:31 pm, [EMAIL PROTECTED] wrote: > hi all, > > forgive me , but the RTFM and Google search approaches are not > yielding an answer on this question.  I need to know if there's a top > level python interpreter command that clears all user variables (not > built-ins) from the global names

Re: ConfigParser subclass problem

2008-09-26 Thread Matimus
On Sep 26, 12:56 pm, Strato <[EMAIL PROTECTED]> wrote: > Hi folks, > > I think I do something wrong, but I don't see why it doesn't work, so I > will explain: > > I've searched in the list archive and found this thread, that explain > exactly what I want to have: the options strings returned by > C

Re: One class per file?

2008-09-29 Thread Matimus
> The book "Code Complete" recommends that you put only one class in a > source file, which seems a bit extreme for me. It seems that many > classes are small, so that putting several of them in a file seems > reasonable. I noticed that the decimal.py module in the standard > library has several c

Re: Wait or not?

2008-09-30 Thread Matimus
On Sep 30, 4:20 pm, Eric <[EMAIL PROTECTED]> wrote: > I've been wanting to learn Python for a while now but I can't decide > on whether to wait for Python 3's final release and learn it or just > go ahead and learn 2.x. Would it be hard to make the transition being > a noob? It shouldn't be a hard

Re: Inheritance but only partly?

2008-10-02 Thread Matimus
On Oct 2, 1:16 pm, process <[EMAIL PROTECTED]> wrote: > Let's say I have a class X which has 10 methods. > > I want class Y to inherit 5 of them. > > Can I do that? Can I do something along the lines of super(Y, exclude > method 3 4 7 9 10) ? I think the noral way of doing that is to split the ori

Re: When to derive from object?

2009-10-13 Thread Matimus
On Oct 13, 7:45 am, Igor Mikushkin wrote: > Hello all! > > I'm a newbie to Python. > Could you please say me when it is better to derive from "object" and > when not? > > Thanks, > Igor The only reason to derive from 'object' is if there is some sort of weird side effect of using new style classe

Re: When to derive from object?

2009-10-13 Thread Matimus
On Oct 13, 8:02 am, Matimus wrote: > On Oct 13, 7:45 am, Igor Mikushkin wrote: > > > Hello all! > > > I'm a newbie to Python. > > Could you please say me when it is better to derive from "object" and > > when not? > > > Thanks, > &g

Re: 2.6 windows install

2009-08-21 Thread Matimus
On Aug 20, 10:21 am, "Tim Arnold" wrote: > Hi, > I installed python2.6 to a netapp device. I can use it from my local windows > machine (XP). But others cannot use it from their pcs. > > They get this response > "The system cannot execute the specified program.". > > If they double click on python

Re: Modules/packages by GvR?

2009-08-28 Thread Matimus
On Aug 28, 7:58 am, gb345 wrote: > Are there any Python-only modules or packages in the latest releases > of Python 2.x or Python 3.x that were largely written by Guido van > Rossum?  What's the best way to find this out?  I know that some > modules mention the author(s) in the source code, but th

<    1   2   3