Andreas Löscher wrote:
import types
import marshal
def a(): pass
...
s=marshal.dumps(a.__code__)
f=types.FunctionType(marshal.loads(s), {})
f
What version of python do you have? If I try your code above I get :
>>> import type
Andrej Mitrovic wrote:
>
>I don't think this license agreement change involves the express
>editions, which are free. Correct me if I'm wrong here?
The license agreement change fixes a problem that was accidentally
introduced by Visual Studio 2008 SP1. The redistributable package that can
be dow
On 16/04/2010 01:39, News123 wrote:
Just having a short question:
I found a code snippet, that fetches windows event logs via a wmi query.
import win32com.client
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectSe
Dave W. wrote:
> I naively thought I could capture output from exec()'ed print
> invocations by (somehow) overriding 'print' globally. But this
> seems not to be possible. Or at least not easy:
Assigning a new function to the global print name affects only print() calls
within your script, not
Jim Byrnes wrote:
I am just
learning Python and am new to Linux so I am probably doing something
to trip myself up. I am trying to run an example GUI program that
fetches a record from a database. All the files are in the same folder.
The program runs but its results vary depending on how I
On 04/16/10 12:17, Dave W. wrote:
>>> I naively thought I could capture output from exec()'ed print
>>> invocations by (somehow) overriding 'print' globally. But this
>>> seems not to be possible.
>
>>
>>old_print = __builtins__.print
>>__builtins__.print = printhook
>>yield
>>_
Hi,
It irks me that I know of no simple cross-platform way to print
colored terminal text from Python.
As I understand it, printing ANSI escape codes (as wrapped nicely by
module termcolor and others) works on Macs and *nix, but only works on
Windows if one has installed the ANSI.SYS device drive
On Apr 16, 10:28 am, Jonathan Hartley wrote:
> Hi,
>
> It irks me that I know of no simple cross-platform way to print
> colored terminal text from Python.
>
> As I understand it, printing ANSI escape codes (as wrapped nicely by
> module termcolor and others) works on Macs and *nix, but only works
> I am trying to serialize a function, class, etc and transfer it, have it
> unserialized and used.
You might want to look at pyro: http://pyro.sourceforge.net/ and also
picloud: http://www.picloud.com/
HTH,
Daniel
--
Psss, psss, put it down! - http://www.cafepress.com/putitdown
--
http://ma
Python 3.1.1 in Windows XP Prof:
def number_from_user( prompt ):
while True:
spec = input( prompt )
try:
return float( spec )
except ValueError:
s = "Sorry, '{}' is not a valid number spec. Try e.g. '3.14'."
print( s.format( spec )
Alf P. Steinbach wrote:
Python 3.1.1 in Windows XP Prof:
def number_from_user( prompt ):
while True:
spec = input( prompt )
try:
return float( spec )
except ValueError:
s = "Sorry, '{}' is not a valid number spec. Try e.g. '3.14'."
On 04/16/10 21:29, MRAB wrote:
> Alf P. Steinbach wrote:
>> I thought I'd report this so I tried it several times more but unable
>> to reproduce: instead of above hang + crash + truncated traceback the
>> complete expected traceback appeared and the program terminated properly.
>>
>> Can anyone re
* MRAB:
Alf P. Steinbach wrote:
Python 3.1.1 in Windows XP Prof:
def number_from_user( prompt ):
while True:
spec = input( prompt )
try:
return float( spec )
except ValueError:
s = "Sorry, '{}' is not a valid number spec. Try e.g.
'3.14'."
On 04/13/10 06:36, Martin v. Loewis wrote:
> Microsoft has just released Visual Studio 2010, along with its free (of
> charge) Express edition. Following a tradition, they are likely to
> withdraw support and availability for VS 2008 Express some time in the
> future.
If only Python could do that,
On 12/04/2010 21:36, Martin v. Loewis wrote:
..
If you are planning to build Python extension modules in the next five
years, I recommend that you obtain a copy of VS Express, just in case
Microsoft removes it from their servers. As mentioned, it's free of
charge. When downloading it for
On 04/16/10 22:09, Robin Becker wrote:
> On 12/04/2010 21:36, Martin v. Loewis wrote:
> ...
>>
>> If you are planning to build Python extension modules in the next five
>> years, I recommend that you obtain a copy of VS Express, just in case
>> Microsoft removes it from their servers. As me
On 04/15/10 02:03, Paul Rubin wrote:
> Raymond Hettinger writes:
>> Not sure what the readability issue is. The phrase "nlargest(2,
>> iterable)" does exactly what it says, finds the 2 largest elements
>> from an iterable. That makes the programmer's intent more clear than
>> the slower, but sem
* Alf P. Steinbach:
* MRAB:
Alf P. Steinbach wrote:
Python 3.1.1 in Windows XP Prof:
def number_from_user( prompt ):
while True:
spec = input( prompt )
try:
return float( spec )
except ValueError:
s = "Sorry, '{}' is not a valid number spec
On Apr 12, 2010, at 16:36 , Martin v. Loewis wrote:
If you are planning to build Python extension modules in the next five
years, I recommend that you obtain a copy of VS Express
Am I missing something here? I have heard this before, but I have
built extension modules many times under windo
Hi all,
Once in a while I happen to stumble on some not expected behaviour of
difflib.SequenceMatcher, in this case I hopefully managed to replicate
it on an illustrative sample text.
Both strings differ in a minimal way, each having one extra character
in a "strategic" position, which seems to mee
* Alf P. Steinbach:
> [About baffling almost not reproducible interpreter crash on Ctrl C]
The error code 0xc417 is some custom one, not a standard Windows code.
Sorry, I was wrong about that, just that the MS ErrLook utility didn't find it.
http://social.msdn.microsoft.com/Forums/en-US
On 04/16/10 02:30, Terry Reedy wrote:
> On 4/15/2010 9:34 AM, Дамјан Георгиевски wrote:
>> I'm writing this as a complete newbie (on the issue), so don't be
>> surprised if it's the stupidest idea ever.
>>
>> I was wondering if there was ever a discusision in the python community
>> on a 'raise-yie
* Alf P. Steinbach:
* Alf P. Steinbach:
> [About baffling almost not reproducible interpreter crash on Ctrl C]
The error code 0xc417 is some custom one, not a standard Windows
code.
Sorry, I was wrong about that, just that the MS ErrLook utility didn't
find it.
http://social.msdn.mi
david jensen wrote:
> Hi all,
>
> I'm trying to find a good way of doing the following:
>
> Each n-tuple in combinations( range( 2 ** m ), n ) has a corresponding
> value n-tuple (call them "scores" for clarity later). I'm currently
> storing them in a dictionary, by doing:
>
>
> res={}
>
On Apr 16, 10:48 am, Mark Hammond wrote:
> On 16/04/2010 2:40 PM, sniffer wrote:
>
> > Thanks Mark,
> > just one question does the explanation given above by you also apply
> > to winxp systems in a domain,
>
> Yeah - IIRC, domain users can't change much of the registry by default,
> primarily a
Ok... I know pretty much how .extend works on a list... basically it
just tacks the second list to the first list... like so:
>>> lista=[1]
>>> listb=[2,3]
>>> lista.extend(listb)
>>> print lista;
[1, 2, 3]
what I'm confused on is why this returns None:
>>> lista=[1]
>>> listb=[2,3]
>>> print li
Suppose you have two file-trees with common sub-directories but
different files that you want to merge together, e.g.
/test/
/test/a/
/test/a/file1
/test2/
/test2/a/
/test2/a/file2
You can easily merge the directories in Linux using the "cp" command:
cp -r test/* test2/
While Python provides s
* Alf P. Steinbach:
Found a another bug discussion with
* same exception,
0xc417 STATUS_INVALID_CRUNTIME_PARAMETER
* same address,
0x78588389
* almost same Python version,
namely Py3,
* almost same context,
namely occurring when program terminates,
at
http://w
Hi Tim,
> The license agreement change fixes a problem that was accidentally introduced
> by Visual Studio 2008 SP1. The redistributable package that can
be downloaded directly from Microsoft (which you would use if you had
the Express Edition) has the right license to begin with. It never had
th
J a écrit :
Ok... I know pretty much how .extend works on a list... basically it
just tacks the second list to the first list... like so:
lista=[1]
listb=[2,3]
lista.extend(listb)
print lista;
[1, 2, 3]
what I'm confused on is why this returns None:
So why the None? Is this because what's
Jim Byrnes wrote:
Dave Angel wrote:
Jim Byrnes wrote:
I am just
learning Python and am new to Linux so I am probably doing something
to trip myself up. I am trying to run an example GUI program that
fetches a record from a database. All the files are in the same folder.
The program runs but it
On 04/16/10 23:41, J wrote:
> Ok... I know pretty much how .extend works on a list... basically it
> just tacks the second list to the first list... like so:
>
lista=[1]
listb=[2,3]
lista.extend(listb)
print lista;
> [1, 2, 3]
>
> what I'm confused on is why this returns None:
On 2010-04-16 07:30 AM, Brian Blais wrote:
On Apr 12, 2010, at 16:36 , Martin v. Loewis wrote:
If you are planning to build Python extension modules in the next five
years, I recommend that you obtain a copy of VS Express
Am I missing something here? I have heard this before, but I have built
On Sat, 2010-04-17 at 00:37 +1000, Lie Ryan wrote:
> On 04/16/10 23:41, J wrote:
> > So, what I'm curious about, is there a list comprehension or other
> > means to reduce that to a single line?
>
> from itertools import chain
> def printout(*info):
> print '\n'.join(map(str, chain(*info)))
>
On 2010-04-16 00:42 AM, Dave W. wrote:
Think I'll start a new post with the subject: "Globally override
built-in print function?"
Don't bother. Replacing sys.stdout is the right thing to do. It
won't interfere with the C++ streams...
-snip-
I'm not so certain. Won't the C++ host app share th
Dear all,
Could “reactive programming” still increase the productivity and joy
of Python programming? I’d like to hear your thoughts on the idea
that object-oriented “programming by formula”, as in a spreadsheet,
would simplify our work, because we would not have to worry about the
sequence of pr
On 2010-04-15 21:17 PM, Dave W. wrote:
I naively thought I could capture output from exec()'ed print
invocations by (somehow) overriding 'print' globally. But this
seems not to be possible.
old_print = __builtins__.print
__builtins__.print = printhook
yield
__builtins__.print
Hi Mark,
On Apr 16, 3:16 am, Mark Hammond wrote:
> On 16/04/2010 7:15 AM,gelonidawrote:
>
> The model used by pywin32 is more "low level" than that exposed by some
> of the MS languages. You probably need something closer to:
>
> class MgrHandlerClass:
> def OnEvent(self, EventID=defaul
In article <4bb92850$0$8827$c3e8...@news.astraweb.com>,
Steven D'Aprano wrote:
>
>Nevertheless, it is a common intuition that the list comp variable should
>*not* be exposed outside of the list comp, and that the for-loop variable
>should. Perhaps it makes no sense, but it is very common -- I'v
On Apr 16, 3:31 am, Tim Roberts wrote:
> Andrej Mitrovic wrote:
>
> >I don't think this license agreement change involves the express
> >editions, which are free. Correct me if I'm wrong here?
>
> The license agreement change fixes a problem that was accidentally
> introduced by Visual Studio 200
>>> Don't bother. Replacing sys.stdout is the right thing to do. It
>>> won't interfere with the C++ streams...
>> I'm not so certain. Won't the C++ host app share the same
>> stdin/stdout/stderr file descriptors with the embedded Python
>> interpreter?
> No. Changing the object that the name sys
>>> old_print = __builtins__.print
>>> __builtins__.print = printhook
>>> yield
>>> __builtins__.print = old_print
>
>> I'm pretty sure this is semantically equivalent to my original
>> code, but I gave it a try anyway.
>
> Not at all. Declaring "global print" then assigning to "pri
On 04/16/10 19:28, Jonathan Hartley wrote:
> I'm playing with ideas of what API to expose. My favourite one is to
> simply embed ANSI codes in the stream to be printed. Then this will
> work as-is on Mac and *nix. To make it work on Windows, printing could
> be done to a file0-like object which wra
On 04/15/10 06:38, pyt...@bdurham.com wrote:
> Alex,
>
>> I do not see anything about redistribution, only installation, unless I am
>> missing something?
>
> I read "installation" to mean the same as "redistribution" in the
> context of this article. Perhaps I'm wrong?
>
Does it makes sense t
On Fri, 2010-04-16 at 09:50 -0700, Dave W. wrote:
> >>> old_print = __builtins__.print
> >>> __builtins__.print = printhook
> >>> yield
> >>> __builtins__.print = old_print
> >
> >> I'm pretty sure this is semantically equivalent to my original
> >> code, but I gave it a try anyway.
Lie,
> Does it makes sense to be able to install a library in other's computer, but
> not redistribute it? Hmm... I'll have to consult a lawyer.
See Tim Robert's response (I can't remember which Python mailing list)
The license agreement change fixes a problem that was accidentally
introduced
Think about using the subprocess module. There are calls made just for
your. Notably (using command pydoc subprrocess.call) :
-
subprocess.call = call(*popenargs, **kwargs)
Run command with arguments. Wait for command to complete, then
return the returncode attribute.
On 04/17/10 03:40, pyt...@bdurham.com wrote:
> Lie,
>
>> Does it makes sense to be able to install a library in other's computer, but
>> not redistribute it? Hmm... I'll have to consult a lawyer.
>
> See Tim Robert's response (I can't remember which Python mailing list)
>
I was responding to A
On Apr 16, 11:18 am, pca wrote:
> Dear all,
>
> Could “reactive programming” still increase the productivity and joy
> of Python programming? I’d like to hear your thoughts on the idea
> that object-oriented “programming by formula”, as in a spreadsheet,
> would simplify our work, because we woul
> While Python provides some helpful methods for moving files and
> directories around (shutil.move, shutil.copytree, etc), none of
> them seem to be able to merge two directories.
-snip-
> Any ideas?
It's not pretty, but you could hack up the original copytree()
source so it ignores errors from t
pca, 16.04.2010 17:18:
> In fact, I have seeded an open-source project, Yoopf, that enables
> programming by formula within Python, with the goal of dramatically
> accelerating the development of the model view in the MVC model.
Looks like the example on the main page would work better with the "a
Brian Blais wrote:
> On Apr 12, 2010, at 16:36 , Martin v. Loewis wrote:
>
>> If you are planning to build Python extension modules in the next five
>> years, I recommend that you obtain a copy of VS Express
>
> Am I missing something here? I have heard this before, but I have built
> extension
On Apr 3, 3:30 am, Alain Ketterlin
wrote:
> Hi all,
>
> I've just spent a few hours debugging code similar to this:
>
> d = dict()
> for r in [1,2,3]:
> d[r] = [r for r in [4,5,6]]
> print d
>
> THe problem is that the "r" in d[r] somehow captures the value of the
> "r" in the list comprehensi
On 4/16/2010 9:50 AM, Alf P. Steinbach wrote:
* Alf P. Steinbach:
Found a another bug discussion with
* same exception,
0xc417 STATUS_INVALID_CRUNTIME_PARAMETER
* same address,
0x78588389
* almost same Python version,
namely Py3,
* almost same context,
namely occurring when program term
I'm packaging up a program with distutils and I've run into problems
trying to get setup.py right. It's not a standalone package; it's a
script plus modules, data files and documentation. I've been over the
distutils documentation but I'm having trouble getting the package_data
and data_files
On 4/16/2010 9:41 AM, J wrote:
Ok... I know pretty much how .extend works on a list... basically it
just tacks the second list to the first list... like so:
lista=[1]
listb=[2,3]
lista.extend(listb)
print lista;
[1, 2, 3]
This shows right here that lista is extended in place. If you are not
On Apr 16, 2010, at 3:12 PM, TomF wrote:
I'm packaging up a program with distutils and I've run into problems
trying to get setup.py right. It's not a standalone package; it's a
script plus modules, data files and documentation. I've been over
the distutils documentation but I'm having t
On Fri, Apr 16, 2010 at 15:16, Terry Reedy wrote:
> On 4/16/2010 9:41 AM, J wrote:
>>
>> Ok... I know pretty much how .extend works on a list... basically it
>> just tacks the second list to the first list... like so:
>>
> lista=[1]
> listb=[2,3]
> lista.extend(listb)
> print lista
Hello,
I want to call a system command (such as uname) that returns a string,
and then store that output in a string variable in my python program.
What is the recommended/most-concise way of doing this?
I could always create a temporary file, call the "subprocess.Popen"
module with the tempora
On Apr 16, 8:28 pm, Stefan Behnel wrote:
> pca, 16.04.2010 17:18:
>
> > In fact, I have seeded an open-source project, Yoopf, that enables
> > programming by formula within Python, with the goal of dramatically
> > accelerating the development of the model view in the MVC model.
>
> Looks like the
You can find more information on this project at www.yoopf.org. Your
comments are more than welcome!
Is this something similar to trellis?
http://pypi.python.org/pypi/Trellis
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-04-16 14:06 PM, Catherine Moroney wrote:
Hello,
I want to call a system command (such as uname) that returns a string,
and then store that output in a string variable in my python program.
What is the recommended/most-concise way of doing this?
I could always create a temporary file, c
Robert Kern wrote:
On 2010-04-16 14:06 PM, Catherine Moroney wrote:
Hello,
I want to call a system command (such as uname) that returns a string,
and then store that output in a string variable in my python program.
What is the recommended/most-concise way of doing this?
I could always create
http://jrvarma.wordpress.com/2010/04/16/the-sec-and-the-python/
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Apr 16, 2010 at 3:01 PM, Mike Kent wrote:
> SEC apparently about to mandate Python for a particular financial use
> http://jrvarma.wordpress.com/2010/04/16/the-sec-and-the-python/
See thread from 5 days ago:
http://mail.python.org/pipermail/python-list/2010-April/1241578.html
Cheers,
Chr
>> Python 2.6, 2.7, and 3.1 are all built with that release (i.e. 2008).
>> Because of another long tradition, Python extension modules must be
>> built with the same compiler version (more specifically, CRT version) as
>> Python itself. So to build extension modules for any of these releases,
>> y
> 1. What Python license text/copyright text should I place in our
> printed user manual?
>
> 2. What Python license text/copyright text should I include in
> our online documentation?
>
> 3. What Python license text/copyright text should I include in
> product's license text file?
>
> 4. What P
En Thu, 15 Apr 2010 16:37:37 -0300, gert escribió:
[a wget -r like implementation in python3]
So I can make a recursive http download script
What about calling wget itself? subprocess.call(['wget',...])
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list
"technology as a regulatory tool", what a concept! Pretty impressive
change we can believe in. Here's hoping open-source human-readable
computer programs become the standard for verifiable elections and all
sorts of financial uses. Otherwise, computers will end up being used
to defraud the populace
On Fri, 16 Apr 2010 08:48:03 -0700, Aahz wrote:
> In article <4bb92850$0$8827$c3e8...@news.astraweb.com>, Steven D'Aprano
> wrote:
>>
>>Nevertheless, it is a common intuition that the list comp variable
>>should *not* be exposed outside of the list comp, and that the for-loop
>>variable should.
On Fri, Apr 16, 2010 at 5:20 PM, Steven D'Aprano
wrote:
> On Fri, 16 Apr 2010 08:48:03 -0700, Aahz wrote:
>> In article <4bb92850$0$8827$c3e8...@news.astraweb.com>, Steven D'Aprano
>> wrote:
>>>Nevertheless, it is a common intuition that the list comp variable
>>>should *not* be exposed outside o
Steven D'Aprano wrote:
On Fri, 16 Apr 2010 08:48:03 -0700, Aahz wrote:
In article <4bb92850$0$8827$c3e8...@news.astraweb.com>, Steven D'Aprano
wrote:
Nevertheless, it is a common intuition that the list comp variable
should *not* be exposed outside of the list comp, and that the for-loop
vari
* Steven D'Aprano:
On Fri, 16 Apr 2010 08:48:03 -0700, Aahz wrote:
In article <4bb92850$0$8827$c3e8...@news.astraweb.com>, Steven D'Aprano
wrote:
Nevertheless, it is a common intuition that the list comp variable
should *not* be exposed outside of the list comp, and that the for-loop
variable
Catherine Moroney wrote:
Hello,
I want to call a system command (such as uname) that returns a string,
and then store that output in a string variable in my python program.
What is the recommended/most-concise way of doing this?
I could always create a temporary file, call the "subprocess.Pope
Link: http://www.petitiononline.com/mwwabuse/petition.html (as
reported by Elise Mooney from Channel 9)
I wish to raise this topic of Rob and Kim Hyde and their experience
they stated publicly on Channel Nine's A Current Affair. Now they are
caring loving parents, and for them to even THINK about
pca, 16.04.2010 22:02:
On Apr 16, 8:28 pm, Stefan Behnel wrote:
pca, 16.04.2010 17:18:
In fact, I have seeded an open-source project, Yoopf, that enables
programming by formula within Python, with the goal of dramatically
accelerating the development of the model view in the MVC model.
Looks
Steven D'Aprano wrote:
On Wed, 14 Apr 2010 22:10:28 +0200, Hans Mulder wrote:
Anybody who invents another brace-delimited language should be beaten.
You always end up with a big problem trying to make sure the braces are
consistent with the program logic.
Anybody who invents another programm
> Catherine Moroney wrote:
>> Hello,
>>
>> I want to call a system command (such as uname) that returns a string,
>> and then store that output in a string variable in my python program.
>>
>> What is the recommended/most-concise way of doing this?
>>
>> I could always create a temporary file, c
78 matches
Mail list logo