Itertools Python3

2016-08-30 Thread Smith
Hi, I can not write to the file. Can someone help me? Thanks from itertools import product valore = input('Inserisci un valore: ') risultato = product(valore, repeat = 3) with open("file.txt", "w") as result: for i in risultato: print (result,"".join(i)) -- https://mail.

Re: Itertools Python3

2016-08-30 Thread Smith
Il 30/08/2016 12:28, Chris Angelico ha scritto: Do you get an exception, possibly from the product() call? When you ask for help, copy and paste the entire traceback and error message; it's extremely useful information. I'm pretty sure I know what the problem is here, but I want you to post the

Re: Itertools Python3

2016-08-30 Thread Smith
Il 30/08/2016 12:28, Chris Angelico ha scritto: On Tue, Aug 30, 2016 at 8:24 PM, Smith wrote: I can not write to the file. Can someone help me? Thanks from itertools import product valore = input('Inserisci un valore: ') risultato = product(valore, repeat = 3) with open("fil

*args and **kwargs

2016-09-02 Thread Smith
Hello to all, I'm trying to understand the concept of * args and ** kwarg with python3 But I can not understand why I returns the error message "SyntaxError: positional argument follows the keyword argument" when I insert values. You can help me? def start(data=None, *args, **kwargs): prin

Re: *args and **kwargs

2016-09-02 Thread Smith
After specifying a keyword argument, you may not then specify any positional arguments. Hence the SyntaxError. thanks a lot -- https://mail.python.org/mailman/listinfo/python-list

Re: *args and **kwargs

2016-09-02 Thread Smith
On 02/09/2016 16:52, alister wrote: On Fri, 02 Sep 2016 23:44:50 +1000, Ben Finney wrote: Smith writes: I'm trying to understand the concept of * args and ** kwarg with python3 Welcome. Your questions are fine in this forum; but you may also want to participate in our collabor

listdir

2016-09-05 Thread Smith
Hello to all, I wanted to know because even though the files are present on the directory I write input gives me "file not found". You can help me? Thank you a = input("Digita la directory dove vuoi trovare i file py: ") for file in os.listdir(a): if file.endswith(".py"): print(fil

Re: listdir

2016-09-05 Thread Smith
Il 05/09/2016 17:27, Smith ha scritto: Hello to all, I wanted to know because even though the files are present on the directory I write input gives me "file not found". You can help me? Thank you a = input("Digita la directory dove vuoi trovare i file py: ") for file in o

Re: listdir

2016-09-05 Thread Smith
Il 05/09/2016 17:34, Rustom Mody ha scritto: So what do you get when you replace the if-else with a simple: print(file) a = input("search for files with the extension .py into directory: ") for file in os.listdir(a): if file.endswith(".py"): print(file) search for fil

Re: listdir

2016-09-05 Thread Smith
On 05/09/2016 17:57, jmp wrote: Is that what you're expecting ? A slightly different version: import glob, os a = input("search for files with the extension .py into directory: ") print glob.glob(os.path.join(a, '*.py')) jm Thank you Sorry, but i'm newbie :-( -- https://mail.python.org/ma

Re: listdir

2016-09-05 Thread Smith
What exactly are you expecting the 'break' to do here? Can you explain to me the intent of your code? ChrisA I'd like to create a script that searches the directory .py files. If the script does not find the file extension .py would return the error message "File Not Found". -- https://mai

Class - error return

2016-09-06 Thread Smith
Hi, you can help me ? I can not understand where is the error in this script. Use Python3. In [71]: class Day(object): ...: def __init__(self,visits,contacts): ...: self.visits = visits ...: self.contacts = contacts ...: def __add__(self,other): ...:

Re: Class - error return

2016-09-06 Thread Smith
On 06/09/2016 11:23, Peter Otten wrote: If so look at > ...: def __str__(self): > ...: return "Visitor: %i, Contacts: %i % > (self.visits,self.contacts)" once more. Where are the quotes? Where should the be? I solved the problem. thank you Peter -- https://mail.python

Re: Class - error return

2016-09-06 Thread Smith
From: Smith On 06/09/2016 11:23, Peter Otten wrote: > If so look at > >> > ...: def __str__(self): >> > ...: return "Visitor: %i, Contacts: %i % >> > (self.visits,self.contacts)" > once more. Where are the quotes? Where should

To improve a script

2016-12-17 Thread Smith
Hello guys, can someone help me to improve this script? https://github.com/githubdavide/mitm/blob/master/mitm.py Thank you in advance Cheers -- https://mail.python.org/mailman/listinfo/python-list

sorting list python

2017-01-18 Thread Smith
Hi all, could you do better? Thank you in advance link code: https://repl.it/FMin/8 -- https://mail.python.org/mailman/listinfo/python-list

Re: sorting list python

2017-01-18 Thread Smith
On 18/01/2017 21:20, Peter Otten wrote: with open("partite.txt") as f: by_number = sorted(f, key=lambda line: int(line.partition("'")[0])) print("".join(by_number)) Great!!! :-) -- https://mail.python.org/mailman/listinfo/python-list

Re: sorting list python

2017-01-18 Thread Smith
On 18/01/2017 21:21, Grant Edwards wrote: I would have done better by posting the actual code instead of a blind link that may point to Dog-knows-what... sorry :-( -- https://mail.python.org/mailman/listinfo/python-list

Re: sorting list python

2017-01-18 Thread Smith
On 18/01/2017 21:34, MRAB wrote: If you're wondering about the blank lines, it's because the lines end with '\n', which starts a new line, and the print function also starts a new line after printing the string. Try stripping the '\n' off the end of the line read in with the .rstrip method. Th

Help me

2016-03-29 Thread Smith
https://github.com/githubdavide/ip-pubblico-send/blob/master/ip-pubblico.py -- https://mail.python.org/mailman/listinfo/python-list

Re: Help me

2016-03-30 Thread Smith
Il 29/03/2016 11:17, Ben Finney ha scritto: Smith writes: [a URL] You'll get better help if you: * Summarise the problem briefly in the Subject field. * Actually say anything useful in the message body. thanks a lot -- https://mail.python.org/mailman/listinfo/python-list

Python,ping,csv

2016-04-08 Thread Smith
Hello to all, I have this little script that pings certain ip addresses. Considering that I am a newbie to the Python programming language, can you help me change these lines in order to put the output into a csv file? Sorry for unclear English Thanks in advance import subprocess for ping in

Re: Python,ping,csv

2016-04-11 Thread Smith
Il 10/04/2016 05:29, Jason Friedman ha scritto: for ping in range(1,254): address = "10.24.59." + str(ping) res = subprocess.call(['ping', '-c', '3', address]) if res == 0: print ("ping to", address, "OK") elif res == 2: print ("no response from", address)

Re: Python,ping,csv

2016-04-11 Thread Smith
Il 10/04/2016 05:29, Jason Friedman ha scritto: for ping in range(1,254): address = "10.24.59." + str(ping) res = subprocess.call(['ping', '-c', '3', address]) if res == 0: print ("ping to", address, "OK") elif res == 2: print ("no response from", address)

Basic Concepts

2016-04-27 Thread Smith
Fill in the blanks to declare a variable, add 5 to it and print its value: >>> x = 4 >>> x_ = 5 >>> print_ Any suggestion ? Thanks -- https://mail.python.org/mailman/listinfo/python-list

environment variable

2017-06-24 Thread Smith
Hello to all, I wanted to ask you how I could delete a line of an environment variable (PATH) ~/Scaricati/pycharm-2017.1.4/bin$ echo $PATH | sed s/:/'\n'/g /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /path/to/my/program ---> linea da elimi

Compare files excel

2017-07-22 Thread Smith
Hello to all, I should compare two excel files with pandas. Who can help me? Do you have any links? i tried this, but not working import pandas as pd df1 = pd.read_excel('excel1.xlsx') df2 = pd.read_excel('excel2.xlsx') difference = df1[df1!=df2] print (difference) Thank you -- https://mail.p

Re: Compare files excel

2017-07-23 Thread Smith
On 22/07/2017 22:21, Albert-Jan Roskam wrote: (sorry for top posting) Try: df1['difference'] = (df1 == df2).all(axis=1) here below there is the mistake : In [17]: diff = df1['difference'] = (df1 == df2).all(axis=1)

Re: Compare files excel

2017-07-23 Thread Smith
On 22/07/2017 22:21, Albert-Jan Roskam wrote: df1['difference'] = (df1 == df2).all(axis=1) below here there is the mistake : In [17]: diff = df1['difference'] = (df1 == df2).all(axis=1) --- ValueError

Re: First python program, syntax error in while loop

2013-05-06 Thread Roy Smith
In article , Mark Lawrence wrote: > > while (number != guess) and (tries < 5): > > One of these days I'll work out why some people insist on using > superfluous parentheses in Python code. Could it be that they enjoy > exercising their fingers by reaching for the shift key in conjunction >

Re: First python program, syntax error in while loop

2013-05-06 Thread Roy Smith
In article , Chris Angelico wrote: >On Mon, May 6, 2013 at 11:08 PM, Roy Smith wrote: >> On the other hand, I've long since given up trying to remember operator >> precedence in various languages. If I ever have even the slightest >> doubt, I just go ahead and put in

Re: First python program, syntax error in while loop

2013-05-06 Thread Roy Smith
In article , alex23 wrote: > On May 6, 10:37 pm, Mark Lawrence wrote: > > One of these days I'll work out why some people insist on using > > superfluous parentheses in Python code.  Could it be that they enjoy > > exercising their fingers by reaching for the shift key in conjunction > > with

Re: Red Black Tree implementation?

2013-05-06 Thread duncan smith
On 03/05/13 03:00, Dan Stromberg wrote: On Wed, May 1, 2013 at 7:06 PM, duncan smith mailto:buzzard@invalid.invalid>> wrote: I have an implementation that you can try out. It's not based on any other implementation, so my bugs will be independent of any bugs in the

Re: formatted output

2013-05-07 Thread Roy Smith
In article , Sudheer Joseph wrote: > Dear members, > I need to print few arrays in a tabular form for example below > array IL has 25 elements, is there an easy way to print this as > 5x5 comma separated table? in python > > IL=[] > for i in np.arange(1,bno

Re: Red Black Tree implementation?

2013-05-07 Thread duncan smith
On 07/05/13 02:20, Dan Stromberg wrote: [snip] I'm starting to think Red Black Trees are pretty complex. A while ago I looked at a few different types of self-balancing binary tree. Most look much easier to implement. BTW, the licence might be MIT - I just copied it from someone else's

Re: multiple versions of python

2013-05-07 Thread Roy Smith
In article <72f93710-9812-441e-8d3d-f221d5698...@googlegroups.com>, sokovic.anamar...@gmail.com wrote: > Hi, > > what is the generally recommended structure when we have into play this type > of problem: > multiple versions of python (both in the sense of main versions and sub > versions, e.g.

Re: Making safe file names

2013-05-07 Thread Roy Smith
In article , Dave Angel wrote: > On 05/07/2013 03:58 PM, Andrew Berg wrote: > > Currently, I keep Last.fm artist data caches to avoid unnecessary API calls > > and have been naming the files using the artist name. However, > > artist names can have characters that are not allowed in file names

Re: multiple versions of python

2013-05-07 Thread Roy Smith
In article , "Colin J. Williams" wrote: > Do you really need more than 2.7.3 and 3.3.1. It's often useful to have older versions around, so you can test your code against them. Lots of projects try to stay compatible with older releases. -- http://mail.python.org/mailman/listinfo/python-li

Re: Making safe file names

2013-05-07 Thread Roy Smith
In article , Dave Angel wrote: > While we're looking for trouble, there's also case insensitivity. > Unclear if the user cares, but tom and TOM are the same file in most > configurations of NT. OSX, too. -- http://mail.python.org/mailman/listinfo/python-list

Re: object.enable() anti-pattern

2013-05-08 Thread Roy Smith
In article <518a123c$0$11094$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: > I'm looking for some help in finding a term, it's not Python-specific but > does apply to some Python code. > > This is an anti-pattern to avoid. The idea is that creating a resource > ought to be the same as "t

Unicode humor

2013-05-08 Thread Roy Smith
Apropos to any of the myriad unicode threads that have been going on recently: http://xkcd.com/1209/ -- http://mail.python.org/mailman/listinfo/python-list

Style question -- plural of class name?

2013-05-08 Thread Roy Smith
FooEntry is a class. How would you describe a list of these in a docstring? "A list of FooEntries" "A list of FooEntrys" "A list of FooEntry's" "A list of FooEntry instances" The first one certainly sounds the best, but it seems wierd to change the spelling of the class name to make it plural

Re: Red Black Tree implementation?

2013-05-08 Thread duncan smith
On 07/05/13 02:20, Dan Stromberg wrote: On Mon, May 6, 2013 at 5:55 PM, duncan smith mailto:buzzard@invalid.invalid>> wrote: [snip] I'd prefer Apache or MIT or BSD 3-clause, but I could probably work with this. http://joinup.ec.europa.eu/community/eupl/news/licence-proliferat

Re: Making safe file names

2013-05-08 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > On Tue, 07 May 2013 18:10:25 -0500, Andrew Berg > declaimed the following in > gmane.comp.python.general: > > > None of these would work because I would have no idea which file stores > > data for which artist without writing code to figure it out. If I

Re: Making safe file names

2013-05-08 Thread Roy Smith
In article <518b00a2$0$29997$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > > When somebody types in > > "Blue Oyster Cult", they really mean "Blue Oyster Cult", > > Surely they really mean Blue Öyster Cult. Yes. The oomlaut was there when I typed it. Who knows what happened

Re: Red Black Tree implementation?

2013-05-08 Thread duncan smith
On 09/05/13 02:40, Dan Stromberg wrote: OK, I've got one copy of trees.py with md5 211f80c0fe7fb9cb42feb9645b4b3ffe. You seem to be saying I should have two though, but I don't know that I do... I've just re-sent it. Duncan -- http://mail.python.org/mailman/listinfo/python-list

Re: Making safe file names

2013-05-09 Thread Roy Smith
In article <518b133b$0$29997$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > I suspect that the only way to be completely ungoogleable would be to > name yourself something common, not something obscure. http://en.wikipedia.org/wiki/The_band -- http://mail.python.org/mailman/lis

Re: object.enable() anti-pattern

2013-05-09 Thread Roy Smith
In article <518b32ef$0$11120$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: > There is no sensible use-case for creating a file without opening it. Sure there is. Sometimes just creating the name in the file system is all you want to do. That's why, for example, the unix "touch" command

Re: Red Black Tree implementation?

2013-05-09 Thread duncan smith
On 09/05/13 02:40, Dan Stromberg wrote: OK, I've got one copy of trees.py with md5 211f80c0fe7fb9cb42feb9645b4b3ffe. You seem to be saying I should have two though, but I don't know that I do... [snip] Yes, 211f80c0fe7fb9cb42feb9645b4b3ffe is the correct checksum for the latest version. The

Re: object.enable() anti-pattern

2013-05-09 Thread Roy Smith
In article <518be931$0$29997$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > There is no sensible use-case for creating a file OBJECT unless it > initially wraps an open file pointer. OK, I guess that's a fair statement. But mostly because a python file object only exposes those

Re: object.enable() anti-pattern

2013-05-09 Thread Roy Smith
In article , Michael Speer wrote: > By his reasoning it simply shouldn't exist. Instead you would access the > information only like this: > > with open("myfile.dat") as f: > data = f.read() The problem with things like file objects is they model external real-world entities, which have ext

Re: object.enable() anti-pattern

2013-05-09 Thread Roy Smith
In article <518c5bbc$0$29997$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > I must admit I am astonished at how controversial the opinion "if your > object is useless until you call 'start', you should automatically call > 'start' when the object is created" has turned out to be

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Roy Smith
In article , Chris Angelico wrote: > The first hard disk I ever worked with stored 20MB in the space of a > 5.25" slot (plus its associated ISA controller card). Heh. The first hard disk I ever worked with stored 2.4 MB in 6U of rack space (plus 4 Unibus cards worth of controller). That's no

Re: object.enable() anti-pattern

2013-05-09 Thread Roy Smith
In article <518c7f05$0$29997$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > there is no way to create a C file descriptor in a closed state. Such > a thing does not exist. If you have a file descriptor, the file is > open. Once you close it, the file descriptor is no longer vali

Re: Message passing syntax for objects | OOPv2

2013-05-10 Thread Roy Smith
On May 10, 2013, at 7:49 AM, William Ray Wing wrote: > On May 10, 2013, at 12:55 AM, Roy Smith wrote: > >> In article , >> Chris Angelico wrote: >> >>> The first hard disk I ever worked with stored 20MB in the space of a >>> 5.25" slot (plus

Re: object.enable() anti-pattern

2013-05-10 Thread Roy Smith
In article <518cc239$0$29997$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > > int fd = 37; > > > > I've just created a file descriptor. There is not enough information > > given to know if it corresponds to an open file or not. > > No, you haven't created a file descriptor. You

Re: object.enable() anti-pattern

2013-05-10 Thread Roy Smith
In article , Robert Kern wrote: > I'd be curious to see in-the-wild instances of the anti-pattern that > you are talking about, then. I think everyone agrees that entirely > unmotivated "enable" methods should be avoided, but I have my doubts > that they come up very often. As I mentioned e

Re: object.enable() anti-pattern

2013-05-10 Thread Roy Smith
In article , Oscar Benjamin wrote: > It's not just because of exceptions. In C++ virtual method calls in a > constructor for a class A will always call the methods of class A even > if the object being constructed is actually of a subclass B because > the B part of the object isn't initialised w

Re: object.enable() anti-pattern

2013-05-10 Thread Roy Smith
In article , Chris Angelico wrote: > On Sat, May 11, 2013 at 12:37 AM, Roy Smith wrote: > > I suppose, if I had a class like this, I would write a factory function > > which called the constructor and post-construction initializer. And > > then I would make the

Re: object.enable() anti-pattern

2013-05-10 Thread Roy Smith
In article , Chris Angelico wrote: > > Each language has its own set of best practices. Trying to write C++ > > code using Python patterns is as bad as trying to write Python code > > using C++ patterns. > > Agreed, in generality. But what is actually gained by hiding data from > yourself? Y

Re: object.enable() anti-pattern

2013-05-10 Thread Roy Smith
In article , Nobody wrote: > However: there are situations where it is useful to be able to separate > the simple task of creating an object from more invasive actions such as > system calls. Particularly in multi-threaded or real-time code (although > the latter is a non-starter in Python for m

Re: object.enable() anti-pattern

2013-05-11 Thread Roy Smith
In article <518df898$0$29997$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > I never intended to give the impression that *any* use of a separate > "enable" method call was bad. I certainly didn't intend to be bogged > down into a long discussion about the minutia of file descrip

Re: Red Black Tree implementation?

2013-05-11 Thread duncan smith
On 12/05/13 00:24, Dan Stromberg wrote: I'm afraid I'm having some trouble with the module. I've checked it into my SVN at http://stromberg.dnsalias.org/svn/red-black-tree-mod/trunk/duncan I have two versions of your tests in there now - "t" is minimally changed, and test-red_black_tree_mod is

Re: Red Black Tree implementation?

2013-05-11 Thread duncan smith
On 12/05/13 02:29, Dan Stromberg wrote: On Sat, May 11, 2013 at 4:24 PM, Dan Stromberg mailto:drsali...@gmail.com>> wrote: I'm afraid I'm having some trouble with the module. I've checked it into my SVN at http://stromberg.dnsalias.org/svn/red-black-tree-mod/trunk/duncan I ha

Re: Red Black Tree implementation?

2013-05-12 Thread duncan smith
On 12/05/13 03:02, duncan smith wrote: On 12/05/13 02:29, Dan Stromberg wrote: On Sat, May 11, 2013 at 4:24 PM, Dan Stromberg mailto:drsali...@gmail.com>> wrote: [snip] What should BinaryTree.find() do if it finds a data.node that is None? A call to "find(data)" should

Re: Illegal seek error with seek() and os.lseek()

2013-05-14 Thread Roy Smith
In article <50bf9366-46e0-4a7f-865b-3f7c7b0f6...@googlegroups.com>, krishna2pra...@gmail.com wrote: > I am trying to use os.open() and os.lseek() methods to operate on a device > file in Linux. My code goes something like this - > > # first, open the file as a plain binary > try: > self.

Re: Determine actually given command line arguments

2013-05-15 Thread Roy Smith
In article , Henry Leyh wrote: > Is there a simple way to determine which > command line arguments were actually given on the commandline, i.e. does > argparse.ArgumentParser() know which of its namespace members were > actually hit during parse_args(). I think what you're looking for is sys

Re: Determine actually given command line arguments

2013-05-15 Thread Roy Smith
In article , Henry Leyh wrote: >On 15.05.2013 14:24, Roy Smith wrote: >> In article , >> Henry Leyh wrote: >> >>> Is there a simple way to determine which >>> command line arguments were actually given on the commandline, i.e. does >>> argpa

executing python scripts that are symlinked

2013-05-16 Thread Charles Smith
Hi. How can I say, from the cmd line, that python should take my CWD as my CWD, and not the directory where the script actually is? I have a python script that works fine when it sits in directory WC, but if I move it out of WC to H and put a symlink from H/script to WC, it doesn't find the pack

Re: executing python scripts that are symlinked

2013-05-16 Thread Charles Smith
On 16 Mai, 10:18, Dave Angel wrote: > On 05/16/2013 03:48 AM, Charles Smith wrote: > > > Hi. > > > How can I say, from the cmd line, that python should take my CWD as my > > CWD, and not the directory where the script actually is? > > > I have a python sc

Re: executing python scripts that are symlinked

2013-05-16 Thread Charles Smith
On 16 Mai, 11:04, Steven D'Aprano wrote: > Python does use your current working directory as your current working > directory. I think you are misdiagnosing the problem. That's usually how it ends up ... > > Here's a demonstration: > > steve@runes:~$ cat test.py > import os > print os.getcwd(

Re: Two Dictionaries and a Sum!

2013-05-18 Thread Roy Smith
In article <6012d69f-b65e-4d65-90c4-f04876853...@googlegroups.com>, Bradley Wright wrote: > Confusing subject for a confusing problem (to a novice like me of course!) > Thx for the help in advance folks > > I have (2) dictionaries: > > prices = { > "banana": 4, > "apple": 2, > "ora

Re: python script is not running

2013-05-18 Thread Roy Smith
In article , Chris Angelico wrote: > On Sat, May 18, 2013 at 8:12 PM, Avnesh Shakya wrote: > > avin@hp:~$ crontab -e > > then type - > > */2 * * * * python /home/avin/data/try.py > > > > You may need to put an explicit path to your Python interpreter. Type: > > $ which python > > and put tha

Re: How to write fast into a file in python?

2013-05-18 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > tOn Sat, 18 May 2013 08:49:55 +0100, Fábio Santos > declaimed the following in > gmane.comp.python.general: > > > > You mentioned "\n" translating to two lines, but this won't happen. Windows > > will not mess with what you write to your file. It's just

Re: What was the project that made you feel skilled in Python?

2013-05-19 Thread Roy Smith
In article , Ned Batchelder wrote: > So here's a question for people who remember coming up from beginner: as > you moved from exercises like those in Learn Python the Hard Way, up to > your own self-guided work on small projects, what project were you > working on that made you feel independ

subclassing from unittest

2013-05-22 Thread Charles Smith
Hi, I'd like to subclass from unittest.TestCase. I observed something interesting and wonder if anyone can explain what's going on... some subclasses create null tests. I can create this subclass and the test works: class StdTestCase (unittest.TestCase): blahblah and I can create this

Re: subclassing from unittest

2013-05-22 Thread Charles Smith
On 22 Mai, 17:32, Charles Smith wrote: > Hi, > > I'd like to subclass from unittest.TestCase.  I observed something > interesting and wonder if anyone can explain what's going on... some > subclasses create  null tests. > > I can create this subclass and the test

Re: subclassing from unittest

2013-05-23 Thread Roy Smith
In article , Ulrich Eckhardt wrote: > if you have an intermediate class derived > from unittest.TestCase, that class on its own will be considered as test > case! If this is not what you want but you still want common > functionality in a baseclass, create a mixin and then derive from both >

Debugging parallel nose tests?

2013-05-23 Thread Roy Smith
I've got a suite of about 150 tests written using unittest. It takes 5-10 minutes to run, so I'd really like to use nose to run things in parallel. The problem is, when I do that, I get lots of test failures. Obviously, we've got some kind of inter-test dependency that I haven't been able to

Re: Ordered dictionaries compared

2013-05-23 Thread duncan smith
On 23/05/13 04:31, Dan Stromberg wrote: What kind of ordered dictionaries? Sorted by key. I've redone the previous comparison, this time with a better red-black tree implementation courtesy of Duncan G. Smith. The comparison is at http://stromberg.dnsalias.org/~strombrg/python-tree-and

Re: Ordered dictionaries compared

2013-05-23 Thread duncan smith
On 23/05/13 18:44, Dan Stromberg wrote: On Thu, May 23, 2013 at 9:41 AM, duncan smith mailto:buzzard@invalid.invalid>> wrote: RBT is quicker than Treap for insertion with randomized data, but slower with ordered data. Randomized data will tend to minimize the number o

Re: Debugging parallel nose tests?

2013-05-23 Thread Roy Smith
In article , Dave Angel wrote: > On 05/23/2013 09:09 AM, Roy Smith wrote: > > > > > > > > nosetests --process-timeout=60 --processes=40 test_api.py > > > > Do you have a 40-processor system? No, but many of the tests are I/O bound. > And

Re: Debugging parallel nose tests?

2013-05-24 Thread Roy Smith
On May 24, 2013, at 5:05 AM, Jean-Michel Pichavant wrote: > - Original Message - >> In article , >> Dave Angel wrote: >> >>> On 05/23/2013 09:09 AM, Roy Smith wrote: >>>> >>>> >>>> >>>> nosetests -

Re: Utility to locate errors in regular expressions

2013-05-24 Thread Roy Smith
In article , Malte Forkel wrote: > Finding out why a regular expression does not match a given string can > very tedious. I would like to write a utility that identifies the > sub-expression causing the non-match. My idea is to use a parser to > create a tree representing the complete regular ex

Re: Utility to locate errors in regular expressions

2013-05-24 Thread Roy Smith
In article , Devin Jeanpierre wrote: > On Fri, May 24, 2013 at 8:58 AM, Malte Forkel wrote: > > As a first step, I am looking for a parser for Python regular > > expressions, or a Python regex grammar to create a parser from. > > the sre_parse module is undocumented, but very usable. > > > Bu

Re: Simple algorithm question - how to reorder a sequence economically

2013-05-24 Thread duncan smith
On 24/05/13 10:11, Chris Angelico wrote: On Fri, May 24, 2013 at 6:47 PM, Fábio Santos wrote: On 24 May 2013 09:41, "Chris Angelico" wrote: On Fri, May 24, 2013 at 6:14 PM, Peter Brooks wrote: What is the easiest way to reorder a sequence pseudo-randomly? That is, for a sequence 1,2,3,4

Re: Debugging parallel nose tests?

2013-05-24 Thread Roy Smith
In article , Roy Smith wrote: > Is there some way to make nose print a report of how it partitioned the > tests across the various processes? I never found such a feature, but I did figure out a way to do what I needed. We use a system of unique id's to track HTTP requests t

Preventing nose from finding setup.py

2013-05-24 Thread Roy Smith
We've got a package (with an empty __init__.py), which contains a setup.py file. When I run nosetests, the test discovery code finds setup.py, thinks it's a test, and tries to run it (with predictably poor results). Is there some way to mark this file as not a test? If it was a method in a fi

Re: Preventing nose from finding setup.py

2013-05-24 Thread Roy Smith
In article , Roy Smith wrote: > We've got a package (with an empty __init__.py), which contains a > setup.py file. When I run nosetests, the test discovery code finds > setup.py, thinks it's a test, and tries to run it (with predictably poor > results). Ugh, I descri

Re: Python Magazine

2013-05-24 Thread Roy Smith
In article <27969350-4dd8-4afa-881a-b4a2364b3...@googlegroups.com>, DRJ Reddy wrote: > Planning to start a python online chronicle.What you want to see in it. :) Issue 1: "Whitespace as syntax: mistake or magic?" "Python 3 vs. IPv6: who will win the race for early adoption?" "Did Python 3 br

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-25 Thread Roy Smith
In article <78192328-b31b-49d9-9cd6-ec742c092...@googlegroups.com>, lokeshkopp...@gmail.com wrote: > On Friday, May 24, 2013 1:34:51 PM UTC+5:30, lokesh...@gmail.com wrote: > > i need to write a code which can sort the list in order of 'n' without use > > builtin functions > > > > can anyone h

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-25 Thread Roy Smith
In article <74e33270-a79a-4878-a400-8a6cda663...@googlegroups.com>, lokeshkopp...@gmail.com wrote: > ya steven i had done the similar logic but thats not satisfying my professor > he had given the following constrains > 1. No in-built functions should be used > 2. we are expecting a O(n) solut

Re: Python Magazine

2013-05-25 Thread Roy Smith
In article , Chris Angelico wrote: > > Also, comparison of Python flavors (CPython, PyPy, Cython, Stackles, etc.) Stackles? That sounds like breakfast cereal. "New all-natural stackles, with 12 essential vitamins, plus fiber!" -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Magazine

2013-05-25 Thread Roy Smith
In article <51a0caac$0$30002$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Sat, 25 May 2013 16:41:58 +1000, Chris Angelico wrote: > > > On Sat, May 25, 2013 at 4:38 PM, zoom wrote: > >> But why would anyone want to use IPv6? > > > > I hope you're not serious :) > > He's pl

Re: Simple algorithm question - how to reorder a sequence economically

2013-05-25 Thread Roy Smith
In article <15a1bb3a-514c-454e-a966-243c84123...@googlegroups.com>, John Ladasky wrote: > Because someone's got to say it... "The generation of random numbers is too > important to be left to chance." ‹ Robert R. Coveyou Absolutely. I know just enough about random number generation to unders

Re: Python Magazine

2013-05-25 Thread Roy Smith
In article <7cd17be8-d455-4db8-b8d0-ccc757db5...@googlegroups.com>, John Ladasky wrote: > On Saturday, May 25, 2013 8:30:19 AM UTC-7, Roy Smith wrote: > > From my phone, I > > can call any other phone anywhere in the world. But I can't talk > > directly to

Re: Python Magazine

2013-05-25 Thread Roy Smith
In article <8f19e20c-4f77-43dc-a732-4169e482d...@googlegroups.com>, John Ladasky wrote: > A perfectly fair point, Roy. It's just when you started suggesting > connecting to your neighbor's file server -- well, that's not something that > many people would ordinarily do. So, my mind leaped to

Re: Short-circuit Logic

2013-05-26 Thread Roy Smith
In article <5f101d70-e51f-4531-9153-c92ee2486...@googlegroups.com>, Ahmed Abdulshafy wrote: > Hi, > I'm having a hard time wrapping my head around short-circuit logic that's > used by Python, coming from a C/C++ background; so I don't understand why the > following condition is written this wa

Re: Solving the problem of mutual recursion

2013-05-26 Thread Roy Smith
In article , Jussi Piitulainen wrote: > A light-weighter way is to have each task end by assigning the next > task and returning, instead of calling the next task directly. When a > task returns, a driver loop will call the assigned task, which again > does a bounded amount of work, assigns the

Re: Future standard GUI library

2013-05-26 Thread Roy Smith
In article <20130526194310.9cdb1be80b42c7fdf0ba5...@gmx.net>, Wolfgang Keller wrote: > HTTP will never be a suitable transport layer for a RPC protocol. What, in particular, is wrong with HTTP for doing RPC? RPC is pretty straight-forward. Take this method, run it over there, with these arg

  1   2   3   4   5   6   7   8   9   10   >