Phlip writes:
> Not Hyp:
I don't know what this means; I hope it's not important.
> def _scrunch(**dict):
You're clobbering the built-in ‘dict’ binding here.
You're also requiring the input to be keyword parameters. Why not simply
take a single parameter, and allow the *caller* to decide if t
On Wed, Oct 20, 2010 at 9:40 PM, Paul Rubin wrote:
> Phlip writes:
>> def _scrunch(**dict):
>> result = {}
>>
>> for key, value in dict.items():
>> if value is not None: result[key] = value
>>
>> return result
>>
>> That says "throw away every item in a dict if the Value is N
On Thu, Oct 21, 2010 at 2:32 PM, Phlip wrote:
> Not Hyp:
>
> def _scrunch(**dict):
> result = {}
>
> for key, value in dict.items():
> if value is not None: result[key] = value
>
> return result
>
> That says "throw away every item in a dict if the Value is None".
>
> Are there an
Phlip writes:
> def _scrunch(**dict):
> result = {}
>
> for key, value in dict.items():
> if value is not None: result[key] = value
>
> return result
>
> That says "throw away every item in a dict if the Value is None".
> Are there any tighter or smarmier ways to do that? Pyth
Not Hyp:
def _scrunch(**dict):
result = {}
for key, value in dict.items():
if value is not None: result[key] = value
return result
That says "throw away every item in a dict if the Value is None".
Are there any tighter or smarmier ways to do that? Python does so
often mana
On 2010-10-21, James Mills wrote:
> On Thu, Oct 21, 2010 at 6:17 AM, Richard Gibbs
> wrote:
>> If my python script is called with stdout (or stdin or stderr) redirected to
>> a file, how can I find the filename under Linux??? Under Windows?
>
> I don't believe there is a way to do this.
There is,
On Thu, Oct 21, 2010 at 6:17 AM, Richard Gibbs
wrote:
> If my python script is called with stdout (or stdin or stderr) redirected to
> a file, how can I find the filename under Linux? Under Windows?
I don't believe there is a way to do this.
The shell normally takes care of pipes.
When you do:
If my python script is called with stdout (or stdin or stderr) redirected to
a file, how can I find the filename under Linux? Under Windows?
Thanks,
RG
--
http://mail.python.org/mailman/listinfo/python-list
In message , kj wrote:
> I tried to fix the problem by applying the equivalent of "stty
> -echo" within a python interactive session, but discovered that
> this setting is immediately (and silently) overwritten.
That seems reasonable behaviour; the command loop is resetting the terminal
to a rea
> [b.pop(0)]
>
> This has to lookup the global b, resize it, create a new list,
> concatenate it with the list x (which creates a new list, not an in-place
> concatenation) and return that. The amount of work is non-trivial, and I
> don't think that 3us is unreasonable.
>
I forgot to take acc
On Oct 20, 8:32 pm, Justin Ezequiel
wrote:
> On Oct 20, 12:47 am, Johannes Bauer wrote:
>
>
>
> > >>> from urllib import request; request.URLopener().open("http://google.de";)
>
> aren't you supposed to call read on the return value of open?
> i.e.,
> .read()
better yet,
f = request.URLopener().
On Wed, 20 Oct 2010 14:32:53 -0700, Daniel Wagner wrote:
> I really appreciate your solutions but they bring me to a new question:
> Why is my solution so inefficient? The same operation without the
> list/tuple conversion
>
> $ python /[long_path]/timeit.py 'a=[[1,2,3], [4,5,6]];b=[7,8];map(lamb
On 20/10/2010 21:20, Todd Walter wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello,
When transmitting via UDP to a PLC, I run into a strange problem
where socket.sendto returns double the number of characters sent in the
datagram. I thought this was an error and used Wireshark to snif
On Oct 20, 11:38 am, gb345 wrote:
> I have a handy Python script, which takes a few command-line
> arguments, and accepts a few options. I developed it on Unix, with
> very much of a Unix-mindset. Some Windows-using colleagues have
> asked me to make the script "easy to use under Windows 7". I.
I'm trying to get my application to scan, create a .pdf, and then save
it in a patient's folder. I found python-imaging-sane but I can't get
things to work correctly. Here is what's happening at the command
prompt:
import sane
sane.init()
(16777235, 1, 0, 19)
print sane.get_devices()
[('canondr:
Seebs writes:
> Interesting point. Which is really easier to read:
>
> x, y, z = p.nextpoint()
>
> xCoordinate, yCoordinate, zCoordinate = polygon.nextPointCoordinates()
The latter uses camelCase, so it's horrible right out of the gate :-)
--
\ “The cost of education is
Hi!
I was following the documentation about distutils [1] in order to install my
application in a python-way. But installing it in /usr/local (following the
official doc [2] too) with
$ sudo python setup.py install --prefix=/usr/local
The data files are created inside the python package, in
/usr
Many thanks for all these suggestions! here is a short proof that you
guys are absolutely right and my solution is pretty inefficient.
One of your ways:
$ python /[long_path]/timeit.py 'a=[(1,2,3),(4,5,6)];b=(7,8);[x+(y,)
for x,y in zip(a,b)]'
100 loops, best of 3: 1.44 usec per loop
And my
Neal Becker wrote:
> Has behavior of exception thrown during module initialization changed with
> python3?
>
> using boost::python, throwing a c++ exception in module initialization, I
> get:
>
> SystemError: initialization of ldpc_45 raised unreported exception
>
> I exepected to see the strin
On 2010-10-20, Matteo Landi wrote:
> Another situation in which I needed to disable such kind of warnings
> is while working with graphics modules.
> I often use variable names such as x, y, z for coordinates, or r,g,b for
> colors.
> Would longer names make the reader's life easier?
Interesting
When StreamHandler writes a formatted log message to its stream, it
adds a newline terminator. This behaviour is inherited by FileHandler
and the other classes which derive from it (such as the rotating file
handlers).
For most people, that’s what they want, since they get log messages on
separate
Another situation in which I needed to disable such kind of warnings
is while working with graphics modules.
I often use variable names such as x, y, z for coordinates, or r,g,b for colors.
Would longer names make the reader's life easier?
Best regards,
Matteo
On Wed, Oct 20, 2010 at 9:37 PM, Ste
On 2010-10-20, Urpo T. Koira wrote:
> On 2010-10-20, Grant Edwards wrote:
>> On 2010-10-20, Shawn Milochik wrote:
>>
>>> Write a small GUI in the easy-to-use and cross-platform wxPython
>>> module. All this GUI needs to do is allow them to input the
>>> arguments. The code can then import your s
On 2010-10-20, Grant Edwards wrote:
> On 2010-10-20, Shawn Milochik wrote:
>
>> Write a small GUI in the easy-to-use and cross-platform wxPython
>> module. All this GUI needs to do is allow them to input the
>> arguments. The code can then import your stand-alone version of the
>> script and exec
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello,
When transmitting via UDP to a PLC, I run into a strange problem
where socket.sendto returns double the number of characters sent in the
datagram. I thought this was an error and used Wireshark to sniff the
connection and discovered that it di
On Wed, 20 Oct 2010 12:47:02 +0200, Jean-Michel Pichavant wrote:
> except ValueError, e:
>
> Use meaningful names, this is so important. 'e' is not meaningful.
> 'exception' would be slighly better.
While I agree with everything else you had to say, I have to take
exception to this comment [pun
On Tue, 19 Oct 2010 11:21:49 -0700, jslow...@gmail.com wrote:
> Actually, if it was possible, it would be nice to capture all
> the bytes going between stdin and stdout in a file as well for
> debugging purposes.
If the child process expects to be running on a terminal, you would need
to use a ps
On 2010-10-20, Shawn Milochik wrote:
>
> On Oct 20, 2010, at 2:00 PM, Grant Edwards wrote:
>
>> On 2010-10-20, Shawn Milochik wrote:
>> ript and execute its code, passing the arguments in.
>>
>>> wxPython is just Python.
>>
>> No, it's not.
>>
>> You can't assume that any windows machine with
On 18 Oct 2010 22:29:27 GMT Steven D'Aprano
wrote:
> On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote:
>
> > Also, Python's scoping rules, particularly for class-level scopes,
> > don't work the way programmers from languages where nested classes
> > are common would expect:
> [snip exampl
On Oct 20, 2010, at 2:00 PM, Grant Edwards wrote:
> On 2010-10-20, Shawn Milochik wrote:
> ript and execute its code, passing the arguments in.
>
>> wxPython is just Python.
>
> No, it's not.
>
> You can't assume that any windows machine with Python installed also
> has wxPython installed. T
Jerry,
> It sounds like you are describing the "Aero Snap" feature in Windows 7.
Bingo! You hit the nail and the head.
Thank you very much!
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-10-20, Shawn Milochik wrote:
> Write a small GUI in the easy-to-use and cross-platform wxPython
> module. All this GUI needs to do is allow them to input the
> arguments. The code can then import your stand-alone version of the
> script and execute its code, passing the arguments in.
> w
On 2010-10-20, Jean-Michel Pichavant wrote:
> except ValueError, e:
> Use meaningful names, this is so important.
It's important, but meaning can come from idiom, not from the word used.
> 'e' is not meaningful.
Sure it is. It's like i for a loop index.
There's a reason mathematicians use x
Write a small GUI in the easy-to-use and cross-platform wxPython module. All
this GUI needs to do is allow them to input the arguments. The code can then
import your stand-alone version of the script and execute its code, passing the
arguments in.
wxPython is just Python.
--
http://mail.python
On Wed, Oct 20, 2010 at 11:32 AM, wrote:
> Python 2.6/2.7 (32-bit) for Windows: When I drag a Tkinter root window to
> the left, upper, or right edge of my display ... as soon as my mouse cursor
> hits the visible edge of the display ... as if I'm trying to dock the window
> on the edge in questi
I have a handy Python script, which takes a few command-line
arguments, and accepts a few options. I developed it on Unix, with
very much of a Unix-mindset. Some Windows-using colleagues have
asked me to make the script "easy to use under Windows 7". I.e.:
no command-line.
Therefore, I want
On Oct 20, 9:01 am, John Henry wrote:
> On Oct 20, 1:41 am, Tim Golden wrote:
>
>
>
> > On 19/10/2010 22:48, John Henry wrote:
>
> > > Looks like this flag is valid only if you are getting messages
> > > directly from Outlook. When reading the msg file, the flag is
> > > invalid.
>
> > > Same is
This post is a continuation of an earlier thread called
annoying CL echo in interactive python / ipython
I found some more clues to the problem, although no solution yet.
First, I found a post from 2009.05.09 that describes exactly the
same situation I've observed (although it got no responses
On Oct 20, 1:41 am, Tim Golden wrote:
> On 19/10/2010 22:48, John Henry wrote:
>
> > Looks like this flag is valid only if you are getting messages
> > directly from Outlook. When reading the msg file, the flag is
> > invalid.
>
> > Same issue when accessing attachments. In addition, the MAPITab
Lucasm writes:
> Thanks for the answers. I would like to override the property though
> without making special modifications in the main class beforehand. Is
> this possible?
That will not be easy. When you access obj.return_five, python looks up
'return_five' in type(obj) to see what the retur
Python 2.6/2.7 (32-bit) for Windows: When I drag a Tkinter root
window to the left, upper, or right edge of my display ... as
soon as my mouse cursor hits the visible edge of the display ...
as if I'm trying to dock the window on the edge in question ... a
giant phantom Tkinter window pops up under
On Fri, 15 Oct 2010 15:28:10 -0400, Adam Tauno Williams wrote:
> I've found the module pkipplib which seems to work well for things like
> interrogating an IPP (CUPS) server. But is there a way to send a print
> job to an IPP print queue? [and no, the local system knows nothing about
> the print
On 10/20/2010 9:59 AM, Lucasm wrote:
Thanks for the answers. I would like to override the property though
without making special modifications in the main class beforehand. Is
this possible?
Take a look at http://docs.python.org/reference/datamodel.html#descriptors
The last paragraph of Sec
On 20 Okt, 16:09, Peter Otten <__pete...@web.de> wrote:
> Lucasm wrote:
> > On 19 Okt, 18:28, Steven D'Aprano > cybersource.com.au> wrote:
> >> On Tue, 19 Oct 2010 06:39:56 -0700, Lucasm wrote:
> >> > Hi,
>
> >> > A question. Is it possible to dynamically override a property?
>
> >> > class A(obje
Lucasm wrote:
> On 19 Okt, 18:28, Steven D'Aprano cybersource.com.au> wrote:
>> On Tue, 19 Oct 2010 06:39:56 -0700, Lucasm wrote:
>> > Hi,
>>
>> > A question. Is it possible to dynamically override a property?
>>
>> > class A(object):
>> > @property
>> > def return_five(self):
>> > return 5
>>
>>
In Jed Smith
writes:
>On Tue, Oct 19, 2010 at 2:35 PM, kj wrote:
>> In Jed Smith smith.org> writes:
>>
>>>On Tue, Oct 19, 2010 at 1:37 PM, kj wrote:
>>
% stty -echo
>>
>>>That doesn't do what you think it does.
>>
>> Gee, thanks. =A0That really helped. =A0I'll go talk to my guru now,
>>
On 19 Okt, 18:28, Steven D'Aprano wrote:
> On Tue, 19 Oct 2010 06:39:56 -0700, Lucasm wrote:
> > Hi,
>
> > A question. Is it possible to dynamically override a property?
>
> > class A(object):
> > @property
> > def return_five(self):
> > return 5
>
> > I would like to override the
On 19 Okt, 16:07, Benjamin Peterson wrote:
> Lucasm gmail.com> writes:
>
> > I would like to override the property for an instance of A to say the
> > string 'bla'.
>
> A.return_five = "blah"
I guess you did not test that. :)
--
http://mail.python.org/mailman/listinfo/python-list
Has behavior of exception thrown during module initialization changed with
python3?
using boost::python, throwing a c++ exception in module initialization, I
get:
SystemError: initialization of ldpc_45 raised unreported exception
I exepected to see the string associated with exception, which g
Tobiah wrote:
> I've been reading about the Unicode today.
> I'm only vaguely understanding what it is
> and how it works.
>
> Please correct my understanding where it is lacking.
> Unicode is really just a database of character information
> such as the name, unicode section, possible
> numeric
On Oct 20, 12:47 am, Johannes Bauer wrote:
>
> >>> from urllib import request; request.URLopener().open("http://google.de";)
>
aren't you supposed to call read on the return value of open?
i.e.,
request.URLopener().open("http://google.de";).read()
--
http://mail.python.org/mailman/listinfo/pytho
Am 20.10.2010 14:07, schrieb Xah Lee:
On Oct 20, 4:52 am, Marc Mientki wrote:
Am 20.10.2010 13:14, schrieb Xah Lee:
See also:
• 〈The Importance of Terminology's Quality In Computer Languages〉
http://xahlee.org/UnixResource_dir/writ/naming_functions.html
where i gave some examples of the
On Oct 20, 4:52 am, Marc Mientki wrote:
> Am 20.10.2010 13:14, schrieb Xah Lee:
>
> > See also:
>
> > • 〈The Importance of Terminology's Quality In Computer Languages〉
> >http://xahlee.org/UnixResource_dir/writ/naming_functions.html
>
> > where i gave some examples of the naming.
>
> "I'd like
Am 20.10.2010 13:14, schrieb Xah Lee:
See also:
• 〈The Importance of Terminology's Quality In Computer Languages〉
http://xahlee.org/UnixResource_dir/writ/naming_functions.html
where i gave some examples of the naming.
Xah ∑ http://xahlee.org/ ☄
"I'd like to introduce a blog post by Step
Johannes Bauer wrote:
> Hi,
>
> I've experienced the following behavior with Python3 of which I do not
> know if it's a bug or not. On two Python3.1 implementations, Python's
> urllib hangs when encountering a HTTP 301 (Redirect).
>
> The code to reproduce is a one-liner (actually, two-liner), P
Hi Tim,
Thanks a lot.
I'll look into it.
On 10/19/2010 11:30 AM, Tim Golden wrote:
> On 19/10/2010 10:06, Gelonida wrote:
>> I'd like to be notified about certain events and call certain python
>> functions depending on the event.
>>
>> call a function:
>> - before (or after) the screen saver ki
A great piece about terminology in computer languages.
* 〈The Poetry of Function Naming〉 (2010-10-18) By Stephen Wolfram.
At: http://blog.stephenwolfram.com/2010/10/the-poetry-of-function-naming/
See also:
• 〈The Importance of Terminology's Quality In Computer Languages〉
http://xahlee.org/Un
On Oct 20, 12:25 pm, Jonathan Hartley wrote:
> On Oct 18, 8:28 am, dex wrote:
>
>
>
>
>
> > I'm building a turn based RPG game as a hobby. The design is becoming
> > increasingly complicated and confusing, and I think I may have
> > tendency to over-engineer simple things. Can anybody please chec
Seebs wrote:
On 2010-10-19, Martin P. Hellwig wrote:
Speaking without context here, so take it with as much salt as required
;-), it is not that unusual. However there are some things to consider,
for example are all these attributes related to each other? If so
wouldn't it be more pythoni
On Oct 20, 11:25 am, Jonathan Hartley wrote:
> On Oct 18, 8:28 am, dex wrote:
>
>
>
> > I'm building a turn based RPG game as a hobby. The design is becoming
> > increasingly complicated and confusing, and I think I may have
> > tendency to over-engineer simple things. Can anybody please check my
On Oct 18, 8:28 am, dex wrote:
> I'm building a turn based RPG game as a hobby. The design is becoming
> increasingly complicated and confusing, and I think I may have
> tendency to over-engineer simple things. Can anybody please check my
> problems-solutions and point me to more elegant solution?
dwhall, 18.10.2010 15:15:
Python-on-a-Chip
Featuring the PyMite VM
===
[...]
Python-on-a-Chip (p14p) is a project to develop a reduced Python
virtual machine (codenamed PyMite) that runs a significant subset
of the Python language on microcontrollers without an OS.
Do you ha
On 19/10/2010 22:48, John Henry wrote:
Looks like this flag is valid only if you are getting messages
directly from Outlook. When reading the msg file, the flag is
invalid.
Same issue when accessing attachments. In addition, the MAPITable
method does not seem to work at all when trying to get
Daniel Wagner wrote:
> Hello Everyone,
>
> I'm new in this group and I hope it is ok to directly ask a question.
>
> My short question: I'm searching for a nice way to merge a list of
> tuples with another tuple or list. Short example:
> a = [(1,2,3), (4,5,6)]
> b = (7,8)
>
> After the merging
Python disables MSCRT assertions for debug mode in the initialization
of exceptions module. Does anyone know why?
--
http://mail.python.org/mailman/listinfo/python-list
>On Wed, Oct 20, 2010 at 1:33 PM, Daniel Wagner
> wrote:
>> Any more efficient ways or suggestions are still welcome!
In article
James Mills wrote:
>Did you not see Paul Rubin's solution:
>
[x+(y,) for x,y in zip(a,b)]
> [(1, 2, 3, 7), (4, 5, 6, 8)]
>
>I think this is much nicer and probab
On Oct 19, 6:54 pm, Dennis Lee Bieber wrote:
> On Tue, 19 Oct 2010 01:19:48 -0700 (PDT), dex
> declaimed the following in gmane.comp.python.general:
>
>
>
> > OK, imagine a MUD, where players can "dig out" new rooms. Room A has a
> > door that holds reference to newly created room B. By "using" a
On Oct 19, 8:08 pm, Carl Banks wrote:
> On Oct 19, 1:19 am, dex wrote:
>
>
>
>
>
> > > I'm not sure if it's a good idea to let an item disappear from your
> > > inventory by a weak reference disappearing. It seems a little shaky
> > > to not know where your objects are being referenced, but that
68 matches
Mail list logo