Re: Pass numeric arrays from C extensions to Python

2012-09-23 Thread Oscar Benjamin
On 24 September 2012 02:39, JBT wrote: > Hi, > > I am looking for a way to pass numeric arrays, such as *float a[100]; > double b[200];*, from C extension codes to python. The use case of this > problem is that you have data stored in a particular format, NASA common > data format (CDF) in my cas

Re: Anyone able to help on installing packages?

2012-09-24 Thread Oscar Benjamin
On 24 September 2012 21:27, John Mordecai Dildy wrote: > Anyone have Ideas on nose and distribute? Your post has no context and simply asks a very vague question. Had you explained what you tried and what happened and perhaps shown an error message I might have been able to answer your question

Re: python file API

2012-09-24 Thread Oscar Benjamin
On 24 September 2012 22:35, zipher wrote: > For some time now, I've wanted to suggest a better abstraction for the > type in Python. It currently uses an antiquated C-style interface > for moving around in a file, with methods like tell() and seek(). But > after attributes were introduced to P

Re: python file API

2012-09-24 Thread Oscar Benjamin
On 24 September 2012 23:41, Mark Adam wrote: > > seek() and tell() can raise exceptions on some files. Exposing pos as an > > attribute and allowing it to be manipulated with attribute access gives > the > > impression that it is always meaningful to do so. > > It's a good point, python already

Re: For Counter Variable

2012-09-24 Thread Oscar Benjamin
On 25 September 2012 01:17, Dwight Hutto wrote: > > Is the animated GIF on your website under 60MB yet? > yeah a command line called convert, and taking out a few jpegs used to > convert, and I can reduce it to any size, what's the fucking point of > that question other than ignorant rhetoric, th

Re: python file API

2012-09-25 Thread Oscar Benjamin
On Sep 25, 2012 9:28 AM, "Dennis Lee Bieber" wrote: > > On Tue, 25 Sep 2012 08:22:05 +0200, Ulrich Eckhardt > declaimed the following in > gmane.comp.python.general: > > > Am 24.09.2012 23:49, schrieb Dave Angel: > > > And what approach would you use for positioning relative to > > > end-of-file?

Re: python file API

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 08:27, Mark Lawrence wrote: > On 25/09/2012 03:32, Mark Adam wrote: > >> On Mon, Sep 24, 2012 at 5:55 PM, Oscar Benjamin >> wrote: >> >>> try: >>> f.pos = 256 >>> except IOError: >>> print

Re: python file API

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 11:51, Mark Lawrence wrote: > On 25/09/2012 11:38, Oscar Benjamin wrote: > >> On 25 September 2012 08:27, Mark Lawrence >> wrote: >> >> On 25/09/2012 03:32, Mark Adam wrote: >>> >>> On Mon, Sep 24, 2012 at 5:5

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 00:58, Junkshops wrote: > Hi Tim, thanks for the response. > > > - check how you're reading the data: are you iterating over >>the lines a row at a time, or are you using >>.read()/.readlines() to pull in the whole file and then >>operate on that? >> > I'm using

Re: Python 3 crashes with 'Py_Initialize: can't initialize sys standard streams' + 'EOFError: EOF read where not expected'

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 12:32, Robison Santos wrote: > Hello guys, > > I'm having a very serious problem with my python3 environment and I'm > completely lost about the problem. > In my server I run two python apps (custom apps) during system start time, > and sometime when the apps are starting a c

