Re: Article of interest: Python pros/cons for the enterprise

2008-02-23 Thread Matthew Woodcraft
Jeff Schwab <[EMAIL PROTECTED]> wrote: > The most traditional, easiest way to open a file in C++ is to use an > fstream object, so the file is guaranteed to be closed when the fstream > goes out of scope. Out of interest, what is the usual way to manage errors that the operating system reports

Re: Article of interest: Python pros/cons for the enterprise

2008-02-23 Thread Matthew Woodcraft
Jeff Schwab <[EMAIL PROTECTED]> wrote: >Matthew Woodcraft wrote: >> Jeff Schwab <[EMAIL PROTECTED]> wrote: >>> The most traditional, easiest way to open a file in C++ is to use an >>> fstream object, so the file is guaranteed to be closed when the fstr

Re: Article of interest: Python pros/cons for the enterprise

2008-02-24 Thread Matthew Woodcraft
Jeff Schwab <[EMAIL PROTECTED]> wrote: > Matthew Woodcraft wrote: >> I see. Then, unless you don't care about data loss passing silently, >> this 'most traditional' way to open a file is unsuitable for files >> opened for writing. > No, why would yo

Re: Article of interest: Python pros/cons for the enterprise

2008-02-26 Thread Matthew Woodcraft
Nicola Musatti <[EMAIL PROTECTED]> wrote: > Sebastian Kaliszewski <[EMAIL PROTECTED]> wrote: >> 3. You can't handle clean-up errors in reasonable way in C++ish approach, so >> anything more complex should not by handled that way anyway. > So it's okay for a Python mechanism to deal with 95% of th

Re: Nested module import clutters package namespace?

2008-02-29 Thread Matthew Woodcraft
<[EMAIL PROTECTED]> wrote: > I'd be grateful for help with a problem of package and module=20 > namespaces. The behaviour I observe is unexpected (to me), and I=20 > couldn't find the answer in the docs, the tutorial, or the mailing=20 > list archive. So here we go: > I have a package named 'pack'

Re: Why """, not '''?

2008-03-05 Thread Matthew Woodcraft
<[EMAIL PROTECTED]> wrote: > Why is """ the preferred delimiter for multi-line strings? One advantage is that a dumb syntax highlighter is more likely to cope well if the content includes an apostrophe. -M- -- http://mail.python.org/mailman/listinfo/python-list

Re: documenting formal operational semantics of Python

2008-03-05 Thread Matthew Woodcraft
gideon <[EMAIL PROTECTED]> wrote: > In the context of a master's thesis I'm currently looking into > Python's operational semantics. Even after extensive searching on the > web, I have not found any formal model of Python. Therefore I am > considering to write one myself. To make a more informed d

