Re: [Gimp-user] export to non xcf

2012-10-29 Thread F.R.
On 10/28/2012 09:09 PM, Michael Schumacher wrote: Von: Donald Miller Can't directly save to jpg, so exported. Export to jpg made png. Same for psd. Shouldn't name track chosen format, so no manual override needed? Maybe you had set the file-type chooser to this format? The default "By extension

Re: Negative array indicies and slice()

2012-10-29 Thread Andrew
On Sunday, October 28, 2012 9:26:01 PM UTC-7, Ian wrote: > On Sun, Oct 28, 2012 at 10:00 PM, Andrew wrote: > > > Hi Ian, > > > Well, no it really isn't equivalent. > > > Consider a programmer who writes: > > > xrange(-4,3) *wants* [-4,-3,-2,-1,0,1,2] > > > > > > That is the "idea" of a range

Re: Negative array indicies and slice()

2012-10-29 Thread andrewr3mail
On Sunday, October 28, 2012 10:14:03 PM UTC-7, Paul Rubin wrote: > Andrew writes: > > > So: Why does python choose to convert them to positive indexes, and > > > have slice operate differently than xrange > > > > There was a thread a few years back, I think started by Bryan Olson, > > that m

Re: Negative array indicies and slice()

2012-10-29 Thread Chris Rebert
On Mon, Oct 29, 2012 at 12:54 AM, Andrew wrote: > On Sunday, October 28, 2012 9:26:01 PM UTC-7, Ian wrote: >> On Sun, Oct 28, 2012 at 10:00 PM, Andrew wrote: > The slice class when passed to __getitem__() was created to merely pass two > numbers and a stride to __getitem__; As far as I know s

Re: Negative array indicies and slice()

2012-10-29 Thread andrewr3mail
On Sunday, October 28, 2012 9:44:56 PM UTC-7, alex23 wrote: > On Oct 29, 2:09 pm, Andrew wrote: > > > I use this arbitrary range code *often* so I need a general purpose > > solution. > > > I looked up slice() but the help is of no use, I don't even know how I might > > > overload it to embed

Re: Negative array indicies and slice()

2012-10-29 Thread Chris Rebert
On Mon, Oct 29, 2012 at 1:08 AM, wrote: > On Sunday, October 28, 2012 10:14:03 PM UTC-7, Paul Rubin wrote: >> Andrew writes: > I'm getting very frustrated with the editor provided for this group... It > keeps posting prematurely, and putting my email in even when I tell it not to > each time;

Re: Negative array indicies and slice()

2012-10-29 Thread Chris Rebert
On Mon, Oct 29, 2012 at 1:24 AM, wrote: > On Sunday, October 28, 2012 9:44:56 PM UTC-7, alex23 wrote: >> On Oct 29, 2:09 pm, Andrew wrote: >> class RangedSlicer(list): >> Then wrap your lists with your RangedSlicer class as needed. > > Hmmm... > > I began a test in an interactive shell: >>

Re: Negative array indicies and slice()

2012-10-29 Thread andrewr3mail
On Monday, October 29, 2012 1:38:04 AM UTC-7, Chris Rebert wrote: > On Mon, Oct 29, 2012 at 1:24 AM, > > > On Sunday, October 28, 2012 9:44:56 PM UTC-7, alex23 wrote: > > >> On Oct 29, 2:09 pm, Andrew < wrote: > > You never wrapped `a` in a RangedSlicer or otherwise made use of RangedSlicer! >

Re: Negative array indicies and slice()

2012-10-29 Thread Mark Lawrence
On 29/10/2012 08:59, andrewr3m...@gmail.com wrote: Note: I subscribed to the python-list, and am able to recieve e-mails, but I don't see how to write a post for this particular thread nor subscribe to this particular thread... A brief suggestion, or link to a howto would be *much* appreciate

Re: Negative array indicies and slice()

2012-10-29 Thread Andrew Robinson
Ok, hopefully this is better. I love my own e-mail editor... I can see that the slice() function can pass in arbitrary arguments. I'm not sure for lists, which is what the range is applied to, why an argument like "a" would be part of a slice. I *really* don't see what the advantage of a slice

Re: Negative array indicies and slice()

2012-10-29 Thread Mark Lawrence
On 29/10/2012 02:31, Andrew Robinson wrote: Ok, hopefully this is better. I love my own e-mail editor... I can see that the slice() function can pass in arbitrary arguments. I'm not sure for lists, which is what the range is applied to, why an argument like "a" would be part of a slice. I *real

