duck-like class offering Dict like methods, other?
I'm also looking for some hints on what magic methods I should
override to accomplish my goal, eg. beyond __getitem__.
Thank you,
Malcolm
--
https://mail.python.org/mailman/listinfo/python-list
After some additional research, it looks like I may have even
more options to consider including using a UserDict mixin.
I think I've identified another magic method to subclass ...
__missing__.
- Original message -
From: [1]pyt...@bdurham.com
To: [2]python-list@pytho
Hi Chris,
> Sounds like you want to subclass dict, then. Something like this:
Nice!!!
I need to study your solution, but at first blush it looks exactly like
what I wanted to implement.
Thank you!
Malcolm
--
https://mail.python.org/mailman/listinfo/python-list
titem__ will
not be called by other dict methods that would normally call this magic
method and instead call the parent's __getitem__ directly (via super()
or something similar?)?
Is this specific to the native Dict class (because its implemented in C
vs. Python?) or is this behavior more genera
Ethan,
>> Is this specific to the native Dict class (because its implemented in C vs.
>> Python?) or is this behavior more general.
> I /think/ it's only dict, but I haven't played with subclassing lists,
> tuples, etc. It's not a C vs Python issue, but a
object
being acted on. PEP-8 doesn't appear to offer guidance in this
area. Thoughts? Malcolm
--
https://mail.python.org/mailman/listinfo/python-list
reads from
outside a thread itself.
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for everyone's comments - much appreciated!
Malcolm (the OP)
--
http://mail.python.org/mailman/listinfo/python-list
Hi Matt,
Enjoyed your list options :)
I'm a consultant and have to do what your subject line asks at
most clients I work at.
Here's the technique I recommend:
Install Python for the ***current user*** on another workstation
with the appropriate priviledges. Then xcopy this Python f
I have used pyWin for several years now with out issue. I recently
installed build 216 for python 2.7 on windows XP pro. The program
crashes every time I exit a wxPython program and has crashed a few
other times. I does not seem that pyWin has been updated since
February of this year. Is
Check out ResolverOne
http://www.resolversystems.com
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
We're thinking about using virtualenv to isolate our development
enivronments.
Are there any tradeoffs or cautions we should consider before
going this route?
Are there other alternatives to virtualenv that we should
consider?
We are using Python 2.7 (32-bit) on Windows 7 Professiona
Looking for feedback from anyone who has tried or is using
ActiveState Stackato, PiCloud or other Python orientated
SaaS/PaaS offerings?
Pros, cons, advice, lessons learned?
Thank you,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Wondering if there's a fast/efficient built-in way to determine
if a string has non-ASCII chars outside the range ASCII 32-127,
CR, LF, or Tab?
I know I can look at the chars of a string individually and
compare them against a set of legal chars using standard Python
code (and this works
Looking for some tips on getting started with Cython development
under Windows. I am using Python 2.7.2.
After reading the Cython documentation [1] it appears that one
has a choice of using either the MinGW or MS Visual C compiler.
1. Are there any issues associated with using the MinGW compiler
Lie,
> And of course, I can't believe you forget Guido's favourite version, g"",
> available in musical and sirloin cloth flavor.
LMAO! That was brilliant! :)
Cheers!
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
A good tool for determining whether a site is down or just unavailable
to you:
http://downorisitjustme.com
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
all last):
File "tv.py", line 7, in
print "1group is ",Match.group(1),"2group is ",Match.group(2),"3group is
",Match.group(3)
AttributeError: 'NoneType' object has no attribute 'group'
how to revise my code to get the output? --
http://mail.python.org/mailman/listinfo/python-list
th 2group is
香港电台普通话台(可于Totem/VLC/MPlayer播放) 3group is None
1group is http://202.177.192.119/radio31 2group is
香港电台普通话台(DAB版,可于Totem/VLC/MPlayer播放) 3group is None
1group is octoshape:rthk.ch1 2group is 香港电台第一台(粤) 3group is None
1group is octoshape:rthk.ch2 2group is 香港电台第二台(粤) 3group
ss="down s-fc3 f-fl"]//a')
that is to say ,
urllist=root.xpath('//div[@class="col f-cb"]//div[@class="down s-fc3
f-fl"]//a')
why i can't get nothing? --
http://mail.python.org/mailman/listinfo/python-list
s the flaw in this code?
it is so strange that the shorter one can work,the longer one can not,they have
the same xpath structure!--
http://mail.python.org/mailman/listinfo/python-list
To BJörn Lindqvist :
thank you . how to write the code specifically ?Could you give a
example?
--
http://mail.python.org/mailman/listinfo/python-list
To BJörn Lindqvist :
thank you . how to write the code specifically ?Could you give an
example?
--
http://mail.python.org/mailman/listinfo/python-list
,'c','d']
def method2():
list2=list1
list2.remove['a']
main():
global list1
method1()
method2()
print list1[0]
it prints 'b'.
How could I keep the list1 not to change when remove list2's elements?
--
http://mail.python.org/mailman/listinfo/python-list
in python , could I accomplish the purpose that "a=Console.read()" used
in C?
when program is running, I wanna add a statement like
"a=Console.read()" in C language,it will wait for user's input, after
user's typing a character , and click "enter" key, t
I installed it, but can't find py2exe.exe in my computer. why?
And , when I execute "python setup.py py2exe" under command line, it
prompt error:wrong command "py2exe" .
--
http://mail.python.org/mailman/listinfo/python-list
it prompt: invalid command 'py2exe'.
I have import py2exe in setup.py file.
--
http://mail.python.org/mailman/listinfo/python-list
I have new a list , when it hava large number of values, I wonna to
delete all the values in it,how to do?
And, if a list have 801 values, I want to get its values index from 300
to 400, could use list1[300:400],are right me?
--
http://mail.python.org/mailman/listinfo/python-list
rned=[]
for i in threadList:
linkReturned=i.start()
for j in linkReturned:
links.append(j)
--
http://mail.python.org/mailman/listinfo/python-list
On 15 mrt 2008, at 23:06, Mike Driscoll wrote:
> On Mar 15, 3:09 pm, Eric von Horst <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I am looking for Python modules that allow you to manipulate 3D
>> objects, more specifically Alias Wavefront .OBJ objects.
>>
e tuple?
>>> myTuple = ( 4, 7 )
Thanks!
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
[ myTuple[ 0 ]:
myTuple[ 1 ] ) millions of times in a loop.
Thank you!
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
g.
I'm going to try Ben's slice() object suggestion.
Thanks for your help,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
(to echo another recent thread in this forum)
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
signed for doing multiple field extractions at
once.
Thank you,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
the process of being
updated - I only want to download new/updated files after they've
been closed on the remote site.
Any ideas appreciated!
Thanks,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
> Well, the ftpmirror will cope with most of what you want to do as it is, but
> I am unsure how you can determine whether a file is in the process
of being written on the server.
Looks like that may be a fit. Thank you Steve!
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
difference and report back to the
list.
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
might improve
performance by reducing the number of reads. Instead I observed
just the opposite - performance was 7x slower! (~500 sec vs. 70
sec) and used 3x the memory (24M vs. 8M) due to the larger
buffer.
The following tests were run on a Windows XP system using Python
2.6.1
SOURCE:
import
--- 7x slower
Any comments regarding this massive slowdown?
Thanks,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
://mail.python.org/mailman/listinfo/python-list
If the output is coming from a print command, couldn't the OP
temporarily redirect STDIO to a file to prevent the output from being
displayed?
Malcolm
- Original message -
From: "Stephen Hansen"
To: "Ray"
Cc: python-list@python.org
Date: Sun, 1 Feb 2009 2
> This is a fantastically didactic newsgroup: you start off just musing about
> , you end up learning python has ,
> brilliant :-)
+1 !!
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Can someone explain the difference between vars() and locals()?
I'm also trying to figure out what the use case is for vars(),
eg. when does it make sense to use vars() in a program?
Thank you,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Thank you Gabriel!
Malcolm
- Original message -
From: "Gabriel Genellina"
To: python-list@python.org
Date: Wed, 11 Feb 2009 02:04:47 -0200
Subject: Re: Difference between vars() and locals() and use case for
vars()
En Wed, 11 Feb 2009 01:38:49 -0200, escribió:
> Can so
Richard,
An excellent tool. Great job!!!
Thank you for sharing this with the Python community.
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Tim,
> FWIW, I usually generate PDFs by printing to a Postscript printer (some
> random Apple Laserthingy) and then using Ghostscript to do the conversion.
> I'm happy to post if you're interested.
If its not too much bother, I would be interested in learning how you'
Tim,
> http://pastebin.com/m461bf8f2
Wonderful! That's enough to get me started. Thank you very much.
Cheers,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
#x27; % \
( test.strip(), isnumber( test ) )
--
http://mail.python.org/mailman/listinfo/python-list
27; ):
print 'test (%0s), isnumber: %1s' % ( test.strip(), isnumber(
test ) )
--
http://mail.python.org/mailman/listinfo/python-list
semantics, but I don't know why I would prefer the try/else
technique over the simpler:
try:
float( input )
return True
except ValueError:
return False
Thank you for your feedback,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
rd or 'u' in word or
... :
-OR-
# flexible, but no short circuit on first match
if [ char for char in word if char in 'aeiouAEIOU' ]:
-OR-
# flexible, but no short circuit on first match
if set( word ).intersection( 'aeiouAEIOU' ):
Thank you,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
back,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
s all numbers once they've been parsed, so I don't
believe this will be a problem for me.
However, I appreciate you pointing out this behavior because I was
unaware of this subtle nuance. I'll make sure to add this to our code
review checklist.
Thanks for your feedback,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Cheers,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
On 16 feb 2009, at 14:45, www.livtotravel.blogspot.com wrote:
is phyton a programming language? what can a python do? how is it
different from others?
--
If i were to replace 'python' with 'french'
would you be willing to write the answer in one email?
it's gonna be
forum.
Regards,
Malcolm
In article <01aaa1da$0$20629$c3e8...@news.astraweb.com>,
Steven D'Aprano wrote:
> Okay, but that surely falls under chapter 18 of the "Advanced Python
> Programming for the Mars Rover" book rather than chapter 5 of "Newbies
> Guide to Python&qu
of locale
codes for Windows XP (or better yet, all versions of Windows XP
or later)?
Thank you,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Gabriel,
> Are you looking for this?
> http://msdn.microsoft.com/en-us/library/hzz3tw78(VS.80).aspx
Yes! Wonderful!
Thank you,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
I've read the latest official locale documentation[1], googled
for additional resources, and have the following questions:
1. Does the following warning still apply to recent releases of
Python (and if so, is this a Python issue, a generic C runtime
issue, or a platform specific C runtime
Are there best practice recommendations for upgrading the version
of SQLite that comes bundled with versions of Python 2.5 and
later?
We're running Python 2.6.1 on Windows and Linux and using the
default version of SQLite that ship with this release.
Today, a new version of SQLite 3.6.1
Gabriel,
> At least on Windows, you only have to replace sqlite3.dll (in the DLLs
> directory) with the new one, and that's all.
That's easy! :)
Thank you,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Is there a formula for determining the approximate size of a dictionary
(minus its data) under 32 and 64 bit Python with a specific average key
size?
For instance, if we were running a 64-bit version of Python and created
a dictionary of 1 million items with an average key length of 48 bytes,
is
Steven,
Wonderful! You and your references answered all my questions.
I had missed 2.6's new getsizeof() function. Yet another reason to do
the 2.5-to-2.6 upgrade.
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Is there any way to determine the number of dictionary key
collisions in a specific dictionary?
Background: I'm working on a project using very large
dictionaries (64 bit Python) and question from my client is how
effective is Python's default hash technique for our data set?
Their
Is there a cross-platform way to launch multiple Python processes
and monitor CPU usage and disk i/o so that the maximum number of
independent processes can be running at all times without
overloading their environment? By process I mean independent
application sessions vs. multiple threads of a
Binns" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Tue, 02 Dec 2008 19:29:05 -0800
Subject: Re: Determining number of dict key collisions in a dictionary
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
[EMAIL PROTECTED] wrote:
> Any ideas on why the Windows 64-bit version of Python
eciated.
Thank you,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
I'm working with some very large dictionaries (about 25M items
per dictionary) that get filled based on data parsed from text
based log files. I'm using Python dictionaries to track the
frequency of specific combinations of events, eg, I build a key
and then add various timing inf
't a dict comprehension more adequate?
>
> [key: (dict1[key], dict2[key]) for key in common_keys if
> dict1[key]!=dict2[key]}
Cool!! I'm relatively new to Python and totally missed the ability to
work with dictionary comprehensions. Yes, your dictionary comprehension
technique i
Hi Roger,
> you may want to consider using SQLite
Thank you for your suggestion about looking at SQLite. I haven't
compared the performance of SQLite to Python dictionaries, but I'm
skeptical that SQLite would be faster than in-memory Python dictionaries
for the type of analysis I
explanation.
Thank you!
Malcolm
- Original message -
From: "Marc 'BlackJack' Rintsch"
To: python-list@python.org
Date: 24 Dec 2008 08:30:41 GMT
Subject: Re: Strategy for determing difference between 2 very large
dictionaries
On Wed, 24 Dec 2008 03:23:00 -0
Hi James,
> For the purpose of perpetuating the annoying pedantry that has made
> usenet great:
>
> http://docs.python.org/dev/3.0/whatsnew/3.0.html#views-and-iterators-instead-of-lists
Great tip! Thank you!
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Hi Roger,
> The performance improvements you are seeing with Python over Oracle are
> exactly the same range people see with SQLite over Oracle. One common usage
> reported on the SQLite mailing list is people copying data out of Oracle and
> running their analysis in SQLite be
x27;: 3, 'd': 4}
That's very cool! Thanks for sharing that technique.
Regards,
Malcolm
- Original message -
From: "Peter Otten" <__pete...@web.de>
To: python-list@python.org
Date: Wed, 24 Dec 2008 09:46:51 +0100
Subject: Re: Strategy for determing differ
m(). I searched with google but I didn't find an
answer. In the official python tutorial it says os.system('command')
executes the command, but it doesn't say which commands exist (or
I'm just blind).
Does anyone have an answer for this question?
Thanks,
Devilly
On 25 dec 2008, at 12:56, Dennis van Oosterhout wrote:
Hello Arno,
thanks for the explanation! I have one more question: on the python
site it says it's better to replace the system commands by subprocess
and Popen.
Now I searched for some good example for my specific case (as I have
no
2008/12/25 Dennis van Oosterhout :
Hello Arno,
thanks for the explanation! I have one more question: on the python
site it says it's better to replace the system commands by subprocess
and Popen.
Now I searched for some good example for my specific case (as I have
no idea how it should
On 31 dec 2008, at 13:37, Benjamin Blundell wrote:
Hi all. I've had a look around the forums and the we and im looking
for a library (or a set of libraries) for dealing with Visualisation
and Interaction in Python. At the moment i've been using Flash with
the Five3D library to do m
, 'Operation timed out')
I guess its a firewall problem... How do i go abt it?
any help? --
does it work if you temporarily switch off the firewall?
gr
Arno
--
http://mail.python.org/mailman/listinfo/python-list
On 23 okt 2008, at 05:49, ryan wrote:
On Oct 22, 6:18 pm, Python <[EMAIL PROTECTED]> wrote:
On 22 okt 2008, at 13:50, ryan fox wrote:
i have implemented a small client server model to do file transfer
over a LAN network.
It work with some machines on the network and on others it
#x27;m not part of this thread, but your post is a great help on another
project.
Thank you!
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Rainy,
Great stuff! Thanks for your examples with the community!!
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
>> A sort of premature pessimization, then.
QOTW!
+1
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
>> Python 2.7's regex will include possessive quantifiers, atomic groups,
>> variable-length lookbehinds, and Unicode properties (at least the common
>> ones), amongst other things.
> Wow, that's excellent news!
> Many thanks for all your efforts to enhance th
Andrew,
I'm on a lot of Python (and Python related) mailing lists and haven't
received a message like you described.
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
On 16 mrt 2009, at 18:21, Lou Pecora wrote:
Since this happened with a Python script and some people here use OS X
and Terminal to run scripts I thought this might be helpful.
I recently ran into this problem using Terminal and found the
solution.
I thought those who use the Terminal in OS
minal from /Applications/Utilities/Terminal
it comes up with a window and you can execute any script from there
without the window closing when the script exits, or not?
--
http://mail.python.org/mailman/listinfo/python-list
On 16 mrt 2009, at 22:15, Lou Pecora wrote:
In article ,
Python wrote:
--
why don't you just execute the script directly form the terminal?
then you will be able to read all error messages...
and you can delete all the files you want
just my 2c
Arno
Because the shell process i
Are there any benchmarks (pystones or other) that compare a
32-bit and 64-bit versions of Python?
Ideally I'm looking for a benchmark comparing recent Python
releases (2.6.x, 3.x) on an Intel platform.
I'm specifically interested in areas of the Python language where
a 64-bit impleme
Stefan,
Is it possible to use the same install of lxml across multiple versions
of Python, eg. I have 2.4, 2.5, 2.6, and 3.0 installed on my workstation
- can I use a single copy of lmxl for 4 versions of Python?
My understanding is that we can replace our use of elmentree and
htmlparser with
itance (mixin)
7. Simple string manipulation example (also reinforce Unicode support)
8. Modules (including the ability to reference modules in a zip file)
Unique Python features:
1. Lists, dictionaries and sets
2. Pickling
3. IDLE console
4. Working with command line args (and optionally o
Any recommendations on Python based tree data structures that I
can study? I'm working on an application that will model a basic
outline structure (simple tree) and am looking for ideas on
Pythonic implementation techniques. By outline I mean a
traditional hierarchical document outline (se
On 12 apr 2009, at 15:07, Gabriel wrote:
Hello,
I'm python newbie and i need to write gui for my school work in
python.
I need to write it really quick, because i haven't much time .)
So question is, which of gui toolkits should i pick and learn? I
heard PyGTK and Glade ar
; ] if getattr(
eval(x), '_included', False ) ]
However, I can't figure out a way to replace my list of hard-coded
function names with the output from the dir() command.
Thank you for your thoughts,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
Scott,
Thank you for your example - very clean.
For completeness, here is the corrected version of my original code for
the archives:
[ eval(x)() for x in dir() if hasattr( eval(x), '_included') ]
Regards,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
to do with my in-elegant use of
eval(), eg. replacing eval() to expand dir() strings with a dictionary
of local objects.
Question: why vars() vs. globals()? My tests in IDLE (Python 2.6) show
vars() and globals() returning the same items.
Thanks,
Malcolm
--
http://mail.python.org/mailman/listinfo/python-list
\n\n' until no more
'\n\n\n' matches exist
2. use regular expressions to match and replace whitespace
pattern of 3 or more adjacent \n's with surrounding whitespace
3. a 3rd party text processing library designed for efficiently
cleaning up text
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Sam,
In no specific order (I brought them all):
Wesley Chun's "Core Python Programming"
David Mertz's "Text Processing in Python" (older, but excellent)
Mark Lutz's "Learning Python"
All highly recommended.
Best of luck on your Python journey!
Using Python 2.6 or higher: Is there a way to configure
string.Template() to ignore the case of matched identifiers?
In other words, given the following Template string and
dictionary where all keys are lowercase, is there a way to have
my identifiers expanded based on their lowercase values
201 - 300 of 4948 matches
Mail list logo