473,418 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Windows Copy Gui

Hi all,

Just wondering if anyone knows how to pop up the dialog that windows
pops up when copying/moving/deleting files from one directory to
another, in python ?

Cheers

May 15 '06 #1
8 1731
For Large Dictionaries Could One Use Separate Dictionaries Where Each
Dictionary Covers an Interval of the Input Range?

You would need to know something of the input range and its
uniformity!

Self-balancing between dictionaries for separate dictionaries?
--
Regards,
Casey
May 16 '06 #2
Casey Hawthorne wrote:
For Large Dictionaries Could One Use Separate Dictionaries Where Each
Dictionary Covers an Interval of the Input Range?


One Could, But Why? :-) You wouldn't see any performance improvements.
Looking up a key in a dictionary is done in constant-time, i.e. it
doesn't matter how large the dictionary is.

Graham

May 16 '06 #3

Graham> Looking up a key in a dictionary is done in constant-time,
Graham> i.e. it doesn't matter how large the dictionary is.

Doesn't that depend on how many keys hash to the same value? For small
dictionaries keeping the max keys that hash to the same value small isn't a
huge problem. For large dictionaries (millions of keys) might you have some
long chains? Or in an effort to reduce the chain length, wind up using so
much virtual memory that you wind up wrecking performance by swapping?

Skip
May 16 '06 #4
On 5/16/06, sk**@pobox.com <sk**@pobox.com> wrote:

Graham> Looking up a key in a dictionary is done in constant-time,
Graham> i.e. it doesn't matter how large the dictionary is.

Doesn't that depend on how many keys hash to the same value? For small
dictionaries keeping the max keys that hash to the same value small isn'ta
huge problem.


Hi Skip. On reflection, I guess I ought to have asked the OP what he
meant by "large". :-) Probably asked for details on his use-case as
well.

Sure, collisions are a reality. The introductory comments in
dictobject.c in the Python source [1] give good coverage of how these
issues are handled in CPython. And, they make for great bedtime
reading! :-)

Regardless, I can't imagine that using multiple dictionaries would
provide a sufficient speed-up for the vast majority of large
dictionary use-cases. There are still swapping issues, plus the
user-code overhead of managing the multiple dicts, plus the multiple
lookups. If the only improvement is in collision reduction (which is
questionable in the general case, since an unfortunate set of keys
could result in numerous collisions even in a smaller database), then
is the extra overhead really worth it?

Still, it's just my opinion. If someone wants to post code and prove
me wrong, I'll eat my hat and take my lickings. ;-)

Best,
Graham

[1] http://svn.python.org/view/python/tr...s/dictobject.c
May 16 '06 #5
In article <ma***************************************@python. org>,
<sk**@pobox.com> wrote:

Graham> Looking up a key in a dictionary is done in constant-time,
Graham> i.e. it doesn't matter how large the dictionary is.

Doesn't that depend on how many keys hash to the same value? For small
dictionaries keeping the max keys that hash to the same value small isn't a
huge problem. For large dictionaries (millions of keys) might you have some
long chains? Or in an effort to reduce the chain length, wind up using so
much virtual memory that you wind up wrecking performance by swapping?


If you're getting long hash chains, you're either using a bad hash
function, or your table isn't big enough.
May 16 '06 #6
If you have the same number of entries as buckets, and you have a good
hash function, then if you have n buckets your longest chain should
have length around ln(n). The average length of a nonempty bucket
would be somewhere around 1 1/2.

May 16 '06 #7

Roy> If you're getting long hash chains, you're either using a bad hash
Roy> function, or your table isn't big enough.

Sure. The original poster said something about 10 million keys I think.
Unless the key distribution is amazingly fortuitous and the number of unique
values is small, the dictionary is going to have a huge memory footprint.

On my Mac laptop this code:
d = {}
for n in xrange(10**7): ... d[n] = hex(n)
...

yields a process with 647MB of VM. If I trim that to 1000 unique values:
d = {}
for n in xrange(10**7):

... d[n] = hex(n % 1000)
...

I still wind up with 647MB VM. The dictionary and its keys are what consume
all the memory, and those keys are as simple as you can get.

Skip

May 17 '06 #8

bob> If you have the same number of entries as buckets, and you have a
bob> good hash function, then if you have n buckets your longest chain
bob> should have length around ln(n). The average length of a nonempty
bob> bucket would be somewhere around 1 1/2.

Yes, and it achieves that nice short chain length by consuming gobs of
memory. A dictionary with 10**7 keys is going to chew up lots of memory.
There's nothing particularly magical about dictionaries in this respect.
They are good examples of a classic time-space tradeoff.

Skip

May 17 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steve Holden | last post by:
If nobody has a quick answer I'll go to the PIL list, but I'm having problems with PIL JPEG support on Windows, and figured someone on c.l.py might have solved this problem. I built the Cygwin...
5
by: Mike Turco | last post by:
(This was also posted to comp.database.ms-access before I realized this was the hep group.) Lets say that my WinXP computer has two users: Michael and Kathryn. One or the other logs into the...
8
by: Rajko | last post by:
I need to send refresh message to Windows Explorer from shell extension(DLL). But I dont know how to obtain handle to Windows Explorer from within DLL since i dont have any handle to any window. ...
5
by: z. f. | last post by:
Hi, I'm working on a web project and i create classes to do business logic and connect to DB. i also need a windows application to do the same functionality as defined in classes inside the...
4
by: bob lambert | last post by:
Help I am trying to deploy to another pc a vb.net std 2002 windows form application. I am confused. I created a project - windows form I built form, compiled and debugged. I created a...
7
by: Abubakar | last post by:
Hi. I got the following error while running an exe made in visual studio 2k5c++ (all native unmanaged) --------------------------- Microsoft Visual C++ Debug Library...
2
by: toronto | last post by:
Seasons Greetings Everyone! I want to use JavaScript's event object to detect whether someone has pressed the 'PrintScreen' key to screenshot, via the Windows Clipboard, and to print website...
5
by: =?Utf-8?B?SmFwZQ==?= | last post by:
im writing a c# console application that copies files chosen from the windows explorer. I chose the files i want to copy and then from the (right key) menu chose my program. the program starts...
8
by: james.kirin39 | last post by:
Hi everyone, After having used Python on Linux for some time, I now have to do Python coding on Windows. I am big fan of the interactive Python shell to test, eg, regexps. Is there an...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.