Re: Negative array indicies and slice()

2012-10-29 Thread Steven D'Aprano
On Mon, 29 Oct 2012 01:59:06 -0700, andrewr3mail wrote: > Note: I subscribed to the python-list, and am able to recieve e-mails, > but I don't see how to write a post for this particular thread nor > subscribe to this particular thread... The beauty of email is that you don't have to subscribe to

Re: Help understanding an Object Oriented Program example

2012-10-29 Thread Ulrich Eckhardt
Am 29.10.2012 00:30, schrieb goldtech: class Contact: all_contacts = [] def __init__(self, name, email): self.name = name self.email = email Contact.all_contacts.append(self) Okay, a class that automatically registers all instances in a central list. OK,

Re: Negative array indicies and slice()

2012-10-29 Thread Steven D'Aprano
On Mon, 29 Oct 2012 00:54:29 -0700, Andrew wrote: > Actually, I said in the OP: > > "I also don't understand why slice() is not equivalent to an iterator, > but can replace an integer in __getitem__() whereas xrange() can't." Slices and iterators have different purposes and therefore have not be

Re: Negative array indicies and slice()

2012-10-29 Thread Chris Angelico
On Mon, Oct 29, 2012 at 10:19 PM, Steven D'Aprano wrote: >> In 'C', where Python is written, > > That's a popular misapprehension. Python is written in Java, or Lisp, or > Haskell, or CLR (dot Net), or RPython, or Ocaml, or Parrot. Each of those > languages have, or had, at least one Python implem

Applying a paid third party ssl certificate

2012-10-29 Thread ehsmenggroups
Hi all, I haven't quite figured out how to apply a paid ssl cert, say RapidSSL free SSL test from Python's recent sponsor sslmatrix.com and what to do with that to make Python happy. This good fellow suggests using the PEM format. I tried and failed. http://www.minnmyatsoe.com/category/python-2

Re: Negative array indicies and slice()

2012-10-29 Thread Andrew Robinson
On 10/29/2012 04:32 AM, Chris Angelico wrote: I wonder if what the OP is looking for is not slicing, but something more akin to map. Start with a large object and an iterator that produces keys, and create an iterator/list of their corresponding values. Something like: a=[1,2,3,4,5,6,7,8,9,10]

Re: attaching names to subexpressions

2012-10-29 Thread Neil Cerutti
On 2012-10-28, Devin Jeanpierre wrote: >>> The 'canonical way' >>> while True: >>> line = complex_expression >>> if not line: >>> break >>> do_something_with(line) >>> >>> avoids this problem, but I was never really convinced about the beauty / >>> readbility of this constr

I need help installing pypng in Python 3.3

2012-10-29 Thread icgwh
Hello all, I am very new to python. I am currently porting a little project of mine from java to python and I need to be able to construct and write png images. I naturally turned myself toward pypng to accomplish this. I learned from the net that pypng 0.0.13 is supposed to work in Python 3.x

OrderedDict / DIctComprehension

2012-10-29 Thread Christian
Hi, is there a way building an OrderedDict faster? Thanks in advance Christian @timeit def ordered(n=10): d = OrderedDict() for i in xrange(n): d['key'+str(i)] = i return d @timeit def comprehension(n=10): d = { 'key'+str(i):i for i in xrange(n) } return d

Re: Negative array indicies and slice()

2012-10-29 Thread Chris Angelico
On Mon, Oct 29, 2012 at 3:52 PM, Andrew Robinson wrote: > I am curious as to how quickly it constructs the result compared to a slice > operation. > > Eg: > a[1:5] > vs. > [ a[i] for i in xrange[1:5] ] For the most part, don't concern yourself with performance. Go with functionality and readabili

Re: SSH Connection with Python

2012-10-29 Thread Schneider
thank you guys for the huge list of answers, In my setting I have to access some routers and firewall from a linux-client. I think I'll try Fabric. On 26.10.2012 06:20, Rodrick Brown wrote: On Oct 25, 2012, at 6:34 AM, Schneider wrote: Hi Folkz, how can i create a SSH-Connection with pyth

Re: SSH Connection with Python

2012-10-29 Thread Christian
Am Donnerstag, 25. Oktober 2012 12:31:46 UTC+2 schrieb Schneider: > Hi Folkz, > > how can i create a SSH-Connection with python? I have to send some > > commands to the remote host and parse their answers. > > greatz Johannes There is a module in chilkat. http://www.example-code.com/python/ssh

