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, Tim
On 28/05/13 04:54, Tim Hanson wrote:
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
Alright, it works, eventually. Can someone help me find a little more elegant
way of doing this? I'm sure there are several.
Python
On 27 May 2013 16:20, Alan Gauld alan.ga...@btinternet.com wrote:
To me, the bytecodes are the literal hex values corresponding
to the Python assembler statements. Are you sure you need the bytecodes?
You can use the standard library to generate the
assembler listing from the Python code.
On 27 May 2013 16:32, Steven D'Aprano st...@pearwood.info wrote:
On 28/05/13 06:01, Jim Mooney wrote:
Shall we guess what package that is? I love guessing games!
Ah, who am I kidding. No I don't.
Well, I would hate to keep you guessing ;') It's called decompyle -
pip couldn't find it,
On 05/28/2013 07:02 AM, Jim Mooney wrote:
On 27 May 2013 16:20, Alan Gauld alan.ga...@btinternet.com wrote:
To me, the bytecodes are the literal hex values corresponding
to the Python assembler statements. Are you sure you need the bytecodes?
You can use the standard library to generate the
Could you please help me with a simple example of a Python well-formed
formula in order to understand well-formed formulas and formation rules
concepts properly?
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
Hi,
On 28 May 2013 12:44, Citizen Kant citizenk...@gmail.com wrote:
Could you please help me with a simple example of a Python well-formed
formula in order to understand well-formed formulas and formation rules
concepts properly?
I'm assuming you perhaps meant well-formed expression. If
On 28/05/13 21:44, Citizen Kant wrote:
Could you please help me with a simple example of a Python well-formed
formula in order to understand well-formed formulas and formation rules
concepts properly?
Probably not, since they aren't really Python terms, so I'll be guessing what
they are.
On 05/28/2013 08:20 AM, Walter Prins wrote:
Hi,
On 28 May 2013 12:44, Citizen Kant citizenk...@gmail.com wrote:
Could you please help me with a simple example of a Python well-formed
formula in order to understand well-formed formulas and formation rules
concepts properly?
I'm assuming you
2013/5/28 Dave Angel da...@davea.name
On 05/28/2013 08:20 AM, Walter Prins wrote:
Hi,
On 28 May 2013 12:44, Citizen Kant citizenk...@gmail.com wrote:
Could you please help me with a simple example of a Python well-formed
formula in order to understand well-formed formulas and formation
On 28/05/13 23:45, Citizen Kant wrote:
I'm trying to figure out the rules on how to recognize when a combination
of symbols is considered a well formed expression in Python. Since I
couldn't find any doc that lists all Python syntax rules
Start by going to the Python website, www.python.org.
Citizen,
On 28 May 2013 14:45, Citizen Kant citizenk...@gmail.com wrote:
I'm trying to figure out the rules on how to recognize when a combination
of symbols is considered a well formed expression in Python.
How do you recognize that an arithmetic expression is a well formed (e.g.
valid)
On Tue, May 28, 2013 at 7:18 AM, Dave Angel da...@davea.name wrote:
dis.dis(myfunction)
will disassemble one function.
That's not all that's in the byte-code file, but this is 98% of what you
probably want out of it. And you can do it in the debugger with just the
standard library.
The
On 28 May 2013 17:48, eryksun eryk...@gmail.com wrote:
On Tue, May 28, 2013 at 7:18 AM, Dave Angel da...@davea.name wrote:
dis.dis(myfunction)
will disassemble one function.
That's not all that's in the byte-code file, but this is 98% of what you
probably want out of it. And you can do it
On Tue, May 28, 2013 at 1:12 PM, Oscar Benjamin
oscar.j.benja...@gmail.com wrote:
On 28 May 2013 17:48, eryksun eryk...@gmail.com wrote:
The argument for dis.dis() can be a module, class, function or code
object. It disassembles all the top-level code objects that it finds,
but it doesn't
Python 3.3, Windows operating system:
I am communicating with a device using a Python script and I am
coding except clauses in my send and receive functions to handle a
particular error. I can't find a WinError example, and I can't get the
syntax right. I have researched this and tried the
On 05/28/2013 09:45 AM, Citizen Kant wrote:
SNIP
I'm trying to figure out the rules on how to recognize when a combination
of symbols is considered a well formed expression in Python. Since I
couldn't find any doc that lists all Python syntax rules --or maybe the doc
is too long to be
On 28 May 2013 18:24, eryksun eryk...@gmail.com wrote:
On Tue, May 28, 2013 at 1:12 PM, Oscar Benjamin
oscar.j.benja...@gmail.com wrote:
On 28 May 2013 17:48, eryksun eryk...@gmail.com wrote:
The argument for dis.dis() can be a module, class, function or code
object. It disassembles all the
On Tue, May 28, 2013 at 1:58 PM, Oscar Benjamin
oscar.j.benja...@gmail.com wrote:
So what happens to the code object for the top-level code in the
module itself when it is imported in the normal way? Is it just
discarded once import is complete? Is it temporarily accessible during
import?
On 28.05.2013 19:25, sparkle Plenty wrote:
I need to catch and handle 10057 exceptions when they occur and keep
running. I know 10057 is a WinError, which is a subset of OSError, I
just can't find the right syntax for it. I would appreciate some
help on this one.
I have neither Windows nor
If I use an if statement, I cannot use continue after I do my error
handling, so I am really trying to use the except errorname: instead of an
if statement. Therefore, I have to find the correct error name to identify
the 10057 condition to the interpreter, but thanks anyway, Andreas.
On Tue,
On 05/28/2013 03:37 PM, sparkle Plenty wrote:
If I use an if statement, I cannot use continue after I do my error
handling,
The presence of an if statement cannot affect whether or not a continue
can work. If you give a concrete code example, somebody will be able to
identify the confusion.
On 28.05.2013 21:37, sparkle Plenty wrote:
If I use an if statement, I cannot use continue after I do my error
handling, so I am really trying to use the except errorname: instead of an
if statement.
I think you haven't understood the code snippet I've posted. The
if-statement is inside the
On 28 May 2013 04:18, Dave Angel da...@davea.name wrote:
On 05/28/2013 07:02 AM, Jim Mooney wrote:
Alan and Devin already gave more specifics, but to repeat,
import dis
dis.dis(myfunction)
will disassemble one function.
I think authors miss a didactic opportunity by not using bytecode as
On 28/05/13 21:15, Jim Mooney wrote:
I think authors miss a didactic opportunity by not using bytecode as a
teaching tool now and then, since it's easily explained, at least for
basic statements.
Assuming you mean the assembler statements then it may be true.
Looking at Bytecode is just an
On Tue, May 28, 2013 at 3:49 PM, Dave Angel da...@davea.name wrote:
I don't use Windows, but I doubt if there's a separate exception
type for 10057.
Windows sockets error codes at or above 1 aren't mapped to POSIX
error codes. Instead errno is set directly from winerror. So there's
no
On 28/05/13 13:54, Tim Hanson wrote:
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
On 28 May 2013 19:34, Steven D'Aprano st...@pearwood.info wrote:
The standard method for assembling a string from a collection
of substrings is to do it in one go, using the join method,
Wow, that means I can do this: print ''.join('But this parrot is dead!')
--
Jim
Ornhgvshy vf orggre
On 29.05.2013 05:20, Jim Mooney wrote:
On 28 May 2013 19:34, Steven D'Aprano st...@pearwood.info wrote:
The standard method for assembling a string from a collection
of substrings is to do it in one go, using the join method,
Wow, that means I can do this: print ''.join('But this parrot
29 matches
Mail list logo