Re: Why """, not '''?

2008-03-05 Thread Matthew Woodcraft
Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Wed, 05 Mar 2008 19:19:08 +, Matthew Woodcraft wrote: >> One advantage is that a dumb syntax highlighter is more likely to cope >> well if the content includes an apostrophe. > But if the content contains double-

Re: Immutable and Mutable Types

2008-03-17 Thread Matthew Woodcraft
In article <[EMAIL PROTECTED]>, Duncan Booth <[EMAIL PROTECTED]> wrote: > I don't have a copy of 1.4 to check so I'll believe you, but you can > certainly get the output I asked for with much more recent versions. > For the answer I actually want each asterisk substitutes for exactly one > char

Re: Jython 2.5 Beta1 Released!

2009-01-09 Thread Matthew Nuzum
bout two more betas before we start pushing out release > candidates, hopefully in February. > > This is a beta release so be careful. Congrats, I'm watching with eager anticipation! I'm stunned at how well this is working and the progress you're making. Keep up the great wor

Re: are there some special about '\x1a' symbol

2009-01-16 Thread Matthew Woodcraft
Steve Holden writes: > Unknown wrote: >> On 2009-01-12, John Machin wrote: >> >>> I didn't think your question was stupid. Stupid was (a) CP/M recording >>> file size as number of 128-byte sectors, forcing the use of an in-band >>> EOF marker for text files (b) MS continuing to regard Ctrl-Z as

accessing elements of a tuple

2009-01-30 Thread Matthew Sacks
i am trying to access elements of a tuple without using the [1:5] notation. the contents of the tuple are as follows: ('--datasourcename', 'DB') I want to access everything in the second argument, but i am not sure how to go about this without converting to a string. thanks in advance -- http://m

Re: accessing elements of a tuple

2009-01-30 Thread Matthew Sacks
e list directly using an index? right now I would have to grab the tuple and the use the index of the tuple On Fri, Jan 30, 2009 at 2:20 PM, Matthew Sacks wrote: > i am trying to access elements of a tuple without using the [1:5] notation. > the contents of the tuple are as follows: > (&

Re: accessing elements of a tuple

2009-01-30 Thread Matthew Sacks
>First of all, list is a reserved word. Don't use it as a variable name. I was using it as an example in this case. >mylist[0][1] if I understand the question. This works. Thank you. On Fri, Jan 30, 2009 at 2:39 PM, Tim Chase wrote: >> let me re-phrase that question: >> i would like to access t

problem with program - debugging leading nowhere

2009-01-30 Thread Matthew Sacks
i am trying to figure out what has gone wrong in my python program. it is complaining that there is an indendation error. should be simple enough but im stuck on this one. if anyone can help unjolt me it would be appreciated. thank you error message: Traceback (most recent call last): File ""

Re: problem with program - debugging leading nowhere

2009-01-30 Thread Matthew Sacks
this works. thanks! On Fri, Jan 30, 2009 at 3:59 PM, Jervis Whitley wrote: > > >> >> >> >> >> error message: >> Traceback (most recent call last): >> File "", line 1, in >> IndentationError: expected an indented block (, line 39) >> >> code: >> http://pastebin.com/f2f971f91 > > Hi, > > It looks

Re: what IDE is the best to write python?

2009-02-01 Thread Matthew Sacks
Wingware IDE is pretty good. It's not free though. http://www.wingware.com/ On Sun, Feb 1, 2009 at 12:14 AM, Stephen Hansen wrote: > On Sat, Jan 31, 2009 at 11:42 PM, mcheun...@hotmail.com > wrote: >> >> Hi all >> what IDE is the best to write python? >> thanks >> from Peter (mcheun...@hotmail

Re: simple web app, where to start

2009-02-06 Thread Matthew Sacks
have a loo at the django framework http://www.djangoproject.com/ On Fri, Feb 6, 2009 at 8:16 PM, Vincent Davis wrote: > I have a simple script that takes a few input values and returns a csv file > and a few stats. If I wanted to host this on the web how would I. I have no > idea where to begin.

getopt index out of range

2009-02-10 Thread Matthew Sacks
Hi List, I am getting an index out of range error when trying to parse with getopt. Probably something simple. Any suggestions are appreciated optlist, args = getopt.getopt(sys.argv[1:], 'h', ['connectPassword=', 'adminServerURL=', 'action=', 'targets=', 'appDir=']) #Assign Opts connectPassword

optparse versus getopt

2009-02-10 Thread Matthew Sacks
does anyone have any arguments against optparse vs getopt -- http://mail.python.org/mailman/listinfo/python-list

Re: optparse versus getopt

2009-02-10 Thread Matthew Sacks
it seems as if optparse isn't in my standard library. is there a way to add a lib like ruby gems? On Tue, Feb 10, 2009 at 1:38 PM, Tim Chase wrote: > Matthew Sacks wrote: >> >> does anyone have any arguments against optparse vs getopt > > I've found that the

Re: optparse versus getopt

2009-02-10 Thread Matthew Sacks
:42, Matthew Sacks wrote: >> >> it seems as if optparse isn't in my standard library. > > How did you install your Python? It has been part of the standard library > for a very long time. > >> is there a way to add a lib like ruby gems? > > http://docs.python.or

getopt

2009-02-10 Thread Matthew Sacks
if anyone can have a look at this code and offer suggestions i would appreciate it. i am forced to use getopt, so i cant use something good like optparse passedArgs = sys.argv[1:] optlist, args = getopt.getopt(str(passedArgs), ["connectPassword=", "adminServerURL=", "action=", "targets=", "appDir=

Re: getopt

2009-02-10 Thread Matthew Sacks
The documentation leaves lack for want, especially the examples. On Tue, Feb 10, 2009 at 5:25 PM, John Machin wrote: > On Feb 11, 12:12 pm, Matthew Sacks wrote: >> if anyone can have a look at this code and offer suggestions i would >> appreciate it. >> i am forced to use

Re: getopt

2009-02-10 Thread Matthew Sacks
sults. I appreciate the response. M On Tue, Feb 10, 2009 at 10:36 PM, John Machin wrote: > On Feb 11, 4:36 pm, Matthew Sacks wrote: >> The documentation leaves lack for want, especially the examples. > > You had two problems: > > (1) str(passedArgs): The docs make it plain

Re: getopt index out of range

2009-02-11 Thread Matthew Sacks
>because the traceback says the index is 0 and there's only one line with a 0 >in it! Indeed. Thank you. On Wed, Feb 11, 2009 at 7:11 AM, MRAB wrote: > Steve Holden wrote: >> >> Matthew Sacks wrote: >>> >>> Hi List, >>> I am getting

Re: getopt index out of range

2009-02-11 Thread Matthew Sacks
Perhaps you can give me a call privately and I will explain it to you. Regards, Matthew On Wed, Feb 11, 2009 at 1:48 PM, John Machin wrote: > On Feb 11, 6:16 am, Matthew Sacks wrote: >> Hi List, >> I am getting an index out of range error when trying to parse with getopt. >&g

Re: getopt index out of range

2009-02-11 Thread Matthew Sacks
Keep your threadiquette to yourself. On Wed, Feb 11, 2009 at 1:48 PM, John Machin wrote: > On Feb 11, 6:16 am, Matthew Sacks wrote: >> Hi List, >> I am getting an index out of range error when trying to parse with getopt. >> Probably something simple. Any sugges

Re: What encoding does u'...' syntax use?

2009-02-20 Thread Matthew Woodcraft
Ron Garret writes: > Put this another way: I would have thought that when the Python parser > parses "u'\xb5'" it would produce the same result as calling > unicode('\xb5'), but it doesn't. Instead it seems to produce the same > result as calling unicode('\xb5', 'latin-1'). But my default encoding

Re: "Byte" type?

2009-02-22 Thread Matthew Woodcraft
"Hendrik van Rooyen" writes: > "Christian Heimes" wrote: > on the surface JN has a point - If you have to go through two > conversions, then 2.6 does not achieve what it appears to set out to > do. So the issue is simple: > - do you have to convert twice? > - If yes - why? - as he says - there

Great Python Job - Bristol - UK

2008-12-08 Thread Hyatt, Matthew
d I will gladly discuss the opportunity in more detail. Many thanks, Matt Matthew Hyatt Senior Consultant <http://www.ajilon.com/> Tel: +44 (0) 117 930 8575 Fax: +44 (0) 117 929 1444 [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> www.computerpeople.com Int

Exec inside a class method to call other class methods?

2008-12-25 Thread Matthew Dubins
ee, for each data_type, I call the corresponding class method that I've specified. Please help me to transform my ugly functional code into concise functional code. :) Thanks, Matthew -- def parse(self, data, data_type): if data_type == 'nocall':

Re: Exec inside a class method to call other class methods?

2008-12-25 Thread Matthew Dubins
Each type does contain its own parsing method. It's just that, as it stands, one method is being used to shunt off the data to the correct parsing method. Matthew Dubins David Stanek wrote: On Thu, Dec 25, 2008 at 1:22 PM, Matthew Dubins wrote: Hello all, I have made a python s

PyYAML: How to register my yaml.YAMLObject subclasses?

2008-10-11 Thread Matthew Wilson
I suspect the solution to my problem is something really trivial. I wrote a module called pitz that contains a class Issue: >>> pitz.Issue.yaml_tag u'ditz.rubyforge.org,2008-03-06/issue' Then I try to load a document with that same tag, but I get a ConstructorError: ConstructorError

Need advice on python importing

2008-10-17 Thread Matthew Wilson
I started with a module with a bunch of classes that represent database tables. A lot of these classes have methods that use other classes inside, sort of like this: class C(object): @classmethod def c1(cls, a): return a class D(object): def d1(self, a

Re: Need advice on python importing

2008-10-17 Thread Matthew Wilson
On Fri 17 Oct 2008 04:52:47 PM EDT, Steve Holden wrote: > Matthew Wilson wrote: >> I started with a module with a bunch of classes that represent database >> tables. A lot of these classes have methods that use other classes >> inside, sort of like this: >

Very simple WSGI question

2008-11-16 Thread Matthew Wilson
I want to write some middleware to notice when the inner app returns a 500 status code. I'm sure there are already sophisticated loggers that do this sort of thing, but I'm using this as a learning exercise. Right now, I wrapped the start_response callable. So when the WSGI application calls the

Re: Fwd: Problem with writing a long line in a text file

2008-11-20 Thread Matthew Barnett
Steve Holden wrote: Mohsen Akbari wrote: Dear guys, I'm a newbie in python and I have this problem with the code that I'm writing. There is a very long line which I wish to output it to a text file.But when I do this, in the output file, the result appears in two lines. I thought maybe that's b

Re: Style question - defining immutable class data members

2009-03-14 Thread Matthew Woodcraft
Gary Herron writes: > But now you are not listening to what people are telling you. It has > *nothing* to do with the mutability/immutability of the integer and the list > your two classes create. No! Did you run the code he posted? The immutability makes all the difference. > The difference

Re: Style question - defining immutable class data members

2009-03-15 Thread Matthew Woodcraft
Gary Herron writes: > Gary Herron wrote: > No, you are still misinterpreting your results. But you can be forgiven > because this is quite a subtle point about Python's attribute access. > > Here's how it works: > > On access, self.count (or self.anything) attempts to find "count" in > the inst

Re: Style question - defining immutable class data members

2009-03-15 Thread Matthew Woodcraft
"Rhodri James" writes: > On Sun, 15 Mar 2009 13:26:17 -, Matthew Woodcraft >> It seems clear to me that Maxim understood all this when he asked his >> original question (you need to understand this subtlety to know why >> the trick he was asking about

Re: Style question - defining immutable class data members

2009-03-15 Thread Matthew Woodcraft
John Posner writes: > My question is ... WHY does the interpreter silently create the > instance attribute at this point, causing a "surprising decoupling" > from the class attribute? WHY doesn't the interpreter behave as it > would with a simple, non-instance variable: > > python > Python 2

Re: Style question - defining immutable class data members

2009-03-15 Thread Matthew Woodcraft
"Rhodri James" writes: > But do you, though? The only occasion I can think of that I'd want > the search to go past the instance is this "auto-initialisation", > and frankly I'd rather do that in an __init__ anyway. Perhaps > static methods or class methods work that way, I don't know how > the

Re: How to do this in Python?

2009-03-17 Thread Matthew Woodcraft
Jim Garrison writes: > buf = f.read(1) > while len(buf) > 0 > # do something > buf = f.read(1) I think it's more usual to use a 'break' rather than duplicate the read. That is, something more like while True: buf = f.read(1)

Can I import from a directory that starts with a dot (.) ?

2009-04-13 Thread Matthew Wilson
I want to have .foo directory that contains some python code. I can't figure out how to import code from that .foo directory. Is this even possible? TIA Matt -- http://mail.python.org/mailman/listinfo/python-list

Need help with setup.py and data files

2009-04-21 Thread Matthew Wilson
I'm working on a package that includes some files that are meant to be copied and edited by people using the package. My project is named "pitz" and it is a bugtracker. Instead of using a config file to set the options for a project, I want to use python files. When somebody installs pitz, I wan

Re: mailbox.mbox.add() sets access time as well as modification time

2009-05-01 Thread Matthew Woodcraft
Chris Green wrote: > Currently I run mutt on a remote server where I have to use maildir > because their file systems are mounted noatime. I am moving to reading > mail on my own Linux box just because I want to get back to mbox, [...] For what it's worth, setting 'check_mbox_size = yes' is usuall

How to walk up parent directories?

2009-05-03 Thread Matthew Wilson
Is there already a tool in the standard library to let me walk up from a subdirectory to the top of my file system? In other words, I'm looking for something like: >>> for x in walkup('/home/matt/projects'): ... print(x) /home/matt/projects /home/matt /home / I know I

Re: How to walk up parent directories?

2009-05-04 Thread Matthew Wilson
On Sun 03 May 2009 09:24:59 PM EDT, Ben Finney wrote: > Not every simple function belongs in the standard library :-) Thanks for the help with this! Maybe I'm overestimating how often people need this walkup function. Matt -- http://mail.python.org/mailman/listinfo/python-list

How should I use grep from python?

2009-05-07 Thread Matthew Wilson
I'm writing a command-line application and I want to search through lots of text files for a string. Instead of writing the python code to do this, I want to use grep. This is the command I want to run: $ grep -l foo dir In other words, I want to list all files in the directory dir that contain

Re: How should I use grep from python?

2009-05-07 Thread Matthew Wilson
On Thu 07 May 2009 09:09:53 AM EDT, Diez B. Roggisch wrote: > Matthew Wilson wrote: >> >> As of May 2009, what is the recommended way to run an external process >> like grep and capture STDOUT and the error code? > > subprocess. Which becomes pretty clear when readi

Re: How should I use grep from python?

2009-05-07 Thread Matthew Wilson
On Thu 07 May 2009 09:25:52 AM EDT, Tim Chase wrote: > While it doesn't use grep or external processes, I'd just do it > in pure Python: Thanks for the code! I'm reluctant to take that approach for a few reasons: 1. Writing tests for that code seems like a fairly large amount of work. I think I

I need help building a data structure for a state diagram

2009-05-24 Thread Matthew Wilson
I'm working on a really simple workflow for my bug tracker. I want filed bugs to start in an UNSTARTED status. From there, they can go to STARTED. >From STARTED, bugs can go to FINISHED or ABANDONED. I know I can easily hard-code this stuff into some if-clauses, but I expect to need to add a lo

Re: I need help building a data structure for a state diagram

2009-05-24 Thread Matthew Wilson
On Sun 24 May 2009 03:42:01 PM EDT, Kay Schluehr wrote: > > General answer: you can encode finite state machines as grammars. > States as non-terminals and transition labels as terminals: > > UNSTARTED: 'start' STARTED > STARTED: 'ok' FINISHED | 'cancel' ABANDONED > ABANDONED: 'done' > FINISHED: 'd

How can I get access to the function called as a property?

2009-05-24 Thread Matthew Wilson
I use a @property decorator to turn some methods on a class into properties. I want to be able to access some of the attributes of the original funtion, but I don't know how to get to it. Any ideas? Matt -- http://mail.python.org/mailman/listinfo/python-list

How to test python snippets in my documents?

2009-05-26 Thread Matthew Wilson
I'm using a homemade script to verify some code samples in my documentation. Here it is: #! /usr/bin/env python2.6 # vim: set expandtab ts=4 sw=4 filetype=python: import doctest, os, sys def main(s): "Run doctest.testfile(s, None)" return doctest.testfile(s, No

In metaclass, when to use __new__ vs. __init__?

2008-05-12 Thread Matthew Wilson
I have been experimenting with metaclasses lately. It seems possible to define a metaclass by either subclassing type and then either redefining __init__ or __new__. Here's the signature for __init__: def __init__(cls, name, bases, d): and here's __new__: def __new__(meta, classname,

Re: Learning Python for no reason

2008-05-12 Thread Matthew Woodcraft
John Salerno <[EMAIL PROTECTED]> wrote: > Just something that crosses my mind every time I delve into "Learning > Python" each night. Does anyone see any value in learning Python when you > don't need to for school, work, or any other reason? I mean, sure, there's > value in learning anything at

Re: do you fail at FizzBuzz? simple prog test

2008-05-13 Thread Matthew Woodcraft
Gabriel Genellina <[EMAIL PROTECTED]> wrote: > I would like to write a similar problem without this non-programming > distracting issues (that is, a problem simple enough to be answered in a > few minutes, that requires only programming skills to be solved, and > leaving out any domain-specif

Re: Purpose of operator package

2008-05-14 Thread Matthew Woodcraft
I V <[EMAIL PROTECTED]> wrote: > I hadn't heard of operator.truth before. Does it do anything different > from bool(x) ? Not really. It was occasionally useful before the bool type existed; now it's just a leftover. -M- -- http://mail.python.org/mailman/listinfo/python-list

Re: Running programs under a python program...

2008-05-21 Thread Matthew Woodcraft
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > So I have a python program that runs a bunch of other programsit > then loops forever, occasionally executing other programs. > > To run each of these programs my python code executes: > subprocess.Popen(command_line, shell=True, stdout=fd, > stder

Re: Python and Flaming Thunder

2008-05-22 Thread Matthew Woodcraft
<[EMAIL PROTECTED]> wrote: > So it seems like you're designing a language for non-programmers. > That's good, I've never heard about anyone so interested in teaching > programming for kids and non-programmers. But in that case, you > shouldn't even be comparing it to Python. At one time, Guido was

Re: Python is slow

2008-05-22 Thread Matthew Trevor
On May 23, 2:14 am, cm_gui <[EMAIL PROTECTED]> wrote: > I've yet to see a web application written in Python which is really > fast. Then stop looking at your own inept Python code and open your eyes. -- http://mail.python.org/mailman/listinfo/python-list

Re: serach file for regexp, return if found?

2008-05-22 Thread Matthew Trevor
On May 23, 9:10 am, [EMAIL PROTECTED] wrote: > but search and match only returns matchobjects(what are those anyway? > i dont get what to do with them, do they contain true/false, > stringposition etc?) It's all covered in the docs: http://docs.python.org/lib/module-re.html http://docs.python.org

Re: Returning to 'try' block after catching an exception

2008-05-22 Thread Matthew Trevor
On May 23, 4:01 am, "inhahe" <[EMAIL PROTECTED]> wrote: > Might have a stack overflow issue, if it retries too many times? In which example? Neither of them is looping... -- http://mail.python.org/mailman/listinfo/python-list

Re: Relationship between GUI and logic?

2008-05-23 Thread Matthew Woodcraft
John Salerno <[EMAIL PROTECTED]> wrote: > Basically, the question is this: can you write the logic behind a > program (whether it be a game, an email client, a text editor, etc.) > without having any idea of how you will implement the GUI? You probably could, but it's best not to unless you're

Re: Relationship between GUI and logic?

2008-05-24 Thread Matthew Woodcraft
David C. Ullrich <[EMAIL PROTECTED]> wrote: > Matthew Woodcraft <[EMAIL PROTECTED]> wrote: >> For example, if you were writing the 'logic' for a chess program you >> might choose a way of modelling the board that can't represent a >> position with

Re: Code correctness, and testing strategies

2008-05-25 Thread Matthew Woodcraft
Michael L Torrie <[EMAIL PROTECTED]> wrote: > Watch your programmers then. They do have to write and debug the > code. And they will spend at least as much or more time debugging as > writing the code. It's a fact. I have several programmers working > for me on several projects. What you have

Re: need some help in serving static files inside a wsgi apps

2008-05-25 Thread Matthew Woodcraft
Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >Sebastian 'lunar' Wiesner schrieb: >> I guess, Apache does some kind of memory caching for files, which are often >> requested and small enough to fit into the system memory. May be, that's >> what the OP is referring to ... > I'm not aware of that, an

Re: unittest: Calling tests in liner number order

2008-05-25 Thread Matthew Woodcraft
Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >I don't see this as something that can be solved by ordering tests - >*especially* not on a per-method-level as the OP suggested, because I >tend to have test suites that span several files. unittest already runs multiple test suites in the order you

Re: Code correctness, and testing strategies

2008-05-25 Thread Matthew Woodcraft
David <[EMAIL PROTECTED]> wrote: > Might be a difference in project size/complexity then, rather than > company size. Most of my works projects are fairly small (a few > thousand lines each), very modular, and each is usually written and > maintained by one developer. A lot of the programs will be

defaultdict.fromkeys returns a surprising defaultdict

2008-06-03 Thread Matthew Wilson
I used defaultdict.fromkeys to make a new defaultdict instance, but I was surprised by behavior: >>> b = defaultdict.fromkeys(['x', 'y'], list) >>> b defaultdict(None, {'y': , 'x': }) >>> b['x'] >>> b['z'] -

Re: Getting Python exit code when calling Python script from Java program

2008-06-18 Thread Matthew Woodcraft
In article <[EMAIL PROTECTED]>, > I tried using the sys.exit() method in my script and passed non -zero > values. However the value wasn't picked up the by Java > Process.exitValue() method - it kept picking up 0. On investigation > it turned out that the exit value being read is from python.exe >

Re: Function argument conformity check

2008-06-18 Thread Matthew Woodcraft
In article <[EMAIL PROTECTED]>, > The problem is that using these attributes, I would essentially have > to re-write the logic python uses when calling a function with a > given set of arguments. I was hoping there is a way to get at that > logic without rewriting it. I don't think there is. I end

Re: py2exe & application add-ons

2008-06-19 Thread Matthew Woodcraft
Alex Gusarov <[EMAIL PROTECTED]> wrote: > Hello, I've met a problem - I want my program working without Python > installation but I have some add-on mechanism (add-ons represented by > separate .py files, and application auto-recognize such files on > start). > So, if I will using py2exe for main

Re: Write a file - beginner's question

2008-07-03 Thread Matthew Fitzgibbons
Callie Bertsche wrote: I have a closely related note. How do I write to a relative path with python? Example, source = open('/../../directory/subdirectory/file.extension') What am I missing? -- http://mail.python.org/mailman/listinfo/python-list Leave off the beginning slash. -Matt -- http:/

Re: Testing for an empty list

2008-07-03 Thread Matthew Fitzgibbons
Alexnb wrote: Okay this is a simple question I just don't know how. If I have a list, say: funList = [] and after a while something possible should have been appended to it, but wasn't. How can I test if that list is empty. if not funList: do_something() -Matt -- http://mail.python.o

Re: Singleton implementation problems

2008-07-03 Thread Matthew Fitzgibbons
Urizev wrote: Hi everyone I have developed the singleton implementation. However I have found a strange behaviour when using from different files. The code is attached. Executing main new MySet object No singleton instance New singleton: <__main__.Singleton instance at 0x2b98be474a70> new MySet

Re: Singleton implementation problems

2008-07-04 Thread Matthew Fitzgibbons
Ben Finney wrote: Peter Otten <[EMAIL PROTECTED]> writes: The problem is the structure of your program. The myset module is imported twice by Python, once as "myset" and once as "__main__". Yes, this is the problem. Each module imports the other. Therefore you get two distinct MySet classes

Re: Unit Testing Techniques

2008-07-11 Thread Matthew Fitzgibbons
I'm by no means a testing expert, but I'll take a crack at it. Casey McGinty wrote: I'm familiar with the unittest module in Python, however I'm hoping someone can point me to some examples of more advanced usages of the framework. For example: 1. Using the framework to test a package with ne

Mutually referencing imports -- impossible?

2008-07-13 Thread Matthew Wilson
I started off with a module that defined a class Vehicle, and then subclasses Car and Motorcycle. In the Car class, for some bizarre reason, I instantiated a Motorcycle. Please pretend that this can't be avoided for now. Meanwhile, my Motorcycle class instantiated a Car as well. Then I moved th

How to package a logging.config file?

2008-07-13 Thread Matthew Wilson
I'm working on a package that uses the standard library logging module along with a .cfg file. In my code, I use logging.config.fileConfig('/home/matt/mypackage/matt.cfg') to load in the logging config file. However, it seems really obvious to me that this won't work when I share this package wit

Re: How to package a logging.config file?

2008-07-15 Thread Matthew Wilson
On Mon 14 Jul 2008 09:25:19 AM EDT, Vinay Sajip wrote: > Is your package a library or an application? If it's a library, you > should avoid configuring logging using a config file - this is because > logging configuration is process-wide, and if multiple libraries use > fileConfig to configure thei

Re: x, = y (???)

2008-07-17 Thread Matthew Woodcraft
kj wrote: > I still don't get it. If we write > > y = 'Y' > x, = y > > what's the difference now between x and y? And if there's no > difference, what's the point of performing such "unpacking"? If y really is is a string, I think it's likely that the line you came across was a typo. In the

Re: Python Written in C?

2008-07-21 Thread Matthew Fitzgibbons
Martin P. Hellwig wrote: I disagree he has upper management written all over him. In any case, the OP should remember that programming languages are all theoretically the same: if you can do it in one language, then you can theoretically do it any other. When choosing a language, you just ne

Re: sending input to an embedded application

2008-07-21 Thread Matthew Fitzgibbons
mefyl wrote: Uwe Schmitt wrote: On 12 Jul., 09:08, George Oliver <[EMAIL PROTECTED]> wrote: What I would like to do is take a program and embed it or put it within a Python-run GUI, using the GUI just to capture and send input to the application, and display the ouput. Which interface does you

Re: Python Written in C?

2008-07-21 Thread Matthew Woodcraft
Roy Smith <[EMAIL PROTECTED]> wrote: > C is the highest level assembler language I've ever used. And I've used a > few. It really is cool that you can add two 32-bit integers and not have > to worry about all those carry bits. I was ever so pleased when I found out that the LLVM people have l

Re: Execution speed question

2008-07-25 Thread Matthew Fitzgibbons
Suresh Pillai wrote: That's a good comparison for the general question I posed. Thanks. Although I do believe lists are less than ideal here and a different data structure should be used. To be more specific to my case: As mentioned in my original post, I also have the specific condition tha

Re: Execution speed question

2008-07-25 Thread Matthew Fitzgibbons
Iain King wrote: On Jul 25, 4:22 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote: It seems like the probability calculation applies to all three equally, and can therefore be ignored for the simulations. The probability affects (1) more. My reasoning for this being: as probabilit

Trouble with rpdb2 and winpdb debuggers in embedded Python script

2008-07-25 Thread Matthew Severin
Having some trouble getting rpdb2 and winpdb running properly with Python embedded in a C++ project. Our implementation has a number of C++ classes associated with Python classes. I am able to attach to the embedded script with the debugger and the program freezes and waits. However, when I step

Re: 2d graphics - what module to use?

2008-07-25 Thread Matthew Fitzgibbons
sturlamolden wrote: On Jul 25, 8:13 am, Pierre Dagenais <[EMAIL PROTECTED]> wrote: What is the easiest way to draw to a window? I'd like to draw something like sine waves from a mathematical equation. Newbie to python. For mathematica equations, NumPy and matplotlib is probably the best opti

Re: Attack a sacred Python Cow

2008-07-25 Thread Matthew Fitzgibbons
Jordan wrote: Well this discussion is chugging along merrily now under its own steam, but as the OP I should probably clarify a few things about my own views since people continue to respond to them (and are in some cases misunderstanding me.) I *like* explicit self for instance variable access.

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread Matthew Fitzgibbons
Carl Banks wrote: On Jul 28, 8:15 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: On Mon, 28 Jul 2008 13:22:37 -0700, Carl Banks wrote: On Jul 28, 10:00 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: Cutting to the crux of the discussion... On Sun, 27 Jul 2

Re: Where is the documentation for psycopg2?

2008-07-29 Thread Matthew Woodcraft
kj <[EMAIL PROTECTED]> wrote: > Hi. I can't find any documentation for psycopg2. > > I'm a noob, so I'm sure I'm just not looking in the right place... > > Anybody know where it is? For basic use, psycopg2 follows the dbapi, which is described in http://www.python.org/dev/peps/pep-0249/ Additi

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread Matthew Woodcraft
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > "if x" is completely type agnostic. You can pass an object of any type to > it, and it will work. (Excluding objects with buggy methods, naturally.) There are many circumstances where if a parameter is None I'd rather get an exception than have the co

Re: Boolean tests

2008-07-29 Thread Matthew Woodcraft
Ben Finney <[EMAIL PROTECTED]> wrote: > No, he retracted the *insult* and restated the *advice* as a distinct > statement. I think it's quite worthwhile to help people see the > difference. Ben, it was quite clear from Anders' post that he knows about __nonzero__ . That's why the so-called advice

Re: Build tool for Python

2008-07-29 Thread Matthew Woodcraft
Paul Boddie <[EMAIL PROTECTED]> wrote: > I do understand that it can be awkward to work out which object files > need recompiling due to changes in source files, for example, and > that one doesn't want to see the logic involved reproduced all over > the place, but I do wonder whether the machiner

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread Matthew Fitzgibbons
Carl Banks wrote: On Jul 29, 11:12 am, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote: Carl Banks wrote: On Jul 28, 8:15 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: On Mon, 28 Jul 2008 13:22:37 -0700, Carl Banks wrote: On Jul 28, 10:00 am, Steven

Re: Boolean tests

2008-07-29 Thread Matthew Woodcraft
Steven D'Aprano <[EMAIL PROTECTED]> wrote: >Anders wrote: >> "But then you decide to name the method "__nonzero__", instead of some >> nice descriptive name?" > That suggests to me that Anders imagined that __nonzero__ is something I > just made up, instead of a standard Python method. What do

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-30 Thread Matthew Fitzgibbons
Carl Banks wrote: On Jul 30, 1:58 am, "Russ P." <[EMAIL PROTECTED]> wrote: On Jul 29, 10:33 pm, Carl Banks <[EMAIL PROTECTED]> wrote: On Jul 30, 1:15 am, "Russ P." <[EMAIL PROTECTED]> wrote: Having said that, it would sure be nice to be able to write if myList is not empty: instead of if len(

<    1   2   3   4   5   >