Re: Probabilistic unit tests?
On 11 Jan, 13:34, Steven D'Aprano wrote: > Well, that's not really a task for unit testing. Unit tests, like most > tests, are well suited to deterministic tests, but not really to > probabilistic testing. As far as I know, there aren't really any good > frameworks for probabilistic testing, so you're stuck with inventing your > own. (Possibly on top of unittest.) One approach I've had success with is providing a seed to the RNG, so that the random results are deterministic. -- http://mail.python.org/mailman/listinfo/python-list
Re: Compiling native extensions with Visual Studio 2012?
Okay, got all extensions I require to compile successfully with MSVC 2012. Trick was using this fork: https://github.com/wcdolphin/py-bcrypt (See their issue log for traceback) =] On Sat, Jan 12, 2013 at 6:45 PM, Alec Taylor wrote: > There have been various threads for MSVC 2010[1][2], but the most > recent thing I found for MSVC 2012 was [3]… from 6 months ago. > > Basically I want to be able to compile bcrypt—and yes I should be > using Keccak—x64 binaries on Windows x64. > > There are other packages also which I will benefit from, namely I > won't need to use the unofficial setup files and will finally be able > to use virtualenv. > > So anyway, can I get an update on the status of MSVC 2010 and MSVC > 2012 compatibility? > > Thanks, > > Alec Taylor > > [1] http://bugs.python.org/issue13210 > [2] > http://webcache.googleusercontent.com/search?q=cache:xPaU9mlCBNEJ:wiki.python.org/moin/VS2010+&cd=1&hl=en&ct=clnk > [3] https://groups.google.com/d/topic/dev-python/W1RpFhaOIGk -- http://mail.python.org/mailman/listinfo/python-list
Re: Query windows event log with python
On 12 Jan, 16:09, [email protected] wrote: > Hi, > > I am looking to write a short program to query the windows event log. > > It needs to ask the user for input for The event type (Critical, Error, and > Information), and the user needs to be able to specify a date since when they > want to view results. > > I understand I will need the pywin32 extension, which i already have > installed. > > I found this piece of code to start from, > > > import win32evtlog # requires pywin32 pre-installed > > server = 'localhost' # name of the target computer to get event logs > logtype = 'System' # 'Application' # 'Security' > hand = win32evtlog.OpenEventLog(server,logtype) > flags = > win32evtlog.EVENTLOG_BACKWARDS_READ|win32evtlog.EVENTLOG_SEQUENTIAL_READ > total = win32evtlog.GetNumberOfEventLogRecords(hand) > > while True: > events = win32evtlog.ReadEventLog(hand, flags,0) > if events: > for event in events: > print 'Event Category:', event.EventCategory > print 'Time Generated:', event.TimeGenerated > print 'Source Name:', event.SourceName > print 'Event ID:', event.EventID > print 'Event Type:', event.EventType > data = event.StringInserts > if data: > print 'Event Data:' > for msg in data: > print msg > print > > > Thanks for any help. > Robey What would you like us to provide? Pointers to the Python tutorial? Or all of the code? Generally, the onus is on you to attempt to come up with solution yourself and then to ask for assistance where required. If you want someone to just write it for you, then you might want to mention how you plan on recompensing them. -- http://mail.python.org/mailman/listinfo/python-list
Re: String concatenation benchmarking weirdness
from timeit import timeit, repeat
size = 1000
r = repeat("y = x + 'a'", setup = "x = 'a' * %i" % size)
print('1:', r)
r = repeat("y = x + 'é'", setup = "x = 'a' * %i" % size)
print('2:', r)
r = repeat("y = x + 'œ'", setup = "x = 'a' * %i" % size)
print('3:', r)
r = repeat("y = x + '€'", setup = "x = 'a' * %i" % size)
print('4:', r)
r = repeat("y = x + '€'", setup = "x = '€' * %i" % size)
print('5:', r)
r = repeat("y = x + 'œ'", setup = "x = 'œ' * %i" % size)
print('6:', r)
r = repeat("y = é + 'œ'", setup = "é = 'œ' * %i" % size)
print('7:', r)
r = repeat("y = é + 'œ'", setup = "é = '€' * %i" % size)
print('8:', r)
>c:\python32\pythonw -u "vitesse3.py"
1: [0.3603178435286996, 0.42901157137281515, 0.35459694357592086]
2: [0.3576409223543202, 0.4272010951864649, 0.3590055732104662]
3: [0.3552022735516487, 0.4256544908828328, 0.35824546465278573]
4: [0.35488168890607774, 0.4271707696118834, 0.36109528098614074]
5: [0.3560675370237849, 0.4261538782668417, 0.36138160167082134]
6: [0.3570182634788317, 0.4270155971913008, 0.35770629956705324]
7: [0.3556977225493485, 0.4264969117143753, 0.3645634239700426]
8: [0.35511247834379844, 0.4259628665308437, 0.3580737510097034]
>Exit code: 0
>c:\Python33\pythonw -u "vitesse3.py"
1: [0.3053600256152646, 0.3306491917840535, 0.3044963374976518]
2: [0.36252767208680514, 0.36937298133086727, 0.3685573415262271]
3: [0.7666293438924097, 0.7653473991487574, 0.7630926729867262]
4: [0.7636680712265038, 0.7647586103955284, 0.7631395397838059]
5: [0.44721085450773934, 0.3863234021671369, 0.45664368355696094]
6: [0.44699700013114807, 0.3873974001136613, 0.45167383387335036]
7: [0.4465200615491014, 0.387050034441188, 0.45459690419205856]
8: [0.44760587465455437, 0.3875261853459726, 0.45421212384964704]
>Exit code: 0
The difference between a correct (coherent) unicode handling and ...
jmf
--
http://mail.python.org/mailman/listinfo/python-list
Re: Query windows event log with python
On 12/01/2013 06:09, [email protected] wrote: I am looking to write a short program to query the windows event log. It needs to ask the user for input for The event type (Critical, Error, and Information), and the user needs to be able to specify a date since when they want to view results. I found this piece of code to start from, [... snip ...] Well it looks like you have everything you need. Was there a specific question you wanted to ask? TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: String concatenation benchmarking weirdness
On 1/12/2013 3:38 AM, [email protected] wrote: from timeit import timeit, repeat size = 1000 r = repeat("y = x + 'a'", setup = "x = 'a' * %i" % size) print('1:', r) r = repeat("y = x + 'é'", setup = "x = 'a' * %i" % size) print('2:', r) r = repeat("y = x + 'œ'", setup = "x = 'a' * %i" % size) print('3:', r) r = repeat("y = x + '€'", setup = "x = 'a' * %i" % size) print('4:', r) r = repeat("y = x + '€'", setup = "x = '€' * %i" % size) print('5:', r) r = repeat("y = x + 'œ'", setup = "x = 'œ' * %i" % size) print('6:', r) r = repeat("y = é + 'œ'", setup = "é = 'œ' * %i" % size) print('7:', r) r = repeat("y = é + 'œ'", setup = "é = '€' * %i" % size) print('8:', r) c:\python32\pythonw -u "vitesse3.py" 1: [0.3603178435286996, 0.42901157137281515, 0.35459694357592086] 2: [0.3576409223543202, 0.4272010951864649, 0.3590055732104662] 3: [0.3552022735516487, 0.4256544908828328, 0.35824546465278573] 4: [0.35488168890607774, 0.4271707696118834, 0.36109528098614074] 5: [0.3560675370237849, 0.4261538782668417, 0.36138160167082134] 6: [0.3570182634788317, 0.4270155971913008, 0.35770629956705324] 7: [0.3556977225493485, 0.4264969117143753, 0.3645634239700426] 8: [0.35511247834379844, 0.4259628665308437, 0.3580737510097034] Exit code: 0 c:\Python33\pythonw -u "vitesse3.py" 1: [0.3053600256152646, 0.3306491917840535, 0.3044963374976518] 2: [0.36252767208680514, 0.36937298133086727, 0.3685573415262271] 3: [0.7666293438924097, 0.7653473991487574, 0.7630926729867262] 4: [0.7636680712265038, 0.7647586103955284, 0.7631395397838059] 5: [0.44721085450773934, 0.3863234021671369, 0.45664368355696094] 6: [0.44699700013114807, 0.3873974001136613, 0.45167383387335036] 7: [0.4465200615491014, 0.387050034441188, 0.45459690419205856] 8: [0.44760587465455437, 0.3875261853459726, 0.45421212384964704] Exit code: 0 The difference between a correct (coherent) unicode handling and ... By 'correct' Jim means 'speedy', for a subset of string operations*. rather than 'accurate'. In 3.2 and before, CPython does not handle extended plane characters correctly on Windows and other narrow builds. This is, by the way, true of many other languages. For instance, Tcl 8.5 and before (not sure about the new 8.6) does not handle them at all. The same is true of Microsoft command windows. * lets try another comparison: from timeit import timeit print(timeit("a.encode()", "a = 'a'*1")) 3.2: 12.1 seconds 3.3.7 seconds 3.3 is 15 times faster!!! (The factor increases with the length of a.) A fairer comparison is the approximately 120 micro benchmarks in Tools/stringbench.py. Here they are, uncensored, for 3.3.0 and 3.2.3. It is in the Tools directory of some distributions but not all (including not Windows). It can be downloaded from http://hg.python.org/cpython/file/6fe28afa6611/Tools/stringbench In FireFox, Right-click on the stringbench.py link and 'Save link as...' to somewhere you can run it from. >>> stringbench v2.0 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AMD64)] 2013-01-12 06:17:51.685781 bytes unicode (in ms) (in ms) % comment == case conversion -- dense 0.41 0.43 95.2 ("WHERE IN THE WORLD IS CARMEN SAN DEIGO?"*10).lower() (*1000) 0.42 0.43 95.8 ("where in the world is carmen san deigo?"*10).upper() (*1000) == case conversion -- rare 0.41 0.43 95.8 ("Where in the world is Carmen San Deigo?"*10).lower() (*1000) 0.42 0.43 96.3 ("wHERE IN THE WORLD IS cARMEN sAN dEIGO?"*10).upper() (*1000) == concat 20 strings of words length 4 to 15 1.831.9594.1s1+s2+s3+s4+...+s20 (*1000) == concat two strings 0.100.1098.7"Andrew"+"Dalke" (*1000) == count AACT substrings in DNA example 2.462.44100.9 dna.count("AACT") (*10) == count newlines 0.770.75103.6 ...text.with.2000.newlines.count("\n") (*10) == early match, single character 0.300.27110.5 ("A"*1000).find("A") (*1000) 0.450.06750.5 "A" in "A"*1000 (*1000) 0.300.27110.4 ("A"*1000).index("A") (*1000) 0.240.22107.2 ("A"*1000).partition("A") (*1000) 0.330.29116.6 ("A"*1000).rfind("A") (*1000) 0.320.29107.9 ("A"*1000).rindex("A") (*1000) 0.200.2194.1("A"*1000).rpartition("A") (*1000) 0.420.4593.4("A"*1000).rsplit("A", 1) (*1000) 0.390.4195.9("A"*1000).split("A", 1) (*1000) == early match, two characters 0.320.27121.1 ("AB"*1000).find("AB") (*1000) 0.450.06729.5 "AB" in "AB"*1000 (*1000) 0.300.27111.2 ("AB"*1000).index("AB") (*1000) 0.230.2885.0("AB"*1000).partition("AB") (*1000) 0.330.30110.6 ("AB"*1000).rfind("AB") (*1000) 0.330.30110.5 ("AB"*1000).rindex("AB") (*1000) 0.220.2783.1("AB"*1000).rpartition("AB") (*1000) 0.460.4796.7("AB"*1000).rsplit("AB", 1) (*1000) 0.440.4890.9("AB"*1000).split("AB", 1) (*1000) == endswith multipl
stringbench (was Re: String concatenation benchmarking weirdness)
On Sat, Jan 12, 2013 at 10:31 PM, Terry Reedy wrote:
> 0.410.4395.2("WHERE IN THE WORLD IS CARMEN SAN
> DEIGO?"*10).lower()
Why does stringbench misspell the name Carmen Sandiego? Copyright avoidance?
ChrisA
--
http://mail.python.org/mailman/listinfo/python-list
Re: PyWart: Module access syntax
On Fri, Jan 11, 2013 at 6:01 AM, Rick Johnson wrote: > > Python's module/package access uses dot notation. > > mod1.mod2.mod3.modN > > Like many warts of the language, this wart is not so apparent when first > learning the language. The dot seems innocently sufficient, however, in > truth it is woefully inadequate! Observe: > > name1.name2.name3.name4.name5 > > I find it reassuring to have these kinds of questions on the list, because they actually remind me how brilliantly designed Python is. As the user of a module I shouldn't care about the internal arrangement of objects and files. I don't care. More than that, as the writer of a module I should be free to refactor the internals of a module without breaking existing code. There is absolutely nothing wrong at all with the syntax. In fact, it's fantastic. N. -- http://mail.python.org/mailman/listinfo/python-list
Re: Dependency management in Python?
On Fri, Jan 11, 2013 at 06:42:18PM -0800, Adelbert Chang wrote: > Another question - how do we then get PIP to the latest version? Or > is it relatively easy to uninstall/reinstall PIP? Simply do a $ pip install -U distribute $ pip install -U pip from time to time in your virtual environment. As a side note: some versions of distribute, pip and virtualenv do interact rather poorly on Python 3. Upgrading via easy_install: $ easy_install -U distribute $ easy_install -U pip usually solves these issues. Have fun! Thomas -- http://mail.python.org/mailman/listinfo/python-list
proposal: Ellipsis in argument list
Dear All, I have an idea that the Ellipsis object could be used in function calls. The "..." syntax should automagically turn into an Ellipsis positional argument. def f(*args): ext_args = [] for i, a in enumerate(args): if a is Ellipsis: ext_args.extend([x for x in range(args[i-1]-1, args[i+1])]) else: ext_args.append(a) return ext_args Calling it for the above example specifically: >>>f(34, ..., 43) [34, 35, 36, 37, 38, 39, 40, 41, 42, 43] That might be useless or someone might say it is confusing, but I think it would be relatively easy to implement and a nice little syntactic "sugar". Best regards, Szabolcs Blaga -- http://mail.python.org/mailman/listinfo/python-list
Re: proposal: Ellipsis in argument list
Szabolcs Blága, 12.01.2013 14:30: > I have an idea that the Ellipsis object could be used in function calls. > The "..." syntax should automagically turn into an Ellipsis positional > argument. > > def f(*args): > ext_args = [] > for i, a in enumerate(args): > if a is Ellipsis: > ext_args.extend([x for x in range(args[i-1]-1, args[i+1])]) > else: > ext_args.append(a) > return ext_args > > Calling it for the above example specifically: > > >>> f(34, ..., 43) > [34, 35, 36, 37, 38, 39, 40, 41, 42, 43] > > That might be useless or someone might say it is confusing, but I think it > would be relatively easy to implement and a nice little syntactic "sugar". Not sure what exactly you are proposing here, this works for me: Python 3.2.3 (default, Oct 19 2012, 19:53:16) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> def f(*args): print(args) >>> f(34, ..., 43) (34, Ellipsis, 43) Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Probabilistic unit tests?
In article <693d4bb1-8e1e-4de0-9d4d-8a136ea70...@pp8g2000pbb.googlegroups.com>, alex23 wrote: > On 11 Jan, 13:34, Steven D'Aprano [email protected]> wrote: > > Well, that's not really a task for unit testing. Unit tests, like most > > tests, are well suited to deterministic tests, but not really to > > probabilistic testing. As far as I know, there aren't really any good > > frameworks for probabilistic testing, so you're stuck with inventing your > > own. (Possibly on top of unittest.) > > One approach I've had success with is providing a seed to the RNG, so > that the random results are deterministic. Sometimes, a hybrid approach is best. I was once working on some code which had timing-dependent behavior. The input space was so large, there was no way to exhaustively test all conditions. What we did was use a PRNG to drive the test scenarios, seeded with the time. We would print out the seed at the beginning of the test. This let us explore a much larger range of the input space than we could have with hand-written test scenarios. There was also a mode where you could supply your own PRNG seed. So, the typical deal would be to wait for a failure during normal (nightly build) testing, then grab the seed from the test logs and use that to replicate the behavior for further study. -- http://mail.python.org/mailman/listinfo/python-list
Re: stringbench (was Re: String concatenation benchmarking weirdness)
On 1/12/2013 6:42 AM, Chris Angelico wrote:
On Sat, Jan 12, 2013 at 10:31 PM, Terry Reedy wrote:
0.410.4395.2("WHERE IN THE WORLD IS CARMEN SAN
DEIGO?"*10).lower()
Why does stringbench misspell the name Carmen Sandiego? Copyright avoidance?
Or ignorance. Perhaps I will fix it some day.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
Re: stringbench (was Re: String concatenation benchmarking weirdness)
On Sun, Jan 13, 2013 at 1:27 AM, Terry Reedy wrote:
> On 1/12/2013 6:42 AM, Chris Angelico wrote:
>>
>> On Sat, Jan 12, 2013 at 10:31 PM, Terry Reedy wrote:
>>>
>>> 0.410.4395.2("WHERE IN THE WORLD IS CARMEN SAN
>>> DEIGO?"*10).lower()
>>
>>
>> Why does stringbench misspell the name Carmen Sandiego? Copyright
>> avoidance?
>
>
> Or ignorance. Perhaps I will fix it some day.
Heh. And here I was assuming everything had a strong and purposeful cause...
ChrisA
--
http://mail.python.org/mailman/listinfo/python-list
Re: Compiling native extensions with Visual Studio 2012?
Am 12.01.2013 08:45, schrieb Alec Taylor: > There have been various threads for MSVC 2010[1][2], but the most > recent thing I found for MSVC 2012 was [3]… from 6 months ago. > > Basically I want to be able to compile bcrypt—and yes I should be > using Keccak—x64 binaries on Windows x64. > > There are other packages also which I will benefit from, namely I > won't need to use the unofficial setup files and will finally be able > to use virtualenv. > > So anyway, can I get an update on the status of MSVC 2010 and MSVC > 2012 compatibility? The problem is that every MSVC has its own libc / CRT (msvcrt.dll) with its own implementations of malloc(), FILE pointer, thread local storage, errno etc. You shouldn't mix multiple CRTs in one program as this may lead to crashes and hard to find bugs. Why do you want to compile your own Keccak / SHA-3 binaries anyway? I have build and released binaries for X86 and X86_64 Windows and for Python 2.6 and 3.3. For Python 3.4 I'm working on a PEP about the integration of pbkdf2, bcrypt and scrypt into Python's stdlib. Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: average time calculation??
On Thu, 10 Jan 2013 09:50:37 -0800 (PST)
pmec wrote:
> Hi there guys i've got a script that's suppose to find the average of two
> times as strings. The times are in minutes:seconds:milliseconds
> i'm doing ok in printing the right minutes and seconds my problem is with the
> milliseconds.
>
> Example if i have 00:02:20 and 00:04:40 the average will be 00:03:30 or
> 00:02:00 and 00:03:00 will be 00:02:30
This is how I would probably go about it:
Convert your strings to floating point values which describe the time
in seconds. Look at string.split() if you do it by hand. You could also
use a regular expression ('re' module).
Then, calculate the average: (a+b)*0.5
Then, convert back to your string format if you must.
This may sound like more work at first but it is probably easier and
less error-prone than messing with those separate values.
Make sure you properly understand the string format first.
minutes:seconds:milliseconds sounds unusual to me, but if you know for
certain that is the format, then it is :)
--
http://mail.python.org/mailman/listinfo/python-list
Re: average time calculation??
On Sun, Jan 13, 2013 at 2:32 AM, Thomas Boell wrote: > This is how I would probably go about it: > Convert your strings to floating point values which describe the time > in seconds. Either floats or integers (which would be milliseconds, or whatever your smallest unit is). I tend to prefer integers for this sort of work, but do whichever you feel more comfortable working with. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Compiling native extensions with Visual Studio 2012?
On Sun, Jan 13, 2013 at 1:34 AM, Christian Heimes wrote: > Am 12.01.2013 08:45, schrieb Alec Taylor: >> There have been various threads for MSVC 2010[1][2], but the most >> recent thing I found for MSVC 2012 was [3]… from 6 months ago. >> >> Basically I want to be able to compile bcrypt—and yes I should be >> using Keccak—x64 binaries on Windows x64. >> >> There are other packages also which I will benefit from, namely I >> won't need to use the unofficial setup files and will finally be able >> to use virtualenv. >> >> So anyway, can I get an update on the status of MSVC 2010 and MSVC >> 2012 compatibility? > > The problem is that every MSVC has its own libc / CRT (msvcrt.dll) with > its own implementations of malloc(), FILE pointer, thread local storage, > errno etc. You shouldn't mix multiple CRTs in one program as this may > lead to crashes and hard to find bugs. > > Why do you want to compile your own Keccak / SHA-3 binaries anyway? I > have build and released binaries for X86 and X86_64 Windows and for > Python 2.6 and 3.3. For Python 3.4 I'm working on a PEP about the > integration of pbkdf2, bcrypt and scrypt into Python's stdlib. > > Christian Would be awesome to get these built into stdlib. Compiling my own versions mostly for virtualenv purposes; though sometimes I can't find the binary on: http://www.lfd.uci.edu/~gohlke/pythonlibs/ -- http://mail.python.org/mailman/listinfo/python-list
Re: problems importing from /usr/lib/pyshared/
Thank you Dieter, > Ubuntu 12 has introduced important changes with respect to "glib" (and > depending packages). In fact, there are now two quite incompatible > implementations - the old "static" one and a new "dynamic" one. > It looks as if in your case, old and new implementations were mixed. > > I had a similar problem when upgrading to "Ubuntu 12.4". In my case, > it turned out that my (custom) "PYTHONPATH" setting was responsible for > getting into the incompatibility. > > The new way to use "gtk" is via the "gi" (probable "gnome interface") > module. It looks like: > > from gi.repository import Gtk,GdkPixbuf,GObject,Pango,Gdk,Gio I will investigate this gi module. As for my import problem, it turned out that it was my own fault: following some recommendation on the web, I had added /usr/share/pyshared to the python path in ~/.profile and forgot to log out and in again after undoing this change. Everything works fine again, and I am ready to explore the new modules. -- http://mail.python.org/mailman/listinfo/python-list
Re: String concatenation benchmarking weirdness
On Sat, Jan 12, 2013 at 1:38 AM, wrote: > The difference between a correct (coherent) unicode handling and ... This thread was about byte string concatenation, not unicode, so your rant is not even on-topic here. -- http://mail.python.org/mailman/listinfo/python-list
Re: async fuction
On 2013-01-12 04:43, [email protected] wrote: Hello. Can someone help me to resolv error. code: [snip] @Async def fnc(pi, pp): print "fnc-" i=pi while ( i < 1000 ) : i=i+1 print "fnc+" pass @Async def fnc1(pp): print "fnc1-",pp @Async def fnc2(): print "fnc2-" i=0 while ( i < 10 ) : i=i+1 print "fnc2+" pass fnc(i=0,pp="123123") fnc1() error: Exception in thread fnc1: Traceback (most recent call last): File "C:\Python27\lib\threading.py", line 551, in __bootstrap_inner self.run() File "C:\Python27\lib\threading.py", line 504, in run self.__target(*self.__args, **self.__kwargs) File "C:/Users/rootiks/YandexDisk/py/myftpbackup/asynclib.py", line 26, in run self.Result = self.Callable(*args, **kwargs) TypeError: fnc1() takes exactly 1 argument (0 given) 1. You're calling function 'fnc' with keyword arguments 'i' and 'pp'; it's expecting 'pi' and 'pp'. 2. You're calling function 'fnc1' with no arguments; it's expecting one argument. -- http://mail.python.org/mailman/listinfo/python-list
Re: Probabilistic unit tests?
On 12/01/13 08:07, alex23 wrote: On 11 Jan, 13:34, Steven D'Aprano wrote: Well, that's not really a task for unit testing. Unit tests, like most tests, are well suited to deterministic tests, but not really to probabilistic testing. As far as I know, there aren't really any good frameworks for probabilistic testing, so you're stuck with inventing your own. (Possibly on top of unittest.) One approach I've had success with is providing a seed to the RNG, so that the random results are deterministic. My ex-boss once instructed to do the same thing to test functions for generating random variates. I used a statistical approach instead. There are often several ways of generating data that follow a particular distribution. If you use a given seed so that you get a deterministic sequence of uniform random variates you will get deterministic outputs for a specific implementation. But if you change the implementation the tests are likely to fail. e.g. To generate a negative exponential variate -ln(U)/lambda or -ln(1-U)/lambda will do the job correctly, but tests for one implementation would fail with the other. So each time you changed the implementation you'd need to change the tests. I think my boss had in mind that I would write the code, seed the RNG, call the function a few times, then use the generated values in the test. That would not even have tested the original implementation. I would have had a test that would only have tested whether the implementation had changed. I would argue, worse than no test at all. If I'd gone to the trouble of manually calculating the expected outputs so that I got valid tests for the original implementation, then I would have had a test that would effectively just serve as a reminder to go through the whole manual calculation process again for any changed implementation. A reasonably general statistical approach is possible. Any hypothesis about generated data that lends itself to statistical testing can be used to generate a sequence of p-values (one for each set of generated values) that can be checked (statistically) for uniformity. This effectively tests the distribution of the test statistic, so is better than simply testing whether tests on generated data pass, say, 95% of the time (for a chosen 5% Type I error rate). Cheers. Duncan -- http://mail.python.org/mailman/listinfo/python-list
Introduction to Mathematical Statistics (6th Ed., Hogg, Craig & McKean)
I have solutions manuals to all problems and exercises in these textbooks. To get one in an electronic format contact me at: reganrexman(at)gmail(dot)com and let me know its title, author and edition. Please this service is NOT free. SOLUTIONS MANUAL TO Industrial Organization Theory & Applications by Shy SOLUTIONS MANUAL TO Intermediate Accounting - IFRS Edition Vol.1 by Kieso, Weygandt, Warfield SOLUTIONS MANUAL TO Intermediate Accounting 12th ed by Kieso SOLUTIONS MANUAL TO Intermediate Accounting 13 ed by Kieso SOLUTIONS MANUAL TO Intermediate Accounting Kieso 12th ed SOLUTIONS MANUAL TO INTERMEDIATE ACCOUNTING, 6th Edition, by Spiceland, Sepe SOLUTIONS MANUAL TO Intermediate Algebra - Concepts & Applications 8th Ed by Bittinger, Ellenbogen SOLUTIONS MANUAL TO Introduction to Accounting 3rd Ed by Marriott, Mellett SOLUTIONS MANUAL TO Introduction to Algorithms, 2nd Ed by Cormen, Leiserson SOLUTIONS MANUAL TO Introduction To Analysis (3rdEd) -by William Wade SOLUTIONS MANUAL TO Introduction to Applied Modern Physics by Henok Abebe SOLUTIONS MANUAL TO Introduction to Chemical Engineering Thermodynamics (7th Ed., Smith & Van Ness) SOLUTIONS MANUAL TO Introduction to Commutative Algebra by M. F. Atiyah SOLUTIONS MANUAL TO Introduction to Digital Signal Processing (in Serbian) by Lj. Milic and Z. Dobrosavljevic SOLUTIONS MANUAL TO Introduction to Econometrics (2nd ed., James H. Stock & Mark W. Watson) SOLUTIONS MANUAL TO Introduction to Electric Circuits 7th Edition by Dorf, Svaboda SOLUTIONS MANUAL TO Introduction to Electric Circuits, 6E, Dorf SOLUTIONS MANUAL TO Introduction to Electrodynamics (3rd Ed., David J. Griffiths) SOLUTIONS MANUAL TO Introduction to Elementary Particles 2nd Ed by David Griffiths SOLUTIONS MANUAL TO Introduction to Environmental Engineering and Science (3rd Ed., Gilbert M. Masters & Wendell P. Ela) SOLUTIONS MANUAL TO Introduction to Environmental Engineering and Science, Edition 2, Masters SOLUTIONS MANUAL TO Introduction to Ergonomics 2E by Robert Bridger SOLUTIONS MANUAL TO Introduction to Fluid Mechanics ( 7 E., Robert Fox, Alan McDonald & Philip ) SOLUTIONS MANUAL TO Introduction to Fluid Mechanics (6E., Robert Fox, Alan McDonald & Philip) SOLUTIONS MANUAL TO Introduction to fluid mechanics 5th edition by Alan T. McDonald, Robert W Fox SOLUTIONS MANUAL TO Introduction to Graph Theory 2E - West SOLUTIONS MANUAL TO Introduction to Heat Transfer by Vedat S. Arpaci, Ahmet Selamet, Shu-Hsin Kao SOLUTIONS MANUAL TO Introduction to Java Programming, Comprehensive Version 7th Ed by Liang SOLUTIONS MANUAL TO Introduction to Linear Algebra, 3rd Ed., by Gilbert Strang SOLUTIONS MANUAL TO Introduction to Linear Optimization by Dimitris Bertsimas, John N. Tsitsiklis SOLUTIONS MANUAL TO Introduction to Management Accounting, 14 ED by Horngren, Schatzberg SOLUTIONS MANUAL TO Introduction to Materials Science for Engineers (6th Ed., Shackelford) SOLUTIONS MANUAL TO Introduction to Materials Science for Engineers 7th E by Shackelford SOLUTIONS MANUAL TO Introduction to Mathematical Statistics (6th Ed., Hogg, Craig & McKean) SOLUTIONS MANUAL TO Introduction to Mechatronics and Measurements Systems 2nd Ed by Alciatore, Histand SOLUTIONS MANUAL TO Introduction to Nuclear And Particle Physics 2nd E by Bromberg, Das, Ferbel SOLUTIONS MANUAL TO Introduction to Operations Research - 7th ed by Frederick Hillier, Gerald Lieberman SOLUTIONS MANUAL TO Introduction to Probability 2nd Ed by Bertsekas and Tsitsiklis SOLUTIONS MANUAL TO Introduction to Probability by Dimitri P. Bertsekas and John N. Tsitsiklis SOLUTIONS MANUAL TO Introduction to Probability by Grinstead, Snell SOLUTIONS MANUAL TO Introduction to Quantum Mechanics (2nd Ed., David J. Griffiths) SOLUTIONS MANUAL TO Introduction to Quantum Mechanics 1st edition (1995) by David J. Griffiths SOLUTIONS MANUAL TO Introduction to Queueing Theory 2nd Edition by R.B. Cooper SOLUTIONS MANUAL TO Introduction to Scientific Computation and Programming, 1st Edition by Daniel Kaplan SOLUTIONS MANUAL TO Introduction to Signal Processing by S. J. Orfanidis SOLUTIONS MANUAL TO Introduction to Signal Processing by Sophocles J. Orfanidis SOLUTIONS MANUAL TO Introduction to Solid State Physics 8th Ed by Kittel & Charles SOLUTIONS MANUAL TO Introduction to Statistical Physics by Kerson Huang SOLUTIONS MANUAL TO Introduction to Statistical Quality Control (5th Ed., Douglas C. Montgomery) SOLUTIONS MANUAL TO Introduction to the Theory of Computation by Ching Law SOLUTIONS MANUAL TO Introduction to the Thermodynamics of Materials 3 E by Gaskell SOLUTIONS MANUAL TO Introduction to Thermal and Fluids Engineering by Kaminski, Jensen SOLUTIONS MANUAL TO Introduction to Thermal Systems Engineering Moran Shapiro Munson SOLUTIONS MANUAL TO Introduction to VLSI Circuits and Systems, by John P. Uyemura SOLUTIONS MANUAL TO Introduction to Wireless Systems by P.M Shankar SOLUTIONS MANUAL TO Introductory Econometrics A Modern Approach, 3
Python 3.3 can't find PySide
Hi everybody, I'm just starting to dabble in Python development after spending years with C# and Java, but there's one small thing holding me back: I can't seem to get PySide working for the life of me. Let me explain: I'm on OS X 10.6.8 and have installed Python 3.3.0 and Qt 4.8.4 with Homebrew. The Python interpreter works fine, and all the Qt utilites are in my $PATH and installed correctly. Homebrew has a package for PySide, but it's only compiled against Python 2.x instead of 3.x (there is an issue about this, https://github.com/mxcl/homebrew/issues/16439), so I can't use that. I tried using the PySide BuildScripts on GitHub, but those fail with an error that I can't seem to resolve (I'll save that for a PySide list, I guess). I can't compile it manually because I don't have the expertise to pass the right options to cmake and tell it where to find all my Python stuff, so I'm really at my wit's end. I tried installing the Homebrew PySide package anyways, but putting the PySide directory (with __init__.py) in my PYTHONPATH didn't allow me to import anything from PySide; I guess this means that PySide has to be told to compile for 3.x instead of 2.x. My question: is there anybody who has had success installing PySide on OS X for Python 3.x? There must be a way, I must be missing something... right? I'll try to find a more relevant PySide list or something to pose this question on but in the meantime, if anybody has any suggestions, I'd appreciate your input. Thanks in advance! -- Tyson Moore [email protected] -- http://mail.python.org/mailman/listinfo/python-list
Re: PyWart: Module access syntax
Chris Angelico於 2013年1月12日星期六UTC+8下午12時40分36秒寫道: > On Sat, Jan 12, 2013 at 3:34 PM, Rick Johnson > > wrote: > > > *The problem:* > > > ... is readability. The current dot syntax used ubiquitously in paths is > > not conveying the proper information to the reader, and in-fact obfuscating > > the code. > > > > Please explain how this is a problem. As Steven said, there is NO > > useful difference. I don't *care* whether it's a package, a module, or > > whatever. Module with class with static member? Fine. Package with > > module with class? Also fine. Imported special object that uses dunder > > methods to simulate either of the above? What's it matter to me, as > > long as I get my final result! > > > > Syntactic salt is seldom helpful. > > > > ChrisA This is somewhat like the following problem. Do we have to argue with people about the tastes of dishes in different restaurants ? Of course, I do because I love to enjoy fine dishes. -- http://mail.python.org/mailman/listinfo/python-list
Re: PyWart: Import resolution order
On Jan 12, 3:28 pm, Rick Johnson wrote: > I am working on it. Stay tuned. Rick is going to rock your little programming > world /very/ soon. I am so confidant that this will never happen that if you _do_ ever produce _anything_ that even remotely resembles your claims, I pledge to provide you with enough funding to continue full-time development on it for 5 years, let's say 5 years @ US$50k per year. However, one condition for acceptance will be that you never post here again. -- http://mail.python.org/mailman/listinfo/python-list
Re: PyWart: Import resolution order
Ian於 2013年1月12日星期六UTC+8下午3時36分43秒寫道: > On Fri, Jan 11, 2013 at 10:28 PM, Rick Johnson > > wrote: > > > On Friday, January 11, 2013 12:30:27 AM UTC-6, Chris Angelico wrote: > > >> Why is it better to import from the current directory first? > > > > > > Opps. I was not explicit enough with my explanation :). I meant, "look in > > the current directory FIRST when in a package". Since many times (most all > > times) packages will contain many sub-modules that need to be imported into > > the package's main.py module, and sometimes these modules will have the > > same name as a stdlib module, then looking in the package FIRST makes sense. > > > > And again, in Python 2.x this is already the case. When importing in > > a package, it tries to do a relative import before it even looks at > > sys.path. > > > > > I think if python where *strict* about full paths for non-builtins, then we > > would be in a better place. > > > > And again, in Python 3, where implicit relative imports have been > > removed from the language, it already is strict about using full > > paths. You can still do relative imports, but you have to be explicit > > about them. > > > > > For instance you could create a package named "chris" and then have a > > module named math exist inside. Alternatively if you choose to be a > > non-professional and create a math module without a containing package, > > python would throw the module into the default "lib" package. The only way > > you could access your math module now would be by using the path "lib.math". > > > > What if I create a package named "math"? Does that also automatically > > get renamed to "lib.math"? How is it decided what package names are > > proper; is it just because it happens to clash with a stdlib name that > > the package gets magically renamed? > > > > What if I create a package, and then later a module with the same name > > happens to be added to the stdlib? My program that uses the package > > just breaks because it no longer imports the correct thing? > > > > > Damn i am full of good ideas! > > > > Your ideas might be better if you first spent some time gaining a > > better understanding of how the language works as is. OK, I think to develop a GUI with auto-code translations in an IDE with python as the CAD/CAM scripting language can be helpful. But usually this kind of sotware projects is in the commercial part. -- http://mail.python.org/mailman/listinfo/python-list
ANN: Python training "text movies"
I don't know what to call these, so for now I'll call them "training text movies" until I come up with a better name.. I hope these will be helpful, especially to new students of Python. http://lightbird.net/larks/tmovies.html I'll be adding more in the next few days... - mitya -- http://mail.python.org/mailman/listinfo/python-list
Re: Query windows event log with python
On Saturday, January 12, 2013 8:34:01 PM UTC+11, Tim Golden wrote: > On 12/01/2013 06:09, [email protected] wrote: > > > I am looking to write a short program to query the windows event > > > log. > > > > > > It needs to ask the user for input for The event type (Critical, > > > Error, and Information), and the user needs to be able to specify a > > > date since when they want to view results. > > > > > > I found this piece of code to start from, > > > > [... snip ...] > > > > Well it looks like you have everything you need. Was there a specific > > question you wanted to ask? > > > > TJG yes, I would like to run it in Command prompt and ask the user at the time what type and date of Event they would like to view. so i was wondering where in the code I could put something like "var=raw_input" Thanks TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Python training "text movies"
On Sun, 13 Jan 2013 00:11:53 -0500, AK wrote: > I don't know what to call these, so for now I'll call them "training > text movies" until I come up with a better name.. > > I hope these will be helpful, especially to new students of Python. > > http://lightbird.net/larks/tmovies.html For the benefit of those who don't have web access at the moment, or who don't like to click on random links they don't know anything about, would you like to say a few words describing what "text movies" are, and how you think these may be helpful? -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Python training "text movies"
On 01/13/2013 01:35 AM, Steven D'Aprano wrote: On Sun, 13 Jan 2013 00:11:53 -0500, AK wrote: > >> I don't know what to call these, so for now I'll call them "training >> text movies" until I come up with a better name.. >> >> I hope these will be helpful, especially to new students of Python. >> >> http://lightbird.net/larks/tmovies.html > > > For the benefit of those who don't have web access at the moment, or who > don't like to click on random links they don't know anything about, would > you like to say a few words describing what "text movies" are, and how > you think these may be helpful? > > > Sure: they play back a list of instructions on use of string methods and list comprehensions along with demonstration in a mock-up of the interpreter with a different display effect for commands typed into (and printed out by) the interpeter. The speed can be changed and the playback can be paused. - mitya -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Python training "text movies"
On 1/13/2013 2:08 AM, Mitya Sirenef wrote: On 01/13/2013 01:35 AM, Steven D'Aprano wrote: On Sun, 13 Jan 2013 00:11:53 -0500, AK wrote: > >> I don't know what to call these, so for now I'll call them "training >> text movies" until I come up with a better name.. >> >> I hope these will be helpful, especially to new students of Python. >> >> http://lightbird.net/larks/tmovies.html > > > For the benefit of those who don't have web access at the moment, or who > don't like to click on random links they don't know anything about, would > you like to say a few words describing what "text movies" are, and how > you think these may be helpful? > > > Sure: they play back a list of instructions on use of string methods and list comprehensions along with demonstration in a mock-up of the interpreter with a different display effect for commands typed into (and printed out by) the interpeter. The speed can be changed and the playback can be paused. They are simulated videos of an interactive interpreter session, with entered commands appearing all at once instead of char by char, and with the extra features mentioned above. I presume the purported advantage over an after-the-fact transcript is focusing watcher attention on each entry and response. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Python training "text movies"
On 01/13/2013 02:28 AM, Terry Reedy wrote: On 1/13/2013 2:08 AM, Mitya Sirenef wrote: >> On 01/13/2013 01:35 AM, Steven D'Aprano wrote: >>> On Sun, 13 Jan 2013 00:11:53 -0500, AK wrote: >> > >> >> I don't know what to call these, so for now I'll call them "training >> >> text movies" until I come up with a better name.. >> >> >> >> I hope these will be helpful, especially to new students of Python. >> >> >> >> http://lightbird.net/larks/tmovies.html >> > >> > >> > For the benefit of those who don't have web access at the moment, or who >> > don't like to click on random links they don't know anything about, >> would >> > you like to say a few words describing what "text movies" are, and how >> > you think these may be helpful? >> > >> > >> > >> >> >> Sure: they play back a list of instructions on use of string methods and >> list comprehensions along with demonstration in a mock-up of the >> interpreter with a different display effect for commands typed into (and >> printed out by) the interpeter. The speed can be changed and the >> playback can be paused. > > They are simulated videos of an interactive interpreter session, with > entered commands appearing all at once instead of char by char, and > with the extra features mentioned above. I presume the purported > advantage over an after-the-fact transcript is focusing watcher > attention on each entry and response. > That is right; I would also add that it may be overwhelming for a newbie to be reading through a large "wall of text" -- here you have blank space after the current paragraph so the attention is focused even more on the last few lines. Additionally, since instructions scroll automatically, I can space them out more than you would conventionally do in a manual. - mitya -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ -- http://mail.python.org/mailman/listinfo/python-list