Re: Negative array indicies and slice()

2012-10-29 Thread Andrew Robinson
On 10/29/2012 04:19 AM, Steven D'Aprano wrote: On Mon, 29 Oct 2012 00:54:29 -0700, Andrew wrote: Slices and iterators have different purposes and therefore have not been made interchangeable. Yes, there are certain similarities between a slice and xrange, but there are also significant differenc

Re: SSH Connection with Python

2012-10-29 Thread Roy Smith
In article , Gelonida N wrote: > The sh module looks intersting, but it's not supported for Windows > platforms. "The X module looks interesting but it's not supported for Windows" is true for many values of X. It's all part of the TCO of using a brain-dead operating system. -- http://mail

Re: I need help installing pypng in Python 3.3

2012-10-29 Thread Andrew Robinson
On 10/29/2012 05:23 AM, icgwh wrote: Hello all, I am very new to python. I am currently porting a little project of mine from java to python and I need to be able to construct and write png images. I naturally turned myself toward pypng to accomplish this. I don't know if this will help, but:

Re: I need help installing pypng in Python 3.3

2012-10-29 Thread icgwh
I probably should have mentioned that I'm under W7 ultimate x64, I'm using eclipse Juno (latest) and pydev 2.7.1 -- http://mail.python.org/mailman/listinfo/python-list

Re: I need help installing pypng in Python 3.3

2012-10-29 Thread icgwh
That's very kind of you but I don't think it would be particularly fitted to my needs. The program I'm trying to code creates an image as an 2D array of "pixels" which is defined by RGBA value. My program needs to access and modifies every component of every pixels in the image following a set o

Re: OT Questions

2012-10-29 Thread Ian Kelly
On Sun, Oct 28, 2012 at 10:15 AM, Joshua Landau wrote: > I feel necessity to argue against this point. > > It is a common thing to stereotype teens in this way - but, being teen > myself, I feel one should try to avoid it. It's painful to watch every time > someone claims "he can't be a teenager

Re: Where are documentation for Gnome

2012-10-29 Thread Gene Heskett
On Sunday 28 October 2012 16:45:12 GangGreene did opine: > On Sun, 28 Oct 2012 16:29:07 +, Mark Lawrence wrote: > > On 13/10/2012 18:49, Santosh Kumar wrote: > > > > > > Try your local garden centre. > > I inquired at the local garden centre, Just got strange looks > > Are you sure tha

Re: Negative array indicies and slice()

2012-10-29 Thread Chris Angelico
On Mon, Oct 29, 2012 at 5:01 PM, Andrew Robinson wrote: > Looking at some of the online programming notes -- a slice apparently > doesn't use an integer storage variable that is capable of arbitrary > expansion. =-O -- and hence, won't work for very large sized lists. That > actually explains so

Re: Negative array indicies and slice()

2012-10-29 Thread Roy Smith
In article , Andrew Robinson wrote: > Show me an example where someone would write a slice with a negative and > a positive index (both in the same slice); > and have that slice grab a contiguous slice in the *middle* of the list > with orientation of lower index to greater index. It's possib

[ANN] 2 new articles in The Python Papers

2012-10-29 Thread mauricel...@acm.org
Hi all I'm pleased to announce 2 newly published articles in The Python Papers (ojs.pythonpapers.org). FUSE’ing Python for Development of Storage Efficient Filesystem (http://ojs.pythonpapers.org/index.php/tpp/article/view/244) Abstract: Filesystem is a core component of a functional operating

Re: I need help installing pypng in Python 3.3

2012-10-29 Thread David Robinow
On Mon, Oct 29, 2012 at 8:23 AM, wrote: > Hello all, > > I am very new to python. I am currently porting a little project of mine from > java to python and I need to be able to construct and write png images. I > naturally turned myself toward pypng to accomplish this. > > I learned from the ne

Re: SSH Connection with Python

2012-10-29 Thread David Robinow
On Sun, Oct 28, 2012 at 4:09 PM, Gelonida N wrote: > The only thing I'm concerned about paramiko is, that I don't see any > activity on the paramiko site and that one library it depends on is not > available is windows binary package for newer versions of python. > I don't understand why this is

Re: Immutability and Python

