C FFI: easy conversion from list to argv?

2006-04-17 Thread Burton Samograd
Hi, I'm trying to update the fuse python bindings to my app and I was curious if there were any C utility functions that would turn a sys.argv into a C style argv array, or am I going to have to write those myself? Thanks. -- burton samograd kruhft .at.

Re: C FFI: easy conversion from list to argv?

2006-04-17 Thread Burton Samograd
Burton Samograd <[EMAIL PROTECTED]> writes: > I'm trying to update the fuse python bindings to my app and I was > curious if there were any C utility functions that would turn a > sys.argv into a C style argv array, or am I going to have to write > those myself? Follo

Re: Software Needs Philosophers

2006-05-21 Thread Burton Samograd
ny jobs for philosophers, and their works are generally very underappreciated during thier lives, but it's quite difficult to say that it's useless, just often misunderstood by the less forward thinking people of their time. -- burton samograd kruhft .at. gma

Re: how to pipe to variable of a "here document"

2006-04-09 Thread Burton Samograd
elect into a variable? popen doesn't work that way. you can only open them read or write. you'll have to create a couple of pipes (one for reading, one for writing), do a fork, execve, etc with the posix api. at least that's how one does it in C...i'm a bit new to pyth

Re: how relevant is C today?

2006-04-11 Thread Burton Samograd
nd assuming your language has no bugs. Imperative programming is mathematics with state; functional programming *is* mathematics. -- burton samograd kruhft .at. gmail kruhft.blogspot.com www.myspace.com/kruhft metashell.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory limit to dict?

2006-04-11 Thread Burton Samograd
the maximum allowed address space mapping. You should partition your data into hierarchial modules and let python do the swapping for you...although you have 16 gigs (I have to put a holy crap after that!) you will always run into process limits, at least until true 64 bit os's a

Initializing defaults to module variables

2006-04-12 Thread Burton Samograd
.program") import config So I guess the real question is: Is there a way to create a module namespace and populate it before sourcing the file? -- burton samograd kruhft .at. gmail kruhft.blogspot.com www.myspace.com/kruhft metashell.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Initializing defaults to module variables

2006-04-13 Thread Burton Samograd
Burton Samograd <[EMAIL PROTECTED]> writes: > Is there a way to create a module namespace and populate it > before sourcing the file? A reply to my own question, but I thought I would share the answer. I got it to work with the following code: import config import sy

Re: Initializing defaults to module variables

2006-04-13 Thread Burton Samograd
pass # ignore missing config file, but not syntax errors > > # end of file > > with this in place, you just have to do > > import config > > in any application module than needs to access the configuration > data. nice, that looks to be just what I was look

function prototyping?

2006-04-13 Thread Burton Samograd
Hi, Is there any way to 'prototype' functions in python, as you would in C? Would that be what the 'global' keyword is for, or is there a more elegant or 'pythonic' way of doing forward references? -- burton samograd kruhft

Re: function prototyping?

2006-04-13 Thread Burton Samograd
Duncan Booth <[EMAIL PROTECTED]> writes: > Burton Samograd wrote: > > Is there any way to 'prototype' functions in python, as you would in > > C? Would that be what the 'global' keyword is for, or is there a more > > elegant or 'pythonic&

Re: function prototyping?