Re: Python 3 crashes with 'Py_Initialize: can't initialize sys standard streams' + 'EOFError: EOF read where not expected'

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 14:56, Robison Santos wrote: > I'm using python3.2.1 > on Enterprise Linux Server release 5.3 (Carthage). > > I'm starting my apps calling python3 file.py > > I have a script that runs on system startup executing my python scripts. > What happens if you just run the script

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 19:08, Junkshops wrote: > > Can you give an example of how these data structures look after reading > only the first 5 lines? > > Sure, here you go: > > In [38]: mpef._ustore._store > Out[38]: defaultdict(, {'Measurement': > {'8991c2dc67a49b909918477ee4efd767': > , > '7b38b4

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 21:26, Junkshops wrote: > On 9/25/2012 11:17 AM, Oscar Benjamin wrote: > > On 25 September 2012 19:08, Junkshops wrote: > >> >> In [38]: mpef._ustore._store >> Out[38]: defaultdict(, {'Measurement'

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 23:09, Ian Kelly wrote: > On Tue, Sep 25, 2012 at 12:17 PM, Oscar Benjamin > wrote: > > Also I think lambda functions might be able to keep the frame alive. Are > > they by any chance being created in a function that is called in a loop? > > I&

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 23:10, Tim Chase wrote: > On 09/25/12 16:17, Oscar Benjamin wrote: > > I don't know whether it would be better or worse but it might be > > worth seeing what happens if you replace the FileContext objects > > with tuples. > > If tuples pro

Re: Need to archive a MySQL database using a python script

2012-09-25 Thread Oscar Benjamin
On 26 September 2012 00:17, wrote: > Python Users Group, > > I need to archive a MySQL database using a python script. > I found a good example at: https://gist.github.com/3175221 > > The following line executes however, the archive file is empty. > > os.popen("mysqldump -u %s -p%s -h %s -e --opt

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Oscar Benjamin
On 26 September 2012 00:35, Tim Chase wrote: > On 09/25/12 17:55, Oscar Benjamin wrote: > > On 25 September 2012 23:10, Tim Chase > wrote: > >> If tuples provide a savings but you find them opaque, you might also > >> consider named-tuples for clarity. > > &g

Re: How to get progress in python script.

2012-09-30 Thread Oscar Benjamin
On 28 September 2012 17:26, Rolando Cañer Roblejo wrote: > Hi all, > > Please, I need you suggest me a way to get statistics about a progress of > my python script. My python script could take a lot of time processing a > file, so I need a way that an external program check the progress of the > s

Re: unit testing class hierarchies

2012-10-03 Thread Oscar Benjamin
On 3 October 2012 02:20, Steven D'Aprano wrote: > > But surely, regardless of where that functionality is defined, you still > need to test that both D1 and D2 exhibit the correct behaviour? Otherwise > D2 (say) may break that functionality and your tests won't notice. > > Given a class hierarchy

Re: Combinations of lists

2012-10-03 Thread Oscar Benjamin
On 3 October 2012 15:26, Steen Lysgaard wrote: > Hi, > > I am looking for a clever way to compute all combinations of two lists. Look > at this example: > > h = ['A','A','B','B'] > m = ['a','b'] > > the resulting combinations should be of the same length as h and each > element in m can be used tw

Re: Combinations of lists

2012-10-03 Thread Oscar Benjamin
Oscar wrote: >>> def uniquecombinations(h, m): >>> for ha in submultisets(h, len(h)//2): >>> hb = list(h) >>> for c in ha: >>> hb.remove(c) >>> yield [m[0] + a for a in ha] + [m[1] + b for b in hb] >>> >>> h = ['A', 'A', 'B', 'B'] >>> m = ['a', 'b'] >>> >>> f

Re: fastest data structure for retrieving objects identified by (x, y) tuple?

2012-10-04 Thread Oscar Benjamin
On Oct 4, 2012 3:02 AM, "Steven D'Aprano" < steve+comp.lang.pyt...@pearwood.info> wrote: > # populate a random matrix using both dict and list > adict = {} > alist = [[None]*2400 for i in range(2400)] > from random import randrange > for i in range(1000): > x = randrange(2400) > y = randran

Re: final question: logging to stdout and updating files

2012-10-04 Thread Oscar Benjamin
On 4 October 2012 04:11, Littlefield, Tyler wrote: > pHello all: > I've seen frameworks like django reload files when it detects that they've > been changed; how hard would it be to make my engine reload files that it > detects were changed? I tend to think that it's better to reload things expli

Re: Why is pylaucher in Python 3.3 being installed in Windows folder?

2012-10-04 Thread Oscar Benjamin
On 4 October 2012 16:51, Ian Kelly wrote: > On Thu, Oct 4, 2012 at 8:41 AM, Piotr Dobrogost > wrote: >> Now, the question is why not put pylauncher together with python.exe >> now, when 3.3 has an option to add Python's folder to the PATH? In >> case there are more than one Python installed this

Re: getting the state of an object

2012-10-07 Thread Oscar Benjamin
On Oct 7, 2012 9:57 AM, "Franck Ditter" wrote: > > Hi ! > > Another question. When writing a class, I have often to > destructure the state of an object as in : > > def foo(self) : > (a,b,c,d) = (self.a,self.b,self.c,self.d) > ... big code with a,b,c,d ... > What's wrong with the above? I

Re: Feedback on my python framework I'm building.

2012-10-13 Thread Oscar Benjamin
On 13 October 2012 17:48, Chris Angelico wrote: > > The only way to support *absolutely everything* is to do nothing - to > be a framework so thin you're invisible. (That's not to say you're > useless; there are bridge modules that do exactly this - ctypes can > call on any library function from P

Re: Aggressive language on python-list

2012-10-17 Thread Oscar Benjamin
On 17 October 2012 19:16, Chris Angelico wrote: > On Thu, Oct 18, 2012 at 3:48 AM, wrote: >>On 10/16/2012 08:45 PM, Steven D'Aprano wrote: >>> Except that you've made a 180- >>> degree turn from your advice to "ignore" bad behaviour, but apparently >>> didn't notice that *sending private emails*

Re: list comprehension question

2012-10-17 Thread Oscar Benjamin
On 17 October 2012 06:09, Dwight Hutto wrote: > On Wed, Oct 17, 2012 at 12:43 AM, Kevin Anthony > wrote: >> Is it not true that list comprehension is much faster the the for loops? >> >> If it is not the correct way of doing this, i appoligize. >> Like i said, I'm learing list comprehension. >> >

Re: Aggressive language on python-list

2012-10-17 Thread Oscar Benjamin
On 18 October 2012 00:17, Steven D'Aprano wrote: > On Wed, 17 Oct 2012 14:10:34 -0700, rurpy wrote: > >> On 10/17/2012 02:28 PM, Oscar Benjamin wrote:> On 17 October 2012 19:16, >> Chris Angelico wrote: >>>> On Thu, Oct 18, 2012 at 3:48 AM, wrote: >&g

Re: locking files on Linux

2012-10-18 Thread Oscar Benjamin
On 18 October 2012 14:44, andrea crotti wrote: > 2012/10/18 Grant Edwards : >> On 2012-10-18, andrea crotti wrote: >> >> >> File locks under Unix have historically been "advisory". That means >> that programs have to _choose_ to pay attention to them. Most >> programs do not. >> >> Linux does s

Re: Inheritance Question

2012-10-18 Thread Oscar Benjamin
On 18 October 2012 15:10, Jeff Jeffries wrote: > Hello everybody > > When I set "AttributeChanges" in my example, it sets the same value for all > other subclasses. Can someone help me with what the name of this behavior is > (mutable class global?) ? I don't know any keywords... having troub

Re: locking files on Linux

2012-10-18 Thread Oscar Benjamin
On 18 October 2012 15:49, andrea crotti wrote: > 2012/10/18 Grant Edwards : >> >> If what you're guarding against is multiple instances of your >> application modifying the file, then either of the advisory file >> locking schemes or the separate lock file should work fine. > > Ok so I tried a sma

Re: locking files on Linux

2012-10-18 Thread Oscar Benjamin
On 18 October 2012 16:08, andrea crotti wrote: > 2012/10/18 Oscar Benjamin : >> >> Why not come up with a test that actually shows you if it works? Here >> are two suggestions: >> >> 1) Use time.sleep() so that you know how long the lock is held for. >> 2)

Re: Fast forward-backward (write-read)

2012-10-23 Thread Oscar Benjamin
On 23 October 2012 15:31, Virgil Stokes wrote: > I am working with some rather large data files (>100GB) that contain time > series data. The data (t_k,y(t_k)), k = 0,1,...,N are stored in ASCII > format. I perform various types of processing on these data (e.g. moving > median, moving average, an

Re: Fast forward-backward (write-read)

2012-10-28 Thread Oscar Benjamin
On 28 October 2012 14:20, Virgil Stokes wrote: > On 28-Oct-2012 12:18, Dave Angel wrote: >> >> On 10/24/2012 03:14 AM, Virgil Stokes wrote: >>> >>> On 24-Oct-2012 01:46, Paul Rubin wrote: Virgil Stokes writes: > > Yes, I do wish to inverse the order, but the "forward in time" f

Re: Negative array indicies and slice()

2012-10-29 Thread Oscar Benjamin
On 29 October 2012 23:01, Ian Kelly wrote: > On Mon, Oct 29, 2012 at 9:20 AM, Andrew Robinson > wrote: >> FYI: I was asking for a reason why Python's present implementation is >> desirable... >> >> I wonder, for example: >> >> Given an arbitrary list: >> a=[1,2,3,4,5,6,7,8,9,10,11,12] >> >> Why w

Re: is implemented with id ?

2012-11-03 Thread Oscar Benjamin
On 3 November 2012 22:50, Chris Angelico wrote: > This one I haven't checked the source for, but ISTR discussions on > this list about comparison of two unequal interned strings not being > optimized, so they'll end up being compared char-for-char. Using 'is' > guarantees that the check stops with

Re: Multi-dimensional list initialization

2012-11-05 Thread Oscar Benjamin
On 5 November 2012 09:13, Hans Mulder wrote: > On 5/11/12 07:27:52, Demian Brecht wrote: >> So, here I was thinking "oh, this is a nice, easy way to initialize a 4D >> matrix" >> (running 2.7.3, non-core libs not allowed): >> >> m = [[None] * 4] * 4 >> >> The way to get what I was after was: >> >

Re: Multi-dimensional list initialization

2012-11-05 Thread Oscar Benjamin
On 6 November 2012 02:01, Chris Angelico wrote: > On Tue, Nov 6, 2012 at 12:32 PM, Oscar Benjamin > wrote: >> I was just thinking to myself that it would be a hard thing to change >> because the list would need to know how to instantiate copies of all >> the different

Re: Multi-dimensional list initialization

2012-11-06 Thread Oscar Benjamin
On Nov 6, 2012 6:00 AM, "Andrew Robinson" wrote: > > On 11/05/2012 06:30 PM, Oscar Benjamin wrote: >> >> stuff = [[obj] * n] * m >> >> I thought that the multiplication of the inner list ([obj] * n) by m >> could create a new list of lists using

Re: Multi-dimensional list initialization

2012-11-07 Thread Oscar Benjamin
On Nov 7, 2012 5:41 AM, "Gregory Ewing" wrote: > > If anything is to be done in this area, it would be better > as an extension of list comprehensions, e.g. > > [[None times 5] times 10] > > which would be equivalent to > > [[None for _i in xrange(5)] for _j in xrange(10)] I think you're righ

Re: Multi-dimensional list initialization

2012-11-07 Thread Oscar Benjamin
On 7 November 2012 13:39, Joshua Landau wrote: > > On 7 November 2012 11:11, Oscar Benjamin wrote: >> >> A more modest addition for the limited case described in this thread could >> be to use exponentiation: >> >> >>> [0] ** (2, 3) >> [

Re: Multi-dimensional list initialization

2012-11-07 Thread Oscar Benjamin
On Nov 7, 2012 3:55 PM, "Ethan Furman" wrote: > > Oscar Benjamin wrote: >> >> A more modest addition for the limited case described in this thread could be to use exponentiation: >> >> >>> [0] ** (2, 3) >> [[0, 0, 0], [0, 0, 0]] > > &g

Re: Multi-dimensional list initialization

2012-11-07 Thread Oscar Benjamin
On 7 November 2012 22:16, Joshua Landau wrote: > On 7 November 2012 14:00, Oscar Benjamin wrote: >> On 7 November 2012 13:39, Joshua Landau >> wrote: >> > On 7 November 2012 11:11, Oscar Benjamin >> > wrote: >> >> A more modest addition for the limi

Re: creating size-limited tar files

2012-11-07 Thread Oscar Benjamin
On 7 November 2012 21:52, Andrea Crotti wrote: > On 11/07/2012 08:32 PM, Roy Smith wrote: >> >> In article <509ab0fa$0$6636$9b4e6...@newsspool2.arcor-online.net>, >> Alexander Blinne wrote: >> >>> I don't know the best way to find the current size, I only have a >>> general remark. >>> This sol

Re: Right solution to unicode error?

2012-11-07 Thread Oscar Benjamin
On 7 November 2012 22:17, Anders wrote: > > Traceback (most recent call last): > File "outlook_tasks.py", line 66, in > my_tasks.dump_today_tasks() > File "C:\Users\Anders\code\Task List\tasks.py", line 29, in > dump_today_tasks > print task.subject > UnicodeEncodeError: 'ascii' codec

Re: Multi-dimensional list initialization

2012-11-07 Thread Oscar Benjamin
On 8 November 2012 00:00, Steven D'Aprano wrote: > Andrew, it appears that your posts are being eaten or rejected by my > ISP's news server, because they aren't showing up for me. Possibly a side- > effect of your dates being in the distant past? So if you have replied to > any of my posts, I have

Re: Right solution to unicode error?

2012-11-07 Thread Oscar Benjamin
On 7 November 2012 23:51, Andrew Berg wrote: > On 2012.11.07 17:27, Oscar Benjamin wrote: >> Are you using cmd.exe (standard Windows terminal)? If so, it does not >> support unicode > Actually, it does. Code page 65001 is UTF-8. I know that doesn't help > the OP since

Re: Right solution to unicode error?

2012-11-08 Thread Oscar Benjamin
On 8 November 2012 00:44, Oscar Benjamin wrote: > On 7 November 2012 23:51, Andrew Berg wrote: >> On 2012.11.07 17:27, Oscar Benjamin wrote: >>> Are you using cmd.exe (standard Windows terminal)? If so, it does not >>> support unicode >> Actually, it does. Code

Re: Right solution to unicode error?

2012-11-08 Thread Oscar Benjamin
On 8 November 2012 15:05, wrote: > Le jeudi 8 novembre 2012 15:07:23 UTC+1, Oscar Benjamin a écrit : >> On 8 November 2012 00:44, Oscar Benjamin wrote: >> > On 7 November 2012 23:51, Andrew Berg wrote: >> >> On 2012.11.07 17:27, Oscar Benjamin wrote: >> &g

Re: Right solution to unicode error?

2012-11-08 Thread Oscar Benjamin
On 8 November 2012 19:54, wrote: > Le jeudi 8 novembre 2012 19:49:24 UTC+1, Ian a écrit : >> On Thu, Nov 8, 2012 at 11:32 AM, Oscar Benjamin >> >> wrote: >> >> > If I want the other characters to work I need to change the code page: >> >> > >

Re: Python3.3 str() bug?

2012-11-10 Thread Oscar Benjamin
On 9 November 2012 11:08, Helmut Jarausch wrote: > On Fri, 09 Nov 2012 10:37:11 +0100, Stefan Behnel wrote: > >> Helmut Jarausch, 09.11.2012 10:18: >>> probably I'm missing something. >>> >>> Using str(Arg) works just fine if Arg is a list. >>> But >>> str([],encoding='latin-1') >>> >>> gives

Re: Method default argument whose type is the class not yet defined

2012-11-10 Thread Oscar Benjamin
On 10 November 2012 19:33, Jennie wrote: > What is the best solution to solve the following problem in Python 3.3? > > import math class Point: > ... def __init__(self, x=0, y=0): > ... self.x = x > ... self.y = y > ... def __sub__(self, other): > ... return Po

Re: Method default argument whose type is the class not yet defined

2012-11-11 Thread Oscar Benjamin
On 11 November 2012 02:47, Chris Angelico wrote: > On Sun, Nov 11, 2012 at 1:43 PM, Ian Kelly wrote: >> On Sat, Nov 10, 2012 at 7:13 PM, Chris Angelico wrote: >>> I would not assume that. The origin is a point, just like any other. >>> With a Line class, you could deem a zero-length line to be l

Re: Method default argument whose type is the class not yet defined

2012-11-11 Thread Oscar Benjamin
On 11 November 2012 22:31, Steven D'Aprano wrote: > On Sun, 11 Nov 2012 14:21:19 +0000, Oscar Benjamin wrote: > >> On 11 November 2012 02:47, Chris Angelico wrote: >>> On Sun, Nov 11, 2012 at 1:43 PM, Ian Kelly >>> wrote: >>>> On Sat, Nov 10, 2012

Re: Method default argument whose type is the class not yet defined

2012-11-11 Thread Oscar Benjamin
On 12 November 2012 01:10, Mark Lawrence wrote: > On 12/11/2012 00:31, Oscar Benjamin wrote: >> >> >> Plain wrong. Vectors are not defined *from any origin*. >> > > So when the Captain says "full speed ahead, steer 245 degrees", you haven't > the

Re: Method default argument whose type is the class not yet defined

2012-11-11 Thread Oscar Benjamin
On 12 November 2012 01:29, Mark Lawrence wrote: > On 12/11/2012 01:18, Oscar Benjamin wrote: >> >> On 12 November 2012 01:10, Mark Lawrence wrote: >>> >>> On 12/11/2012 00:31, Oscar Benjamin wrote: >>>> >>>> Plain wrong. Vectors are not de

Re: Passing functions as parameter (multiprocessing)

2012-11-13 Thread Oscar Benjamin
On 13 November 2012 12:51, Peter Otten <__pete...@web.de> wrote: > Jean-Michel Pichavant wrote: > >> I'm having problems understanding an issue with passing function as >> parameters. > >> Here's a code that triggers the issue: >> >> >> import multiprocessing >> >> def f1(): >> print 'I am f1'

Re: Matplotlib/Pylab Error

2012-12-11 Thread Oscar Benjamin
On 10 December 2012 20:40, wrote: > Dear Group, > > I am trying to enumerate few interesting errors on pylab/matplotlib. > If any of the learned members can kindly let me know how should I address > them. > > I am trying to enumerate them as follows. > > i) >>> import numpy import pylab >>>

Re: Iterating over files of a huge directory

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 15:28, Gilles Lenfant wrote: > I have googled but did not find an efficient solution to my problem. My > customer provides a directory with a hge list of files (flat, potentially > 10+) and I cannot reasonably use os.listdir(this_path) unless creating a > big memory

Re: os.system and subprocess odd behavior

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 16:39, py_genetic wrote: > Thanks for verifying this for me Steven. I'm glad you are seeing it work. > It's really the strangest thing. > > The issue seems to be with the " > outfile.txt" portion of the command. > > The actual command is running a query on a verticalDB and d

Re: Delete dict and subdict items of some name

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 17:27, Gnarlodious wrote: > Hello. What I want to do is delete every dictionary key/value of the name > 'Favicon' regardless of depth in subdicts, of which there are many. What is > the best way to do it? You might need to be a bit clearer about what you mean by subdicts. I

Re: Re: Iterating over files of a huge directory

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 18:40, Evan Driscoll wrote: > On 12/17/2012 09:52 AM, Oscar Benjamin wrote: >> https://github.com/benhoyt/betterwalk > > This is very useful to know about; thanks. > > I actually wrote something very similar on my own (I wanted to get > information abou

Re: Delete dict and subdict items of some name

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 23:44, Oscar Benjamin wrote: > On 17 December 2012 23:08, MRAB wrote: >> Wouldn't a set of the id of the visited objects work? > > Of course it would. This is just a tree search. > > Here's a depth-first-search function: > > def dfs(r

Re: os.system and subprocess odd behavior

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 20:56, py_genetic wrote: > Oscar, seems you may be correct. I need to run this program as a superuser. > However, after some more tests with simple commands... I seem to be working > correctly from any permission level in python Except for the output write > command f

Re: Delete dict and subdict items of some name

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 23:08, MRAB wrote: > On 2012-12-17 22:00, Dave Angel wrote: >> On 12/17/2012 04:33 PM, Mitya Sirenef wrote: >>> On 12/17/2012 01:30 PM, Tim Chase wrote: On 12/17/12 11:43, Mitya Sirenef wrote: > On 12/17/2012 12:27 PM, Gnarlodious wrote: >> >> Hello. What I wan

Re: os.system and subprocess odd behavior

2012-12-18 Thread Oscar Benjamin
Can you trim content and interleave your response (instead of top-posting) please? On 18 December 2012 18:26, py_genetic wrote: > HOWEVER... > > when using this command from before no dice > > /usr/local/Calpont/mysql/bin/mysql > --defaults-file=/usr/local/Calpont/mysql/my.cnf -u root myDB <

Re: how to detect the encoding used for a specific text data ?

2012-12-21 Thread Oscar Benjamin
On 20 December 2012 11:57, iMath wrote: > how to detect the encoding used for a specific text data ? Normally encoding is given in some way by the context of the data. Otherwise no general solution is possible. On a related note: how to answer question with no context on mailing list? -- http:

Re: Command Line Progress Bar

2012-12-27 Thread Oscar Benjamin
On 26 December 2012 06:17, Kevin Anthony wrote: > Hello, > I'm writing a file processing script(Linux), and i would like to have a > progress bar. But i would also like to be able to print messages. Is there > a simple way of doing this without implementing something like ncurses? Other project

Re: Function Parameters

2012-12-27 Thread Oscar Benjamin
On 27 December 2012 20:47, Joseph L. Casale wrote: >> Don't use kwargs for this. List out the arguments in the function >> spec and give the optional ones reasonable defaults. > >> I only use kwargs myself when the set of possible arguments is dynamic >> or unknown. > > Gotch ya, but when the inp

Re: Yet another attempt at a safe eval() call

2013-01-05 Thread Oscar Benjamin
On 4 January 2013 15:53, Grant Edwards wrote: > On 2013-01-04, Steven D'Aprano wrote: >> On Thu, 03 Jan 2013 23:25:51 +, Grant Edwards wrote: >> >> * But frankly, you should avoid eval, and write your own mini-integer >> arithmetic evaluator which avoids even the most remote possibility >>

Re: Random List Loop?!

2013-01-05 Thread Oscar Benjamin
On 5 January 2013 15:47, Christian Gabriel wrote: > Hi > > I have tried now for ages to make a loop that does the following: > > Makes a new list with 9 random values, from 9 different lists, with 9 > elements. > > And makes sure that none of the elements repeat! > > Is there anyone that can help

Re: Yet another attempt at a safe eval() call

2013-01-05 Thread Oscar Benjamin
On 5 January 2013 16:01, Chris Angelico wrote: > On Sun, Jan 6, 2013 at 2:56 AM, Oscar Benjamin > wrote: >> On 4 January 2013 15:53, Grant Edwards wrote: >>> On 2013-01-04, Steven D'Aprano wrote: >>>> On Thu, 03 Jan 2013 23:25:51 +, Grant Edwards wrot

Re: Yet another attempt at a safe eval() call

2013-01-06 Thread Oscar Benjamin
On 6 January 2013 15:12, Grant Edwards wrote: > On 2013-01-05, Oscar Benjamin wrote: >> On 4 January 2013 15:53, Grant Edwards wrote: >>> On 2013-01-04, Steven D'Aprano wrote: >>>> On Thu, 03 Jan 2013 23:25:51 +, Grant Edwards wrote: >>>>

Re: Numpy outlier removal

2013-01-06 Thread Oscar Benjamin
On 7 January 2013 01:46, Steven D'Aprano wrote: > On Sun, 06 Jan 2013 19:44:08 +, Joseph L. Casale wrote: > >> I have a dataset that consists of a dict with text descriptions and >> values that are integers. If required, I collect the values into a list >> and create a numpy array running it t

Re: Numpy outlier removal

2013-01-07 Thread Oscar Benjamin
On 7 January 2013 05:11, Steven D'Aprano wrote: > On Mon, 07 Jan 2013 02:29:27 +0000, Oscar Benjamin wrote: > >> On 7 January 2013 01:46, Steven D'Aprano >> wrote: >>> On Sun, 06 Jan 2013 19:44:08 +, Joseph L. Casale wrote: >>> >>> I&#x

Re: [Offtopic] Line fitting [was Re: Numpy outlier removal]

2013-01-07 Thread Oscar Benjamin
On 7 January 2013 17:58, Steven D'Aprano wrote: > On Mon, 07 Jan 2013 15:20:57 +0000, Oscar Benjamin wrote: > >> There are sometimes good reasons to get a line of best fit by eye. In >> particular if your data contains clusters that are hard to separate, >> sometimes

Re: Searching through two logfiles in parallel?

2013-01-07 Thread Oscar Benjamin
On 7 January 2013 22:10, Victor Hooi wrote: > Hi, > > I'm trying to compare two logfiles in Python. > > One logfile will have lines recording the message being sent: > > 05:00:06 Message sent - Value A: 5.6, Value B: 6.2, Value C: 9.9 > > the other logfile has line recording the message being

Re: Searching through two logfiles in parallel?

2013-01-07 Thread Oscar Benjamin
gt; > In reality, I'd need to handle missing messages in logfile2, but that's the > general idea. > > Does that make sense? (There's also a chance I've misunderstood your buf > code, and it does do this - in that case, I apologies - is there any chance > you

Re: Calculate Big Number

2013-01-07 Thread Oscar Benjamin
On 8 January 2013 00:44, Nac Temha wrote: > Hello, > How to quickly calculate large numbers. For example (10**25) * (2**50) > 11258999068426240L I just tested that line in the interpreter and it ran so quickly it seemed instantaneous (maybe my computer is faster than

Re: [Offtopic] Line fitting [was Re: Numpy outlier removal]

2013-01-08 Thread Oscar Benjamin
On 8 January 2013 01:23, Steven D'Aprano wrote: > On Mon, 07 Jan 2013 22:32:54 +0000, Oscar Benjamin wrote: > > [...] >> I also think it would >> be highly foolish to go so far with refusing to eyeball data that you >> would accept the output of some regression a

Re: How to tell how many weeks apart two datetimes are?

2013-01-08 Thread Oscar Benjamin
On 8 January 2013 22:50, MRAB wrote: > On 2013-01-08 21:22, Roy Smith wrote: >> >> How do you tell how many weeks apart two datetimes (t1 and t2) are? >> The "obvious" solution would be: >> >> weeks = (t2 - t1) / timedelta(days=7) >> >> but that doesn't appear to be allowed. Is there some fundame

Re: Searching through two logfiles in parallel?

2013-01-08 Thread Oscar Benjamin
On 8 January 2013 19:16, darnold wrote: > i don't think in iterators (yet), so this is a bit wordy. > same basic idea, though: for each message (set of parameters), build a > list of transactions consisting of matching send/receive times. The advantage of an iterator based solution is that we can

Re: Interpolating/crossfading a stack of matrices

2013-01-09 Thread Oscar Benjamin
On 9 January 2013 16:02, wrote: > Hi, > > I want to interpolate (with quadratic splines) a stack of 2D-arrays/matrices > y1, y2, y3, ... in a third dimension (which I call x) e.g. for crossfading > images. I already have a working code which unfortunately still contains two > explicit loops ov

Re: average time calculation??

2013-01-10 Thread Oscar Benjamin
On 10 January 2013 17:50, 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. You might find it e

Re: average time calculation??

2013-01-10 Thread Oscar Benjamin
Two quick corrections to what I wrote... On 10 January 2013 18:13, Oscar Benjamin wrote: > On 10 January 2013 17:50, 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:millis

Re: problem with exam task for college

2013-01-13 Thread Oscar Benjamin
On 13 January 2013 13:57, wrote: > this is again a newer version, right now the velocity does in fact turn, but > the view doesn't follow, it keeps the ship vertical. > > i'm also having trouble letting the flame appear when pressing the "up" button > > and when the ship rotates the horizontal v

Re: Subgraph Drawing

2013-01-13 Thread Oscar Benjamin
On 13 January 2013 20:05, wrote: > Dear Group, > > I have two questions, if I take a subseries of the matrix as in eigenvalue > here, > provided I have one graph of the full form in G, how may I show it, as if I > do the nx.draw(G) it takes only the original graph. I'm sorry, but I really don'

Re: Beowulf clusters

2013-01-13 Thread Oscar Benjamin
On 14 January 2013 02:22, Mark Janssen wrote: > On Sun, Jan 13, 2013 at 8:19 PM, Oscar Benjamin > wrote: >> On 14 January 2013 02:10, Mark Janssen wrote: >>> Has anyone used python for high-performance computing on Beowulf clusters? >> >> Yes. > > How di

Re: Beowulf clusters

2013-01-13 Thread Oscar Benjamin
On 14 January 2013 02:46, Mark Janssen wrote: > On Sun, Jan 13, 2013 at 8:37 PM, Oscar Benjamin > wrote: >> On 14 January 2013 02:33, Mark Janssen wrote: >>> Lol, well that's why I'm asking. I don't see how they can do it >>> without considerable

Re: i can't understand decorator

2013-01-15 Thread Oscar Benjamin
On 15 January 2013 14:20, contro opinion wrote: def deco(func): > ... def kdeco(): > ... print("before myfunc() called.") > ... func() > ... print(" after myfunc() called.") > ... return kdeco > ... @deco > ... def myfunc(): > ... print(" myfunc

Re: Is there a more elegant way to handle determing fail status?

2013-01-15 Thread Oscar Benjamin
On 15 January 2013 23:24, J wrote: > Ok, so I have a diagnostic tool, written by someone else. That tool > runs a series of small tests defined by the user and can simplified > summary output that can be one of the following: > > FAILED_CRITICAL > FAILED_HIGH > FAILED_MEDIUM > FAILED_LOW > PASSED

Re: Uniquely identifying each & every html template

2013-01-21 Thread Oscar Benjamin
On 21 January 2013 12:06, Ferrous Cranus wrote: > Τη Δευτέρα, 21 Ιανουαρίου 2013 11:31:24 π.μ. UTC+2, ο χρήστης Chris Angelico > έγραψε: >> >> Seriously, you're asking for something that's beyond the power of >> humans or computers. You want to identify that something's the same >> file, without

Re: Uniquely identifying each & every html template

2013-01-21 Thread Oscar Benjamin
On 21 January 2013 23:01, Tom P wrote: > On 01/21/2013 01:39 PM, Oscar Benjamin wrote: >> >> On 21 January 2013 12:06, Ferrous Cranus wrote: >>> >>> Τη Δευτέρα, 21 Ιανουαρίου 2013 11:31:24 π.μ. UTC+2, ο χρήστης Chris >>> Angelico έγραψε: >>>

Re: Understanding while...else...

2013-01-22 Thread Oscar Benjamin
On 22 January 2013 23:41, Terry Reedy wrote: > On 1/22/2013 3:09 PM, Ethan Furman wrote: >> >> On 01/22/2013 09:44 AM, Terry Reedy wrote: >>> [SNIP] >>> The else clause is executed if and when the condition is false. >>> Now use a real Python while statement to do the *same >>> thing*. >>> >>> whi

Re: Retrieving the full command line

2013-01-22 Thread Oscar Benjamin
On 22 January 2013 23:46, Steven D'Aprano wrote: [SNIP] > > I am a bit disturbed that you cannot distinguish between: > > python C:\something\on\pythonpath\app\__main__.py > > python -m app > > > by inspecting the command line. I consider it a bug, or at least a > misfeature, if Python transforms

Re: Retrieving the full command line

2013-01-22 Thread Oscar Benjamin
On 22 January 2013 09:24, Tim Golden wrote: > [Python 2.7/3.3 (and hg tip) running on Windows. Not Windows-specific, > though]. > > I use the python -mpackage incantation to run a package which has a > __main__.py module and which uses relative imports internally. > > I'm developing under cherrypy

Re: Retrieving the full command line

2013-01-23 Thread Oscar Benjamin
On 23 January 2013 03:58, Steven D'Aprano wrote: > On Wed, 23 Jan 2013 00:53:21 +0000, Oscar Benjamin wrote: > >> On 22 January 2013 23:46, Steven D'Aprano >> wrote: [SNIP] >>> >> The purpose of the -m option is that you can run a script that is >&

Re: Memory error with quadratic interpolation

2013-01-23 Thread Oscar Benjamin
On 23 January 2013 08:55, Ulrich Eckhardt wrote: > Am 23.01.2013 05:06, schrieb Isaac Won: > >> I have tried to use different interpolation methods with Scipy. My >> code seems just fine with linear interpolation, but shows memory >> error with quadratic. I am a novice for python. I will appreciat

Re: Increase value in hash table

2013-01-23 Thread Oscar Benjamin
On 23 January 2013 07:26, moonhkt wrote: > Hi Al > > I have Data file have below > > Data file > V1 > V2 > V3 > V4 > V4 > V3 > > How to using count number of data ? > > Output > V1 = 1 > V2 = 1 > V3 =2 > V4 = 2 > > > > # Global Veriable > printque = {} > in def have below > > printque[val] = prin

<    1   2   3   4   5   6   7   >