2012-10-29 Thread Jean-Michel Pichavant
- Original Message - > I have a philosofical doubt about immutability, that arised while > doing > the SCALA functional programming course. > > Now suppose I have a simple NumWrapper class, that very stupidly > does: > > class NumWrapper(object): > def __init__(self, number): >

Re: Immutability and Python

2012-10-29 Thread andrea crotti
2012/10/29 Jean-Michel Pichavant : > > "return NumWrapper(self.number + 1) " > > still returns a(nother) mutable object. > > So what's the point of all this ? > > JM > Well sure but it doesn't modify the first object, just creates a new one. There are in general good reasons to do that, for examp

Re: Immutability and Python

2012-10-29 Thread andrea crotti
2012/10/29 andrea crotti : >> > > Well sure but it doesn't modify the first object, just creates a new > one. There are in general good reasons to do that, for example I can > then compose things nicely: > > num.increment().increment() > > or I can parallelize operations safely not caring about th

Re: Immutability and Python

2012-10-29 Thread Mark Lawrence
On 29/10/2012 15:20, andrea crotti wrote: I have a philosofical doubt about immutability, that arised while doing the SCALA functional programming course. Now suppose I have a simple NumWrapper class, that very stupidly does: class NumWrapper(object): def __init__(self, number): s

Re: Immutability and Python

2012-10-29 Thread Paul Rubin
andrea crotti writes: > and we want to change its state incrementing the number ... > the immutability purists would instead suggest to do this: > def increment(self): > return NumWrapper(self.number + 1) Immutability purists would say that numbers don't have "state" and if you're tr

Re: Immutability and Python

2012-10-29 Thread Jean-Michel Pichavant
- Original Message - > 2012/10/29 Jean-Michel Pichavant : > > > > "return NumWrapper(self.number + 1) " > > > > still returns a(nother) mutable object. > > > > So what's the point of all this ? > > > > JM > > > > Well sure but it doesn't modify the first object, just creates a new > one.

Re: Immutability and Python

2012-10-29 Thread Chris Angelico
On Tue, Oct 30, 2012 at 2:55 AM, Paul Rubin wrote: > andrea crotti writes: >> and we want to change its state incrementing the number ... >> the immutability purists would instead suggest to do this: >> def increment(self): >> return NumWrapper(self.number + 1) > > Immutability puris

Re: Immutability and Python

2012-10-29 Thread andrea crotti
2012/10/29 Jean-Michel Pichavant : > > > In an OOP language num.increment() is expected to modify the object in place. > So I think you're right when you say that functional languages technics do > not necessarily apply to Python, because they don't. > > I would add that what you're trying to sugg

Re: Immutability and Python

