Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Practical Maya Programming with Python

You're reading from   Practical Maya Programming with Python Unleash the power of Python in Maya and unlock your creativity

Arrow left icon
Product type Paperback
Published in Jul 2014
Publisher
ISBN-13 9781849694728
Length 352 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Robert Galanakis Robert Galanakis
Author Profile Icon Robert Galanakis
Robert Galanakis
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Introspecting Maya, Python, and PyMEL FREE CHAPTER 2. Writing Composable Code 3. Dealing with Errors 4. Leveraging Context Managers and Decorators in Maya 5. Building Graphical User Interfaces for Maya 6. Automating Maya from the Outside 7. Taming the Maya API 8. Unleashing the Maya API through Python 9. Becoming a Part of the Python Community A. Python Best Practices Index

Learning to use list comprehensions

Let's look at list comprehensions in depth now that we've used simpler versions several times. It's a powerful-yet-simple syntax that has been in Python since version 2.0. List comprehensions are described very succinctly and with very clear examples in PEP 202 at http://www.python.org/dev/peps/pep-0202/.

Tip

A Python Enhancement Proposal (PEP) is a design document for a Python feature (or similar). Often it can be very long and technical. PEP 202 is a very straightforward PEP that is well worth reading, consisting of three paragraphs and one example block. Some other notable PEPs will be mentioned in this book and in the appendices.

Oh, and PEP 1 describes PEPs and the PEP process, of course.

A list comprehension has the following form:

[<map> for <variable> in <selection> | if <predicate>]

The map is the item that ends up in the list. It can be the same as variable if no transformation is to take place. It's commonly...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime