Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-14 Thread Xah Lee
On Jun 13, 6:19 am, Steven D'Aprano 〔steve +comp.lang.pyt...@pearwood.info〕 wrote: │ I don't know if there are any studies that indicate how much of a │ programmer's work is actual mechanical typing but I'd be surprised if it │ were as much as 20% of the work day. The rest of the time being thinki

Re: Keyboard Layout: Dvorak vs. Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-14 Thread Xah Lee
Ba Wha 13, 7:23 nz, Ehfgbz Zbql 〔ehfgbzcz...@tznvy.pbz〕 jebgr: │ Qibenx -- yvxr djregl naq nal bgure xrlobneq ynlbhg -- nffhzrf gur │ pbzchgre vf n glcrjevgre. │ Guvf zrnaf va rssrpg ng yrnfg gjb pbafgenvagf, arprffnel sbe gur │ glcrjevgre ohg abg sbe gur pbzchgre: │ │ n. Gur glcvfg pna glcr bayl

Re: I want this to work. [[]] * n

2011-06-14 Thread SherjilOzair
Thanks. This works. :) Regards, Sherjil Ozair -- http://mail.python.org/mailman/listinfo/python-list

Re: Keyboard Layout: Dvorak vs. Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-14 Thread Xah Lee
for some reason, was unable to post the previous message. (but can post others) So, the message is rot13'd and it works. Not sure what's up with Google groups. (this happened a few years back once. Apparantly, the message content might have something to do with it because rot13 clearly works. Yet,

Re: working with raw image files

2011-06-14 Thread Martin De Kauwe
what is a .raw file, do you mean a flat binary? -- http://mail.python.org/mailman/listinfo/python-list

ftplib: Software caused connection abort, how I solved it

2011-06-14 Thread Mad Sweeney
My program polls FTP servers at intervals for jobs to process. Its running as a service on Windows server 2000 or 2003 :-(. About 13% of times the retrbinary and less often the nlst calls would fail with "Software caused connection abort". I could find no relevant solution on the intertubes. I a

Re: Rant on web browsers

2011-06-14 Thread Martin P. Hellwig
On 14/06/2011 07:31, Chris Angelico wrote: But if anyone feels like writing an incompatible browser, please can you add Python scripting? You might find that Pyjamas already fill your needs python/javascript wise. It is truly great to just write python, translate it, and then have it work in

Re: Rant on web browsers

2011-06-14 Thread Chris Angelico
On Tue, Jun 14, 2011 at 6:39 PM, Martin P. Hellwig wrote: > On 14/06/2011 07:31, Chris Angelico wrote: > >> >> But if anyone feels like writing an incompatible browser, please can >> you add Python scripting? > > You might find that Pyjamas already fill your needs python/javascript wise. > It is

UPnP client

2011-06-14 Thread Nikos Fotoulis
Hi. Recently i needed some code to be able to listen on the public IP address outside my modem router. Eventually, i came up with a minimal UPnP implementation and because it seems to work and i'm happy about it, i've decided to post it here at clpy in case anybody else may have a use for it. You

Python-URL! - weekly Python news and links (Jun 14)

2011-06-14 Thread Cameron Laird
[Originally drafted by Gabriel Genellina.] QOTW: "Well, it's incompatible with the Python compiler I keep in my head. Have these developers no consideration for backward-thinking- compatibility?" (Ben Finney, 2011-06-10, on certain old but not-so-obvious change) Python versions 2.7.2 and 3

Dictionaries and incrementing keys

2011-06-14 Thread Steve Crook
Hi all, I've always done key creation/incrementation using: if key in dict: dict[key] += 1 else: dict[key] = 1 Today I spotted an alternative: dict[key] = dict.get(key, 0) + 1 Whilst certainly more compact, I'd be interested in views on how pythonesque this method is. -- http://mail.p

pkg_resources ?

2011-06-14 Thread km
Hi all, I am trying to look at the source code of a python script (run.py). But it reads ###code - run.py #!/usr/bin/env python # EASY-INSTALL-SCRIPT: 'pbpy==0.1','run.py' __requires__ = 'pbpy==0.1' import pkg_resources pkg_resources.run_script('pbpy==0.1', 'run

Re: Dictionaries and incrementing keys

2011-06-14 Thread Peter Otten
Steve Crook wrote: > I've always done key creation/incrementation using: > > if key in dict: > dict[key] += 1 > else: > dict[key] = 1 Your way is usually faster than > dict[key] = dict.get(key, 0) + 1 > > Whilst certainly more compact, I'd be interested in views on how > pythonesque t

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-14 Thread Elena
On 13 Giu, 11:22, Chris Angelico wrote: > On Mon, Jun 13, 2011 at 6:42 PM, Yang Ha Nguyen wrote: > > > Could you show which studies?  Do they do research just about habit or > > other elements (e.g. movement rates, comfortablility, ...) as well? > > Have they ever heard of RSI because of repetiti

Re: Dictionaries and incrementing keys

2011-06-14 Thread AlienBaby
On Jun 14, 12:16 pm, Peter Otten <__pete...@web.de> wrote: > Steve Crook wrote: > > I've always done key creation/incrementation using: > > > if key in dict: > >     dict[key] += 1 > > else: > >     dict[key] = 1 > > Your way is usually faster than > > > dict[key] = dict.get(key, 0) + 1 > > > Whils

Re: Rant on web browsers

2011-06-14 Thread Novocastrian_Nomad
CoffeeScript maybe? http://jashkenas.github.com/coffee-script -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionaries and incrementing keys

2011-06-14 Thread Steve Crook
On Tue, 14 Jun 2011 05:37:45 -0700 (PDT), AlienBaby wrote in Message-Id: <078c5e9a-8fad-4d4c-b081-f69d0f575...@v11g2000prk.googlegroups.com>: > How do those methods compare to the one I normally use; > > try: > dict[key]+=1 > except: > dict[key]=1 This is a lot slower in percentage terms. You

Re: Dictionaries and incrementing keys

2011-06-14 Thread Steve Crook
On Tue, 14 Jun 2011 13:16:47 +0200, Peter Otten wrote in Message-Id: : > Your way is usually faster than > >> dict[key] = dict.get(key, 0) + 1 Thanks Peter, ran it through Timeit and you're right. It's probably also easier to read the conditional version, even if it is longer. > You may also c

Re: Dictionaries and incrementing keys

2011-06-14 Thread Steven D'Aprano
On Tue, 14 Jun 2011 10:57:44 +, Steve Crook wrote: > Hi all, > > I've always done key creation/incrementation using: > > if key in dict: > dict[key] += 1 > else: > dict[key] = 1 > > Today I spotted an alternative: > > dict[key] = dict.get(key, 0) + 1 > > Whilst certainly more comp

Leo 4.9 b4 released

2011-06-14 Thread Edward K. Ream
Leo 4.9 b4 is now available at: http://sourceforge.net/projects/leo/files/ If you have trouble downloading, please do try an alternate mirror. Unless serious problems are reported, expect Leo 4.9 rc1 this Friday, June 17 and 4.9 final on Tuesday, June 21. Leo is a text editor, data organizer, pro

Re: Dictionaries and incrementing keys

2011-06-14 Thread Steven D'Aprano
On Tue, 14 Jun 2011 12:53:11 +, Steve Crook wrote: > On Tue, 14 Jun 2011 05:37:45 -0700 (PDT), AlienBaby wrote in Message-Id: > <078c5e9a-8fad-4d4c-b081-f69d0f575...@v11g2000prk.googlegroups.com>: > >> How do those methods compare to the one I normally use; >> >> try: >> dict[key]+=1 >> exce

Re: Binding was Re: Function declarations ?

2011-06-14 Thread Patty
- Original Message - From: "Ethan Furman" To: Sent: Monday, June 13, 2011 10:55 PM Subject: Re: Binding was Re: Function declarations ? Patty wrote: So I am wondering if you learned this in Computer Science or Computer Engineering?, on the job? I learned it on this list. :) ~E

Re: Rant on web browsers

2011-06-14 Thread Patty
- Original Message - From: "Chris Angelico" To: Sent: Monday, June 13, 2011 11:31 PM Subject: Rant on web browsers Random rant and not very on-topic. Feel free to hit Delete and move on. I've just spent a day coding in Javascript, and wishing browsers supported Python instead (or

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-14 Thread Dotan Cohen
On Mon, Jun 13, 2011 at 10:21, Elena wrote: > On 13 Giu, 06:30, Tim Roberts wrote: >> Studies have shown that even a >> strictly alphabetical layout works perfectly well, once the typist is >> acclimated. > > Once the user is acclimated to move her hands much  more (about 40% > more for Qwerty ve

Re: Looking for Coders or Testers for an Open Source File Organizer

2011-06-14 Thread Matt Chaput
On 13/06/2011 11:55 PM, zainul franciscus wrote: Iknow you guys must be thinking "Hmm, Miranda, isn't that an IM application ?"; Yep I hear you, I'll change the name once I get a good name. I am open for any suggestions. Actually I was thinking "isn't that a functional programming language?" M

Python Pickle Problems (Ellipsis + Other Objects)

2011-06-14 Thread Sunjay Varma
See more details in my forum post: http://www.python-forum.org/pythonforum/viewtopic.php?f=18&t=26724 I'm trying to pickle a bunch of functions (mostly built-in) and pickle keeps giving me errors. I have no Ellipsis in my data at all, and for some reason, pickle seems to think I do. Here is a

What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?

2011-06-14 Thread Zachary Dziura
I have a dict that I would like to print out in a series of columns, rather than as a bunch of lines. Normally when you do print(dict), the output will look something like this: {'Header2': ['2', '5', '8'], 'Header3': ['3', '6', '9'], 'Header1': ['1', '4', '7'], 'Header4': ['10', '11', '12']} I c

Wing IDE 4.0.3 released

2011-06-14 Thread Wingware
Hi, Wingware has released version 4.0.3 of Wing IDE, an integrated development environment designed specifically for the Python programming language. Wing IDE is a cross-platform Python IDE that provides a professional code editor with vi, emacs, and other key bindings, auto-completion, call tip

Re: Looking for Coders or Testers for an Open Source File Organizer

2011-06-14 Thread Zachary Dziura
> On Jun 13, 11:55 pm, zainul franciscus wrote: > I started an open source file organizer called Miranda.  Miranda is > inspired by Belvedere written by Adam Pash of Lifehacker (http:// > lifehacker.com/341950/belvedere-automates-your-self+cleaning-pc). I > know you guys must be thinking "Hmm, Mir

Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?

2011-06-14 Thread Terry Reedy
On 6/14/2011 11:29 AM, Zachary Dziura wrote: I have a dict that I would like to print out in a series of columns, rather than as a bunch of lines. Normally when you do print(dict), the output will look something like this: {'Header2': ['2', '5', '8'], 'Header3': ['3', '6', '9'], 'Header1': ['1',

Re: working with raw image files

2011-06-14 Thread Terry Reedy
On 6/14/2011 3:49 AM, Martin De Kauwe wrote: what is a .raw file, do you mean a flat binary? Perhaps tiff-like. https://secure.wikimedia.org/wikipedia/en/wiki/Raw_image_format "Providing a detailed and concise description of the content of raw files is highly problematic. There is no single ra

Re: Dictionaries and incrementing keys

2011-06-14 Thread Asen Bozhilov
Steve Crook wrote: > Whilst certainly more compact, I'd be interested in views on how > pythonesque this method is. Instead of calling function you could use: d = {} d[key] = (key in d and d[key]) + 1 Regards. -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for Coders or Testers for an Open Source File Organizer

2011-06-14 Thread geremy condra
On Tue, Jun 14, 2011 at 7:54 AM, Matt Chaput wrote: > On 13/06/2011 11:55 PM, zainul franciscus wrote: >> >> Iknow you guys must be thinking "Hmm, Miranda, isn't that an IM >> application ?"; Yep I hear you, I'll change the name once I get a good >> name. I am open for any suggestions. > > Actuall

Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?

2011-06-14 Thread Zach Dziura
> d={'Header2': ['2', '5', '8'], 'Header3': ['3', '6', '9'], >     'Header1': ['1', '4', '7'], 'Header4': ['10', '11', '12']} > > arr = [] > for key,value in d.items(): >      line = ['{:>10s}'.format(key)] >      for num in value: >          line.append('{:>10s}'.format(num)) >      arr.append(lin

Re: Looking for Coders or Testers for an Open Source File Organizer

2011-06-14 Thread Alister Ware
On Mon, 13 Jun 2011 20:55:54 -0700, zainul franciscus wrote: > I started an open source file organizer called Miranda. Miranda is > inspired by Belvedere written by Adam Pash of Lifehacker (http:// > lifehacker.com/341950/belvedere-automates-your-self+cleaning-pc). I know > you guys must be think

Re: Infinite recursion in __reduce__ when calling original base class reduce, why?

2011-06-14 Thread Irmen de Jong
On 14-6-2011 2:40, Chris Torek wrote: > > Nonetheless, there is something at least slightly suspicious here: [... snip explanations...] Many thanks Chris, for the extensive reply. There's some useful knowledge in it. My idea to call the base class reduce as the default fallback causes the prob

Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?

2011-06-14 Thread Karim
On 06/14/2011 05:29 PM, Zachary Dziura wrote: I have a dict that I would like to print out in a series of columns, rather than as a bunch of lines. Normally when you do print(dict), the output will look something like this: {'Header2': ['2', '5', '8'], 'Header3': ['3', '6', '9'], 'Header1': ['1'

Question regarding DNS resolution in urllib2

2011-06-14 Thread saurabh verma
hi , I trying to use urllib2 in my script , but the problem is lets say a domains resolves to multiple IPs , If the URL is served by plain http , I can add “Host: domain” header and check whether all IPs are returning proper responses or not , but in case of https , I have to trust on my local

Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?

2011-06-14 Thread MRAB
On 14/06/2011 18:48, Zach Dziura wrote: [snip] I just have one quick question. On the line where you have zip(*arr), what is the * for? Is it like the pointer operator, such as with C? Or is it exactly the pointer operator? [snip] The * in the argument list of a function call unpacks the follow

Re: working with raw image files

2011-06-14 Thread kafooster
Ok, I solved the problem with matplotlib fileobj = open("hand.raw", 'rb') data = numpy.fromfile(fileobj,dtype=np.uint16) data = numpy.reshape(data,(96,470,352)) imshow(data[:,:,40],cmap='gray') show() the error was caused by different order of data, however it still reads the dataset as half of i

Re: working with raw image files

2011-06-14 Thread MRAB
On 14/06/2011 21:13, kafooster wrote: Ok, I solved the problem with matplotlib fileobj = open("hand.raw", 'rb') data = numpy.fromfile(fileobj,dtype=np.uint16) data = numpy.reshape(data,(96,470,352)) imshow(data[:,:,40],cmap='gray') show() the error was caused by different order of data, however

Re: pkg_resources ?

2011-06-14 Thread Ned Deily
In article , km wrote: > I am trying to look at the source code of a python script (run.py). But > it reads > ###code - run.py > #!/usr/bin/env python > # EASY-INSTALL-SCRIPT: 'pbpy==0.1','run.py' > __requires__ = 'pbpy==0.1' > import pkg_resources > pkg_resour

Re: working with raw image files

2011-06-14 Thread Dan Stromberg
On Tue, Jun 14, 2011 at 1:26 PM, MRAB wrote: > On 14/06/2011 21:13, kafooster wrote: > >> >> I would like to visualize this data with PIL, but PIL works only with >> 8bit data. How could I resample my array from 16bit to 8bit? >> > > Multiply the numpy array by a scaling factor, which is > float(

Re: working with raw image files

2011-06-14 Thread kafooster
On 14 Cze, 22:26, MRAB wrote: > > Multiply the numpy array by a scaling factor, which is > float(max_8bit_value) / float(max_16bit_value). could you please explain it a little? I dont understand it. like multiplying each element? -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for Coders or Testers for an Open Source File Organizer

2011-06-14 Thread Chris Angelico
On Wed, Jun 15, 2011 at 3:33 AM, geremy condra wrote: >> My suggestion: Cruftbuster > > 'Phile' Or 'Philtre'. A philtre is a very useful thing to have around a house... just ask Aline Sangazure. I'd like to join this project, as a tester. Chris Angelico -- http://mail.python.org/mailman/listin

Re: Rant on web browsers

2011-06-14 Thread Chris Angelico
On Wed, Jun 15, 2011 at 12:11 AM, Patty wrote: > Hi Chris - I am just learning JavaScript and this was helpful to me, not a > rant.  I am reading JavaScript:  The Good Parts so he is jumping around in > topic and I can just use this when learning about dates and ints coming up. Hehe. Just that it

Re: working with raw image files

2011-06-14 Thread MRAB
On 14/06/2011 22:20, kafooster wrote: On 14 Cze, 22:26, MRAB wrote: Multiply the numpy array by a scaling factor, which is float(max_8bit_value) / float(max_16bit_value). could you please explain it a little? I dont understand it. like multiplying each element? Yes. Something like this: f

break in a module

2011-06-14 Thread Eric Snow
When you want to stop execution of a statement body early, for flow control, there is a variety ways you can go, depending on the context. Loops have break and continue. Functions have return. Generators have yield (which temporarily stops execution). Exceptions sort of work for everything, but

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-14 Thread Andrew Berg
On 2011.06.13 08:58 PM, Chris Angelico wrote: > That's one of the reasons I like my laptop keyboard so much. I find that the terribly tiny keys on a laptop keyboard make them very evil. I don't see how anyone could type fast on one of them without making tons of errors. I constantly have to fix typ

Re: Rant on web browsers

2011-06-14 Thread Asen Bozhilov
Chris Angelico wrote: > I've just spent a day coding in Javascript, and wishing browsers > supported Python instead (or as well). All I needed to do was take two > dates (as strings), figure out the difference in days, add that many > days to both dates, and put the results back into DOM Input obj

Re: Looking for Coders or Testers for an Open Source File Organizer

2011-06-14 Thread Redcat
> The chief geek has given his nod of approval to publish Miranda through > how-to geek, and I can pitch any of your software to him, and write an > article about it - provided that the chief geek approve the software. I wouldn't mind contributing some time to this project. -- http://mail.python.

Re: break in a module

2011-06-14 Thread MRAB
On 14/06/2011 23:28, Eric Snow wrote: [snip] With modules I sometimes have code at the beginning to do some small task if a certain condition is met, and otherwise execute the rest of the module body. Here's my main use case: """some module""" import sys import importlib import uti

Re: Looking for Coders or Testers for an Open Source File Organizer

2011-06-14 Thread zainul franciscus
On Jun 15, 10:43 am, Redcat wrote: > > The chief geek has given his nod of approval to publish Miranda through > > how-to geek, and I can pitch any of your software to him, and write an > > article about it - provided that the chief geek approve the software. > > I wouldn't mind contributing some

Re: Looking for Coders or Testers for an Open Source File Organizer

2011-06-14 Thread zainul franciscus
Hi Chris, Thank you for the reply. I should have mentioned where I am hosting the code *doh slap on the wrist. I am hosting the code in google code: http://code.google.com/p/mirandafileorganizer/ There is a link to the user/developer guide on how to get started with the software: https://docs.g

Re: Looking for Coders or Testers for an Open Source File Organizer

2011-06-14 Thread zainul franciscus
Hi Chris, Thank you for the reply. I should have mentioned where I am hosting the code *doh slap on the wrist. I am hosting the code in google code: http://code.google.com/p/mirandafileorganizer/ There is a link to the user/developer guide on how to get started with the software: https://docs.g

Re: break in a module

2011-06-14 Thread Ethan Furman
MRAB wrote: On 14/06/2011 23:28, Eric Snow wrote: I would rather have something like this: """some module""" import sys import importlib import util # some utility module somewhere... if __name__ == "__main__": name = util.get_module_name(sys.modules[__name__]) m

Re: working with raw image files

2011-06-14 Thread Dave Angel
On 01/-10/-28163 02:59 PM, kafooster wrote: On 14 Cze, 22:26, MRAB wrote: Multiply the numpy array by a scaling factor, which is float(max_8bit_value) / float(max_16bit_value). could you please explain it a little? I dont understand it. like multiplying each element? You said in an earlie

Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?

2011-06-14 Thread Ben Finney
Zachary Dziura writes: > What I want to know is how I can print out that information in a > column, where the header is the first line of the column, with the > data following underneath, like so: I'm glad you got some good replies. It probably reflects badly on me that my first thought was http

Re: break in a module

2011-06-14 Thread Erik Max Francis
Eric Snow wrote: With modules I sometimes have code at the beginning to do some small task if a certain condition is met, and otherwise execute the rest of the module body. Here's my main use case: """some module""" import sys import importlib import util # some utility module somewhe

Re: break in a module

2011-06-14 Thread Erik Max Francis
Ethan Furman wrote: MRAB wrote: On 14/06/2011 23:28, Eric Snow wrote: I would rather have something like this: """some module""" import sys import importlib import util # some utility module somewhere... if __name__ == "__main__": name = util.get_module_name(sys.module

Re: working with raw image files

2011-06-14 Thread kafooster
On 15 Cze, 00:06, MRAB wrote: > > Yes. Something like this: > > fileobj = open("hand.raw", 'rb') > data = numpy.fromfile(fileobj, dtype=numpy.uint16) > fileobj.close() > data = data * float(0xFF) / float(0x) > data = numpy.array(data, dtype=numpy.uint8) > data = data.reshape((96, 470, 352)) >

Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?

2011-06-14 Thread Chris Angelico
On Wed, Jun 15, 2011 at 9:40 AM, Ben Finney wrote: > Zachary Dziura writes: > >> What I want to know is how I can print out that information in a >> column, where the header is the first line of the column, with the >> data following underneath, like so: > > I'm glad you got some good replies. It

Re: working with raw image files

2011-06-14 Thread kafooster
On 15 Cze, 01:25, Dave Angel wrote: > On 01/-10/-28163 02:59 PM, kafooster wrote: > > > On 14 Cze, 22:26, MRAB  wrote: > > >> Multiply the numpy array by a scaling factor, which is > >> float(max_8bit_value) / float(max_16bit_value). > > > could you please explain it a little? I dont understand it

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-14 Thread Chris Angelico
On Wed, Jun 15, 2011 at 12:50 AM, Dotan Cohen wrote: > And disproportionate usage of fingers. On QWERTY the weakest fingers > (pinkies) do almost 1/4 of the keypresses when modifier keys, enter, > tab, and backspace are taken into account. That's true on a piano too, though. My pinkies are quite

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-14 Thread Chris Angelico
On Wed, Jun 15, 2011 at 8:29 AM, Andrew Berg wrote: > On 2011.06.13 08:58 PM, Chris Angelico wrote: >> That's one of the reasons I like my laptop keyboard so much. > I find that the terribly tiny keys on a laptop keyboard make them very > evil. I don't see how anyone could type fast on one of them

Re: working with raw image files

2011-06-14 Thread MRAB
On 15/06/2011 00:59, kafooster wrote: On 15 Cze, 00:06, MRAB wrote: Yes. Something like this: fileobj = open("hand.raw", 'rb') data = numpy.fromfile(fileobj, dtype=numpy.uint16) fileobj.close() data = data * float(0xFF) / float(0x) data = numpy.array(data, dtype=numpy.uint8) data = data.

Re: Looking for Coders or Testers for an Open Source File Organizer

2011-06-14 Thread zainul franciscus
Thank you for the reply. I should have mentioned where I am hosting the code *doh slap on the wrist. I am hosting the code in google code: http://code.google.com/p/mirandafileorganizer/ There is a link to the user/developer guide on how to get started with the software: https://docs.google.com/d

Re: Question regarding DNS resolution in urllib2

2011-06-14 Thread Chris Angelico
On Wed, Jun 15, 2011 at 4:34 AM, saurabh verma wrote: > hi , > > I trying to use urllib2 in my script , but the problem is lets say a domains > resolves to multiple IPs , If the URL is served by plain http , I can add > “Host: domain” header and check whether all IPs are returning proper > resp

Re: break in a module

2011-06-14 Thread Ben Finney
Eric Snow writes: > When you want to stop execution of a statement body early, for flow > control, there is a variety ways you can go, depending on the context. > Loops have break and continue. Functions have return. Generators > have yield (which temporarily stops execution). Exceptions sort

Re: break in a module

2011-06-14 Thread Eric Snow
On Tue, Jun 14, 2011 at 5:51 PM, Erik Max Francis wrote: > Ethan Furman wrote: >> >> To me, too -- too bad it doesn't work: >> >> c:\temp>\python32\python early_abort.py >>  File "early_abort.py", line 7 >>    return >>       ^ >> SyntaxError: 'return' outside function > > Nor should it.  There's

Re: Paramiko Threading Error

2011-06-14 Thread mud
On Jun 10, 3:47 am, David <71da...@libero.it> wrote: > Il Tue, 7 Jun 2011 19:25:43 -0700 (PDT), mud ha scritto: > > > > > > > > > > > Hi All, > > > Does anybody know what the following error means with paramiko, and > > how to fix it. > > > I don't know what is causing it and why. I have updated pa

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-14 Thread Andrew Berg
On 2011.06.14 07:18 PM, Chris Angelico wrote: > There are many different designs of laptop keyboard. Tiny netbooks > seem to have the very worst, leaving it nearly impossible to get any > decent work done (there may be exceptions to that, but I've seen a lot > of bad netbook keyboards). My current

Re: working with raw image files

2011-06-14 Thread Nobody
On Tue, 14 Jun 2011 19:25:32 -0400, Dave Angel wrote: > You said in an earlier message to ignore the RAW format. However, if > your file matches a typical camera's raw file It doesn't. He's dealing with a raw array of fixed-size integers (i.e. what you would get if you took a C array and wrote

Re: break in a module

2011-06-14 Thread Chris Angelico
On Wed, Jun 15, 2011 at 10:51 AM, Eric Snow wrote: >  if condition_1: >      ... >      return >  if condition_2: >      ... >      return > >  # now do my expensive module stuff > >  # finally handle being run as a script >  if __name__ == "__main__": >      ... > The best way I can think of is:

Re: break in a module

2011-06-14 Thread Ben Finney
Eric Snow writes: > I apologize if my example was unclear. I kept it pretty simple. That's a good goal, but unfortunately in this case it means the purpose is opaque. > In general it would be nice to do some checks up front and decide > whether or not to continue executing the module, rather t

Re: working with raw image files

2011-06-14 Thread Nobody
On Tue, 14 Jun 2011 13:13:07 -0700, kafooster wrote: > Ok, I solved the problem with matplotlib > > fileobj = open("hand.raw", 'rb') > data = numpy.fromfile(fileobj,dtype=np.uint16) > data = numpy.reshape(data,(96,470,352)) > imshow(data[:,:,40],cmap='gray') > show() > > the error was caused by

Re: working with raw image files

2011-06-14 Thread Dave Angel
On 01/-10/-28163 02:59 PM, kafooster wrote: On 15 Cze, 01:25, Dave Angel wrote: On 01/-10/-28163 02:59 PM, kafooster wrote: On 14 Cze, 22:26, MRABwrote: Multiply the numpy array by a scaling factor, which is float(max_8bit_value) / float(max_16bit_value). could you please explain it

Re: break in a module

2011-06-14 Thread Eric Snow
On Tue, Jun 14, 2011 at 7:33 PM, Ben Finney wrote: > > I have never seen code that needs this, and can't imagine why the above > would be a good design for a module. Is there real code online somewhere > that we can see which serves as a real example for your use case? > Unfortunately not. Most

Re: break in a module

2011-06-14 Thread Cameron Simpson
On 14Jun2011 18:51, Eric Snow wrote: | On Tue, Jun 14, 2011 at 5:51 PM, Erik Max Francis wrote: | > Ethan Furman wrote: | >> | >> To me, too -- too bad it doesn't work: | >> | >> c:\temp>\python32\python early_abort.py | >>  File "early_abort.py", line 7 | >>    return | >>       ^ | >> SyntaxErr

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-14 Thread rusi
On Jun 15, 5:11 am, Chris Angelico wrote: > On Wed, Jun 15, 2011 at 12:50 AM, Dotan Cohen wrote: > > And disproportionate usage of fingers. On QWERTY the weakest fingers > > (pinkies) do almost 1/4 of the keypresses when modifier keys, enter, > > tab, and backspace are taken into account. > > Tha

Re: break in a module

2011-06-14 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Eric Snow wrote: Unfortunately not. Most of this line of thinking is the result of looking at import functionality in different ways, including with regards to the problem of modules getting imported twice (once as __main__). I've been doing work on multi-file modul

Dynamic URL shortening

2011-06-14 Thread Littlefield, Tyler
Hello all: I started working on a project with someone else quite recently, and he has a request. The project requires an URL shortener, and he would like it to be dynamic for both users and developers. Apparently some applications on the mac allow for the user to input some data on a URL shor

Re: Dynamic URL shortening

2011-06-14 Thread Chris Angelico
On Wed, Jun 15, 2011 at 2:03 PM, Littlefield, Tyler wrote: > Hello all: > I started working on a project with someone else quite recently, and he has > a request. The project requires an URL shortener, and he would like it to be > dynamic for both users and developers. Apparently some applications

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-14 Thread Dotan Cohen
On Wed, Jun 15, 2011 at 06:00, rusi wrote: > For keyboarding (in the piano/organ sense) the weakest finger is not > the fifth/pinky but the fourth. > Because for the fifth you will notice that the natural movement is to > stiffen the finger and then use a slight outward arm-swing; for thumb, > ind

Re: What is the Most Efficient Way of Printing A Dict's Contents Out In Columns?

2011-06-14 Thread Terry Reedy
On 6/14/2011 2:37 PM, MRAB wrote: On 14/06/2011 18:48, Zach Dziura wrote: [snip] I just have one quick question. On the line where you have zip(*arr), what is the * for? Is it like the pointer operator, such as with C? Or is it exactly the pointer operator? [snip] The * in the argument list of

Re: Question regarding DNS resolution in urllib2

2011-06-14 Thread saurabh verma
On 15-Jun-2011, at 6:13 AM, Chris Angelico wrote: > On Wed, Jun 15, 2011 at 4:34 AM, saurabh verma wrote: >> hi , >> >> I trying to use urllib2 in my script , but the problem is lets say a domains >> resolves to multiple IPs , If the URL is served by plain http , I can add >> “Host: domain” h

Re: Question regarding DNS resolution in urllib2

2011-06-14 Thread Chris Angelico
On Wed, Jun 15, 2011 at 4:23 PM, saurabh verma wrote: > But in the case of https , I can do above because https handshake is based on > the domain i am trying to connect , so lets say I want to following inside a > python  script using libcurl2 but without touching /etc/hosts , > > curl “https:/