2012-10-29 Thread andrea crotti
2012/10/29 Chris Angelico : > On Tue, Oct 30, 2012 at 2:55 AM, Paul Rubin wrote: >> andrea crotti writes: >>> and we want to change its state incrementing the number ... >>> the immutability purists would instead suggest to do this: >>> def increment(self): >>> return NumWrapper(self

Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Johannes Bauer
Hi there, I'm currently looking for a good solution to the following problem: I have two classes A and B, which interact with each other and which interact with the user. Instances of B are always created by A. Now I want A to call some private methods of B and vice versa (i.e. what C++ "friends"

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread andrea crotti
2012/10/29 Johannes Bauer : > Hi there, > > I'm currently looking for a good solution to the following problem: I > have two classes A and B, which interact with each other and which > interact with the user. Instances of B are always created by A. > > Now I want A to call some private methods of B

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Benjamin Kaplan
On Mon, Oct 29, 2012 at 9:33 AM, Johannes Bauer wrote: > Hi there, > > I'm currently looking for a good solution to the following problem: I > have two classes A and B, which interact with each other and which > interact with the user. Instances of B are always created by A. > > Now I want A to ca

Re: Numpy module

2012-10-29 Thread Benjamin Kaplan
On Sun, Oct 28, 2012 at 10:40 PM, wrote: > Hello to the group! > > I've learned a lot about Ubuntu just trying to install numpy for Python > 3.2.3. I've finally managed to put it in the Python3.2 directory but when I > try to import it, I still get there's "no module named numpy." There are >

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Chris Angelico
On Tue, Oct 30, 2012 at 3:33 AM, Johannes Bauer wrote: > Hi there, > > I'm currently looking for a good solution to the following problem: I > have two classes A and B, which interact with each other and which > interact with the user. Instances of B are always created by A. > > Now I want A to ca

Re: Immutability and Python

2012-10-29 Thread Paul Rubin
andrea crotti writes: > Also because how doi I make an immutable object in pure Python? Numbers in Python are already immutable. What you're really looking for is a programming style where you don't bind any variable more than once. This gives rise to a programming style that Python can support

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Grant Edwards
On 2012-10-29, Johannes Bauer wrote: > I'm currently looking for a good solution to the following problem: I > have two classes A and B, which interact with each other and which > interact with the user. Instances of B are always created by A. > > Now I want A to call some private methods of B an

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Johannes Bauer
On 29.10.2012 17:47, Chris Angelico wrote: > The usual convention for private methods is a leading underscore on the name: Yup, that's what I'm using. > It's only a convention, though; it doesn't make it "hard" to call > them, it just sends the message "this is private, I don't promise that > it

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Johannes Bauer
On 29.10.2012 17:52, Grant Edwards wrote: > By "decleare them privide" do you mean using __ASDF__ name-munging? > > It sounds to me like you're just making life hard on yourself. Gaah, you are right. I just noticed that using the single underscore (as I do) does not restrict usage in any "no

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Peter Otten
Johannes Bauer wrote: > Now I want A to call some private methods of B and vice versa (i.e. what > C++ "friends" are), but I want to make it hard for the user to call > these private methods. > > Currently my ugly approach is this: I delare the internal methods > private (hide from user). Then I

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Paul Rubin
Johannes Bauer writes: > This makes the source files largish however (they're currently split up > in different files). Can I use the nested class advantage and somehow > include the inner class from another file? You could possibly duck-punch class A: import B class A: ... A.B = B.B

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Peter Otten
Johannes Bauer wrote: > On 29.10.2012 17:52, Grant Edwards wrote: > >> By "decleare them privide" do you mean using __ASDF__ name-munging? >> >> It sounds to me like you're just making life hard on yourself. > > Gaah, you are right. I just noticed that using the single underscore > (as I do

Re: Negative array indicies and slice()

2012-10-29 Thread Ian Kelly
On Oct 29, 2012 7:10 AM, "Andrew Robinson" wrote: > I will be porting Python 3.xx to a super low power embedded processor > (MSP430), both space and speed are at a premium. > Running Python on top of Java would be a *SERIOUS* mistake. .NET won't even > run on this system. etc. If that's the ca

Re: OrderedDict / DIctComprehension

2012-10-29 Thread Terry Reedy
On 10/29/2012 8:36 AM, Christian wrote: Hi, is there a way building an OrderedDict faster? Thanks in advance Christian @timeit def ordered(n=10): d = OrderedDict() for i in xrange(n): d['key'+str(i)] = i return d try d = OrderedDict(['key'+str(i),i for i in xrange

Re: Negative array indicies and slice()

2012-10-29 Thread Ian Kelly
On Mon, Oct 29, 2012 at 1:54 AM, Andrew wrote: > My intended inferences about the iterator vs. slice question was perhaps not > obvious to you; Notice: an iterator is not *allowed* in __getitem__(). Yes, I misconstrued your question. I thought you wanted to change the behavior of slicing to wra

Re: Immutability and Python

2012-10-29 Thread Terry Reedy
On 10/29/2012 11:20 AM, andrea crotti wrote: I have a philosofical doubt about immutability, that arised while doing the SCALA functional programming course. In real life, the physical world, things have mutable state, at least down to the atomic level. Do you only want to model mathematical w

Re: Re: Immutability and Python

2012-10-29 Thread Evan Driscoll
On 10/29/2012 12:05 PM, andrea crotti wrote: > I meant how do I create new immutables classes myself, I guess that's > possible writing C extensions but I don't see in pure Python.. The short answer is: you don't, not really, except by using NamedTuple if that gives you what you want. The longer

Re: Immutability and Python

2012-10-29 Thread Terry Reedy
On 10/29/2012 1:05 PM, andrea crotti wrote: I meant how do I create new immutables classes myself, I guess that's possible writing C extensions but I don't see in pure Python.. If you mean class with immutable instances, mutate new instances in __new__ instead of __init__ and write a custom .

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Grant Edwards
On 2012-10-29, Johannes Bauer wrote: > On 29.10.2012 17:47, Chris Angelico wrote: > >> The usual convention for private methods is a leading underscore on the name: > > Yup, that's what I'm using. > >> It's only a convention, though; it doesn't make it "hard" to call >> them, it just sends the mes

Re: I need help installing pypng in Python 3.3

2012-10-29 Thread icgwh
> > Do you have the file c:\Python33\Lib\site-packages\pypng-0.0.13-py3.3.egg ? > > If not, you have not successfully installed pypng. Please try one of > > the methods I gave above. Yes I do have the egg. I'm gonna try to summarize: I don't have installations problems anymore but it seems

Re: Immutability and Python

2012-10-29 Thread Devin Jeanpierre
On Mon, Oct 29, 2012 at 12:46 PM, Paul Rubin wrote: > andrea crotti writes: >> Also because how doi I make an immutable object in pure Python? > > Numbers in Python are already immutable. What you're really looking for > is a programming style where you don't bind any variable more than once. N

Re: OrderedDict / DIctComprehension

2012-10-29 Thread Christian
Too bad that's not (using python2.7) 'ordered_dict_generator' ((), {}) 1.089588 sec Anyway thanks for your hint! > Hi, > > > > is there a way building an OrderedDict faster? > > > > Thanks in advance > > Christian > > > > @timeit > > def ordered(n=10): > > d = OrderedDict() >

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Ian Kelly
On Mon, Oct 29, 2012 at 10:58 AM, Johannes Bauer wrote: > Ah, that's nice. I didn't know that nested classes could access their > private members naturally (i.e. without using any magic, just with plain > old attribute access). There is nothing at all special about nested classes that is differen

Re: Immutability and Python

2012-10-29 Thread Ian Kelly
On Mon, Oct 29, 2012 at 10:12 AM, andrea crotti wrote: > Also because how doi I make an immutable object in pure Python? I sometimes use namedtuples for this. from collections import namedtuple MyImmutableClass = namedtuple('MyImmutableClass', 'field1 field2 field3 field4') If you want default

Re: Immutability and Python

2012-10-29 Thread Chris Angelico
On Tue, Oct 30, 2012 at 6:23 AM, Ian Kelly wrote: > _MyImmutableClass = namedtuple('MyImmutableClass', 'field1 field2 > field3 field4') > > class MyImmutableClass(_MyImmutableClass): Question: Is it clearer to take advantage of the fact that the base class can be an arbitrary expression? class M

Re: Immutability and Python

2012-10-29 Thread Ian Kelly
On Mon, Oct 29, 2012 at 1:36 PM, Chris Angelico wrote: > Question: Is it clearer to take advantage of the fact that the base > class can be an arbitrary expression? > > class MyImmutableClass(namedtuple('MyImmutableClass', 'field1 field2 > field3 field4')): > > You lose the unnecessary temporary a

Python Bug Day this Saturday in Montreal and on IRC

2012-10-29 Thread Éric Araujo
This Saturday, you have the opportunity of participating in the Python Bug Day. How would you like to be one of the contributors of Python? If you have ideas for improving parts of the official documentation, the standard library, the language itself, or if you have a patch waiting for a review t

Re: SSH Connection with Python

2012-10-29 Thread Gelonida N
On 10/29/2012 04:18 PM, David Robinow wrote: On Sun, Oct 28, 2012 at 4:09 PM, Gelonida N wrote: The only thing I'm concerned about paramiko is, that I don't see any activity on the paramiko site and that one library it depends on is not available is windows binary package for newer versions of

Re: SSH Connection with Python

2012-10-29 Thread Gelonida N
On 10/29/2012 02:10 PM, Roy Smith wrote: In article , Gelonida N wrote: The sh module looks intersting, but it's not supported for Windows platforms. "The X module looks interesting but it's not supported for Windows" is true for many values of X. It's all part of the TCO of using a brain

Re: I need help installing pypng in Python 3.3

2012-10-29 Thread Andrew Robinson
On 10/29/2012 06:39 AM, ic...@tagyourself.com wrote: That's very kind of you but I don't think it would be particularly fitted to my needs. The program I'm trying to code creates an image as an 2D array of "pixels" which is defined by RGBA value. My program needs to access and modifies every co

Re: Negative array indicies and slice()

2012-10-29 Thread Steven D'Aprano
On Mon, 29 Oct 2012 23:40:53 +1100, Chris Angelico wrote: > On Mon, Oct 29, 2012 at 3:52 PM, Andrew Robinson > wrote: >> I am curious as to how quickly it constructs the result compared to a >> slice operation. >> >> Eg: >> a[1:5] >> vs. >> [ a[i] for i in xrange[1:5] ] > > For the most part, do

Re: SSH Connection with Python

2012-10-29 Thread Roy Smith
In article , Gelonida N wrote: > On 10/29/2012 02:10 PM, Roy Smith wrote: > > In article , > > Gelonida N wrote: > > > >> The sh module looks intersting, but it's not supported for Windows > >> platforms. > > > > "The X module looks interesting but it's not supported for Windows" is > > true

Re: Negative array indicies and slice()

2012-10-29 Thread Steven D'Aprano
On Mon, 29 Oct 2012 11:19:38 +, Steven D'Aprano wrote: > Because xrange represents a concrete sequence of numbers, all three of > start, end and stride must be concrete, known, integers: > > py> xrange(4, None, 2) > Traceback (most recent call last): > File "", line 1, in > TypeError: an i

Re: Negative array indicies and slice()

2012-10-29 Thread Andrew Robinson
On 10/29/2012 06:52 AM, Roy Smith wrote: Show me an example where someone would write a slice with a negative and a positive index (both in the same slice); and have that slice grab a contiguous slice in the *middle* of the list with orientation of lower index to greater index. It's possible in b

RE: better way for ' '.join(args) + '\n'?

2012-10-29 Thread Prasad, Ramit
Thomas Rachel wrote: > Am 26.10.2012 09:49 schrieb Ulrich Eckhardt: > > Hi! > > > > General advise when assembling strings is to not concatenate them > > repeatedly but instead use string's join() function, because it avoids > > repeated reallocations and is at least as expressive as any alternativ

Re: Immutability and Python

2012-10-29 Thread Steven D'Aprano
On Mon, 29 Oct 2012 17:05:07 +, andrea crotti wrote: > I meant how do I create new immutables classes myself, I guess that's > possible writing C extensions but I don't see in pure Python.. Well, you can't *quite* make a truly immutable class in pure-Python, because if *your* Python code can

Re: Immutability and Python

2012-10-29 Thread Steven D'Aprano
On Tue, 30 Oct 2012 06:36:52 +1100, Chris Angelico wrote: > On Tue, Oct 30, 2012 at 6:23 AM, Ian Kelly > wrote: >> _MyImmutableClass = namedtuple('MyImmutableClass', 'field1 field2 >> field3 field4') >> >> class MyImmutableClass(_MyImmutableClass): > > Question: Is it clearer to take advantage o

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Steven D'Aprano
On Mon, 29 Oct 2012 17:33:24 +0100, Johannes Bauer wrote: > Hi there, > > I'm currently looking for a good solution to the following problem: I > have two classes A and B, which interact with each other and which > interact with the user. Instances of B are always created by A. > > Now I want A

Re: Immutability and Python

2012-10-29 Thread Chris Kaynor
On Mon, Oct 29, 2012 at 3:30 PM, Steven D'Aprano wrote: > On Mon, 29 Oct 2012 17:05:07 +, andrea crotti wrote: > >> I meant how do I create new immutables classes myself, I guess that's >> possible writing C extensions but I don't see in pure Python.. > > Well, you can't *quite* make a truly i

Re: Negative array indicies and slice()

2012-10-29 Thread Andrew Robinson
On 10/29/2012 10:09 AM, Ian Kelly wrote: On Oct 29, 2012 7:10 AM, "Andrew Robinson" wrote: I will be porting Python 3.xx to a super low power embedded processor (MSP430), both space and speed are at a premium. Running Python on top of Java would be a *SERIOUS* mistake. .NET won't even run on

Re: problems with xml parsing (python 3.3)

2012-10-29 Thread jannidis
Am Sonntag, 28. Oktober 2012 03:27:14 UTC+1 schrieb jann...@gmail.com: > Hello all, > > > > I am new to Python and have a problem with the behaviour of the xml parser. > Assume we have this xml document: > > > > > > > > > > Title of the first book. > > > >

Re: Negative array indicies and slice()

2012-10-29 Thread Chris Angelico
On Tue, Oct 30, 2012 at 2:42 AM, Andrew Robinson wrote: > No, there was no error at all. Pthon just crashed & exited; not even an > exception that I can recall. It was if it exited normally! Can you create a reproducible test case? There's usually a cause to these sorts of things. ChrisA --

Re: Negative array indicies and slice()

2012-10-29 Thread Ian Kelly
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 would someone *want* to do: > a[-7,10] > Instead of saying

Re: Immutability and Python

2012-10-29 Thread Steven D'Aprano
On Mon, 29 Oct 2012 15:20:02 +, andrea crotti wrote: > I have a philosofical doubt about immutability, that arised while doing > the SCALA functional programming course. "Philosophical". Like most words derived from the ancient Greeks, the "F" sound uses "ph" rather than "f". > Now suppose

Re: Negative array indicies and slice()

2012-10-29 Thread Ian Kelly
On Mon, Oct 29, 2012 at 9:42 AM, Andrew Robinson wrote: > The list was generated in a single pass by many .append() 's, and then > copied once -- the original was left in place; and then I attempted to slice > it. Note that if the list was generated by .appends, then it was copied more than once.

Re: Immutability and Python

2012-10-29 Thread Steven D'Aprano
On Mon, 29 Oct 2012 15:45:59 -0700, Chris Kaynor wrote: > On Mon, Oct 29, 2012 at 3:30 PM, Steven D'Aprano > wrote: >> On Mon, 29 Oct 2012 17:05:07 +, andrea crotti wrote: >> >>> I meant how do I create new immutables classes myself, I guess that's >>> possible writing C extensions but I don'

date and time comparison how to

2012-10-29 Thread noydb
All, I need help with a date and time comparison. Say a user enters a date-n-time and a file on disk. I want to compare the date and time of the file to the entered date-n-time; if the file is newer than the entered date-n-time, add the file to a list to process. How best to do? I have looke

Re: Negative array indicies and slice()

2012-10-29 Thread Roy Smith
In article , Ian Kelly wrote: > On Mon, Oct 29, 2012 at 9:42 AM, Andrew Robinson > wrote: > > The list was generated in a single pass by many .append() 's, and then > > copied once -- the original was left in place; and then I attempted to slice > > it. > > Note that if the list was generated

Re: Negative array indicies and slice()

2012-10-29 Thread Ian Kelly
On Mon, Oct 29, 2012 at 5:24 PM, Roy Smith wrote: > I think you're missing the point of "amortized constant time". Yes, the > first item appended to the list will be copied lg(20,000,000) ~= 25 > times, because the list will be resized that many times(*). But, on > average (I'm not sure if "aver

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: Negative array indicies and slice()

2012-10-29 Thread Ian Kelly
On Mon, Oct 29, 2012 at 5:43 PM, Ian Kelly wrote: > The growth factor is approximately 1.125. "Approximately" because > there is also a small constant term. The average number of copies per > item converges on 8. Of course, that is the *maximum* number of copies. The actual number could be muc

Re: Negative array indicies and slice()

2012-10-29 Thread Steven D'Aprano
On Mon, 29 Oct 2012 08:42:39 -0700, Andrew Robinson wrote: >>> But, why can't I just overload the existing __getitem__ for lists and >>> not bother writing an entire class? You say that as if writing "an entire class" was a big complicated effort. It isn't. It is trivially simple, a single line:

Re: date and time comparison how to

2012-10-29 Thread Gary Herron
On 10/29/2012 04:13 PM, noydb wrote: All, I need help with a date and time comparison. Say a user enters a date-n-time and a file on disk. I want to compare the date and time of the file to the entered date-n-time; if the file is newer than the entered date-n-time, add the file to a list to

Re: Negative array indicies and slice()

2012-10-29 Thread Roy Smith
In article , Ian Kelly wrote: > On Mon, Oct 29, 2012 at 5:24 PM, Roy Smith wrote: > > I think you're missing the point of "amortized constant time". Yes, the > > first item appended to the list will be copied lg(20,000,000) ~= 25 > > times, because the list will be resized that many times(*).

Re: date and time comparison how to

2012-10-29 Thread MRAB
On 2012-10-30 00:04, Gary Herron wrote: On 10/29/2012 04:13 PM, noydb wrote: All, I need help with a date and time comparison. Say a user enters a date-n-time and a file on disk. I want to compare the date and time of the file to the entered date-n-time; if the file is newer than the entere

Re: Negative array indicies and slice()

2012-10-29 Thread Andrew Robinson
On 10/29/2012 06:53 AM, Chris Angelico wrote: Can you provide links to these notes? I'm looking at cpython/Include/sliceobject.h that has this comment: /* A slice object containing start, stop, and step data members (the names are from range). After much talk with Guido, it was decided to let

  1   2   >