2006-04-13 Thread Burton Samograd
e the functions defined somewhere else and then let the linker work it all out for me. I was hoping that python had some sort of lazy evaluation scheme for this type of behaviour so that you could defer linkage (or variable evalutation) until runtime, or at least variable reference (through the

Re: function prototyping?

2006-04-13 Thread Burton Samograd
bruno at modulix <[EMAIL PROTECTED]> writes: > Burton Samograd wrote: > > Duncan Booth <[EMAIL PROTECTED]> writes: > > dont use 'dict' as an identifier, it shadows the builtin dict type. just an example i jotted down, not real

Re: function prototyping?

2006-04-13 Thread Burton Samograd
bruno at modulix <[EMAIL PROTECTED]> writes: > Burton Samograd wrote: > > "infidel" <[EMAIL PROTECTED]> writes: > > I'm a C programmer, so I'm doing it in a bit of a C like way; > > prototype the function, initalize the array using the prototyp

Collect output to string

2010-11-23 Thread Burton Samograd
Hello, I was wondering if there is any way in python to 'collect output to string' as in some lisps/schemes. Output being, printed output to the console using print. Thanks. -- Burton Samograd -- http://mail.python.org/mailman/listinfo/python-list

Re: Collect output to string

2010-11-23 Thread Burton Samograd
Chris Rebert writes: > On Tue, Nov 23, 2010 at 11:53 AM, Burton Samograd wrote: >> Hello, >> >> I was wondering if there is any way in python to 'collect output to >> string' as in some lisps/schemes.  Output being, printed output to the >> cons

Re: Collect output to string

2010-11-24 Thread Burton Samograd
occasionally want to capture test reports. Thanks for the info, but I was looking for a way to collect output without modifying the original function, similar to with-output-to-string in some schemes. -- Burton Samograd -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionaries inside out

2010-11-26 Thread Burton Samograd
pattern for this problem?  Is there a better way of approaching > it other than making a set of dictionaries which "mirror" the > originals?  FWIW, I have approximately 50 tables ranging from 2 > entries to over 100. Looks like there might be some solutions here: http://stackov

Changing ' to " in printed representation of dictionaries

2010-12-02 Thread Burton Samograd
;{ 'x': 1, 'y': 2 }" # close but not quite a JSON string >>> `x`.replace("'", '"') '{ "x": 1, "y": 2 }' # JSON and python compatible So the question is, is there an automatic way to tell python to use " instead of ' when doing a repr of lists? Thanks. -- Burton Samograd -- http://mail.python.org/mailman/listinfo/python-list

Improper Backtraces in Exec'd Code

2010-07-22 Thread Burton Samograd
setting the mod.__file__ variable and as my own idea I set __file__ in mod.__dict__. Niether of these steps seem to set the file properly in the backtrace. So the question here is, where does the backtrace printing module get it's __file__ parameters from, or what am I missing to set it prope

Re: Improper Backtraces in Exec'd Code

2010-07-22 Thread Burton Samograd
Peter Otten <__pete...@web.de> writes: > If you make the compilation step explicit you can pass a filename: > >>>> exec compile("def f(x): return f(x-1) if x else 1/0", "yadda.py", > "exec") The works great. Problem solved. Thanks

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-26 Thread Burton Samograd
ial utilities to do this?? > > Not if the OS and VFS are competently designed. In Linux all you need > to do is this: > > mount -o loop /path/to/file.iso /mount/point > > Apparently you've got to jump through all sorts of hoops using 3rd > party software to do something an

Re: how python works

2010-07-30 Thread Burton Samograd
resulting compiled code. If the compilation is successful, it will then run the code, where you might have run-time errors, which are code with a proper syntax but errors during execution. -- Burton Samograd -- http://mail.python.org/mailman/listinfo/python-list

Re: how python works

2010-07-30 Thread Burton Samograd
Mahmood Naderan writes: > So is it a compiler or interpreter? There's a compiler that compiles python to bytecode which is then interpreted. This saves the interpreter from having to re-parse the code at run time. So, it's an interpreter that compiles the code first. -- Bu

Re: scope of variable

2010-08-20 Thread Burton Samograd
l: >>> def mud(): global dept dept+=1 print dept -- Burton Samograd -- http://mail.python.org/mailman/listinfo/python-list

Re: vpython

2010-08-23 Thread Burton Samograd
kimjeng writes: > On Aug 22, 7:38 am, Anssi Saari wrote: >> kimjeng writes: >> > the thing is i have installed gtkglextmm both from source and via a >> > slackbuilds package script and i still get the same error, >> > help would be a appreciated >> >> You'll just have to check what it is config

Re: naming the main module in embedded Python

2010-09-21 Thread Burton Samograd
ing messages output them rather than the above > default values? Use this rather than execfile: exec compile(code, filename, "exec") You'll have to read the contents of the file into the string 'code' first (unless compile will take a file object, which I'm not sure about). -- Burton Samograd -- http://mail.python.org/mailman/listinfo/python-list

Re: Playing sounds at time indexes

2010-09-23 Thread Burton Samograd
a file and say "Play the section of this file from 10.25 seconds > to 11.73 seconds." Is there a library that makes this easy in Python? You might want to check out this question on StackOverflow: http://stackoverflow.com/questions/108848/python-music-library -- Burton Samograd

Re: Crummy BS Script

2010-10-01 Thread Burton Samograd
flebber writes: > But where is this saving the imported file and under what name? Looks like samples.csv: > f = open('samples.csv', 'w') -- Burton Samograd -- http://mail.python.org/mailman/listinfo/python-list