Some other tools, if you haven't come across them yet.
You already know about str.join ()
Slicing
>>>b=['s','p','a','m']
b [ : 1 ]
['s']
b [ : 2 ]
['s', 'p']
Also, consider
>>>len ( b)
4
>>>range ( 4 )
[ 0, 1, 2, 3, 4]
# which I can iterate over.
On Tue, May 28, 2013 at 4:54 AM, T
One way I can suggest is
x=0; ham=''; b=['s','p','a','m'] #or, b=('s','p','a','m')
> for t in b:
> ham=ham+b[x]
> print(ham);x+=1
>
>
> 't' is actually equal to b[x] and its faster then indexed based look-up.
so you can rewrite
ham = ham + b[x]
as
ham += t
and remove the x inc
Okay, so I made it to FOR loops in the Lutz book. A couple of days ago I was
helped here with the .join method for creating strings from lists or tuples of
strings. I got to wondering if I could just, for the sake of learning, do the
same thing in a FOR loop, since that's today's chapter:
x=0
On Mon, May 27, 2013 at 4:01 PM, Jim Mooney wrote:
> I was looking at the bytecode doc page as a break from the Lutz book,
> since I like Assembler-type code due to its total non-ambiguity, but
> the page doesn't say much. Is there a doc somewhere that corresponds
> some of the bytecode to Python
On 05/27/2013 07:56 PM, ALAN GAULD wrote:
I can't speak for Jim, but I have used the dis module in the past to
quickly check how python parsed an expression (e.g. not x is y).
Yes, I've done that too. But that's not the bytecodes (at least not what
I understand as bytecodes) that's the dis-asse
On 28/05/2013 00:32, Steven D'Aprano wrote:
On 28/05/13 06:01, Jim Mooney wrote:
Another question. I tried installing a package that back-compiles (in
win 7), so I could see things that way, and got the error
"Unable to find vcvarsall.bat"
Shall we guess what package that is? I love guessing g
I can't speak for Jim, but I have used the dis module in the past to
>quickly check how python parsed an expression (e.g. not x is y).
>Yes, I've done that too. But that's not the bytecodes (at least not what
I understand as bytecodes) that's the dis-assembly listing which is
usually far more use
On 28/05/13 06:01, Jim Mooney wrote:
I was looking at the bytecode doc page as a break from the Lutz book,
since I like Assembler-type code due to its total non-ambiguity, but
the page doesn't say much. Is there a doc somewhere that corresponds
some of the bytecode to Python source? I thought rot
On Mon, May 27, 2013 at 7:20 PM, Alan Gauld wrote:
> Can you give a use case of how you think you could use them?
> There may be another way to do what you want.
I can't speak for Jim, but I have used the dis module in the past to
quickly check how python parsed an expression (e.g. not x is y).
Thank you, for the details.
On Mon, May 27, 2013 at 10:13 AM, eryksun wrote:
> On Mon, May 27, 2013 at 9:45 AM, Matthew Ngaha
> wrote:
> > On Mon, May 27, 2013 at 2:14 PM, SM wrote:
> >
> >>But then I also had to use self.fileDialog from within the function. Not
> >> sure how I could avoid us
On 27/05/13 21:21, Jim Mooney wrote:
Oscar Benjamin
What do you want these for? I've never needed to know what the
interpreter's bytecodes are.
I programmed A86 Assembler years ago, and just find the bytecode has a
comfortable clarity as a learning tool,
To me, the bytecodes are the litera
Oscar Benjamin
> What do you want these for? I've never needed to know what the
> interpreter's bytecodes are.
I programmed A86 Assembler years ago, and just find the bytecode has a
comfortable clarity as a learning tool, at least for me. When an
author vaguely tried to explain that a Name in Py
On 27 May 2013 21:01, Jim Mooney wrote:
>
> I was looking at the bytecode doc page as a break from the Lutz book,
> since I like Assembler-type code due to its total non-ambiguity, but
> the page doesn't say much. Is there a doc somewhere that corresponds
> some of the bytecode to Python source? I
I was looking at the bytecode doc page as a break from the Lutz book,
since I like Assembler-type code due to its total non-ambiguity, but
the page doesn't say much. Is there a doc somewhere that corresponds
some of the bytecode to Python source? I thought rot_1, 2, 3, and 4
looked useful, but it w
On 27/05/13 15:17, Jack Little wrote:
Is there a way to make buttons a little like a raw_input in the context
when the user presses the button, the program performs a function?
Yes, but its a lot more complicated than raw_input.
See the GUI topic of my tutorial for examples.
Also check out th
On Mon, May 27, 2013 at 9:45 AM, Matthew Ngaha wrote:
> On Mon, May 27, 2013 at 2:14 PM, SM wrote:
>
>>But then I also had to use self.fileDialog from within the function. Not
>> sure how I could avoid using fileDialog.
>>
>
> No problem. to do it without the instance variable, you access its
> m
Is there a way to make buttons a little like a raw_input in the context when
the user presses the button, the program performs a function?___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailma
Yes, the following works.
path = QtGui.QFileDialog.getOpenFileName()
Thanks!
On Mon, May 27, 2013 at 9:45 AM, Matthew Ngaha wrote:
> On Mon, May 27, 2013 at 2:14 PM, SM wrote:
>
> >But then I also had to use self.fileDialog from within the function. Not
> > sure how I could avoid using fileDi
On Mon, May 27, 2013 at 2:14 PM, SM wrote:
>But then I also had to use self.fileDialog from within the function. Not
> sure how I could avoid using fileDialog.
>
> Thanks.
No problem. to do it without the instance variable, you access its
method directly. so replace:
path = self.fileDialog.getO
Thanks!
I defined a function, as you suggested, to call when the button was
clicked. But then I also had to use self.fileDialog from within the
function. Not sure how I could avoid using fileDialog.
I also defined global variable (under the class) and assigned it to the
filename, so I could access
Sorry for the forward, i forgot to reply to tutor
On Mon, May 27, 2013 at 3:53 AM, Sunitha Misra wrote:
> self.fileDialog = QtGui.QFileDialog()
>
> QtCore.QObject.connect(self.toolButton,
> QtCore.SIGNAL(_fromUtf8("clicked()")), self.fileDialog.getOpenFileName)
>
i think the way youre doing it
21 matches
Mail list logo