Catálogo de publicaciones - libros

Compartir en
redes sociales


Beginning Python: From Novice to Professional

Magnus Lie Hetland

Resumen/Descripción – provisto por la editorial

No disponible.

Palabras clave – provistas por la editorial

Software Engineering/Programming and Operating Systems

Disponibilidad
Institución detectada Año de publicación Navegá Descargá Solicitá
No detectada 2005 SpringerLink

Información

Tipo de recurso:

libros

ISBN impreso

978-1-59059-519-0

ISBN electrónico

978-1-4302-0072-7

Editor responsable

Springer Nature

País de edición

Reino Unido

Fecha de publicación

Información sobre derechos de publicación

© Apress 2005

Tabla de contenidos

Project 2: Painting a Pretty Picture

Magnus Lie Hetland

Let’s review some of the most important concepts covered in this chapter:

. A sequence is a data structure in which the elements are numbered (starting with zero). Examples of sequence types are lists, strings, and tuples. Of these, lists are mutable (you can change them), whereas tuples and strings are immutable (once they’re created, they’re fixed). Parts of a sequence can be accessed through slicing, supplying two indices, indicating the starting and ending position of the slice. To change a list, you assign new values to its positions, or use assignment to overwrite entire slices.

. Whether a value can be found in a sequence (or other container) is checked with the operator in. Using in with strings is a special case—it will let you look for substrings.

. Some of the built‐in types (such as lists and strings, but not tuples) have many useful methods attached to them. These are a bit like functions, except that they are tied closely to a specific value. Methods are an important aspect of object–oriented programming, which we look at later, in Chapter 7.

Pp. 411-420

Project 3: XML for All Occasions

Magnus Lie Hetland

Finally, you now know how to create shiny, professional–looking software with fancy GUI installers—or how to automate the generation of those precious .tar.gz files. Here is a summary of the specific concepts covered:

. The Distutils toolkit lets you write installer scripts, conventionally called setup.py, which let you install modules, packages, and extensions, and which let you build distributable archives and simple Windows installers.

. You can run your setup.py script with several commands, such as build, build_ext, install, sdist, and bdist.

Installers. There are many installer generators available, and you can use many of them to install your Python programs, making the process easier for your users.

. You can use Distutils to have your C extensions compiled automatically, with Distutils automatically locating your Python installation and figuring out which compiler to use. You can even have it run SWIG automatically.

py2exe. The py2exe extension to Distutils can be used to create executable binaries from your Python programs. Along with a couple of extra files (which can be conveniently installed with an installer), these .exe files can be run without installing a Python interpreter separately.

Pp. 421-437

Project 4: In the News

Magnus Lie Hetland

In this chapter, you learned about the following:

. A mapping enables you to label its elements with any immutable object, the most usual types being strings and tuples. The only built–in mapping type in Python is the dictionary.

. You can apply the string formatting operation to dictionaries by including names (keys) in the formatting specifiers. When using tuples in string formatting, you need to have one formatting specifier for each element in the tuple. When using dictionaries, you can have fewer specifiers than you have items in the dictionary.

. Dictionaries have quite a few methods, which are called in the same way as list and string methods.

Pp. 439-453

Project 5: A Virtual Tea Party

Magnus Lie Hetland

In this chapter, you learned about the following:

. A mapping enables you to label its elements with any immutable object, the most usual types being strings and tuples. The only built–in mapping type in Python is the dictionary.

. You can apply the string formatting operation to dictionaries by including names (keys) in the formatting specifiers. When using tuples in string formatting, you need to have one formatting specifier for each element in the tuple. When using dictionaries, you can have fewer specifiers than you have items in the dictionary.

. Dictionaries have quite a few methods, which are called in the same way as list and string methods.

Pp. 455-472

Project 6: Remote Editing with CGI

Magnus Lie Hetland

In this chapter, you learned about the following:

. A mapping enables you to label its elements with any immutable object, the most usual types being strings and tuples. The only built–in mapping type in Python is the dictionary.

. You can apply the string formatting operation to dictionaries by including names (keys) in the formatting specifiers. When using tuples in string formatting, you need to have one formatting specifier for each element in the tuple. When using dictionaries, you can have fewer specifiers than you have items in the dictionary.

. Dictionaries have quite a few methods, which are called in the same way as list and string methods.

Pp. 473-481

Project 7: Your Own Bulletin Board

Magnus Lie Hetland

This reference chapter has described every command, option and public DB:: variable provided by the Perl debugger. You will be able to use any of these tools to control your program’s execution, study its behavior, and inspect or change any data during the runtime of the program. Finally, you learned how to call the debugger in several different cases, depending on the context required.

Pp. 483-498

Project 8: File Sharing with XML–RPC

Magnus Lie Hetland

Here are the main topics covered in the chapter:

. Basically: Test first, code later. Tests let you rewrite your code with confidence, making your development and maintenance more flexible.

. These are indispensible tools if you want to do unit testing in Python. The doctest module is designed to check examples in docstrings, but can easily be used to design test suites. For more flexibility and structure in your suites, the unittest framework is very useful.

. These two tools read source code and point out potential (and actual) problems. They check everything from short variable names to unreachable pieces of code. With a little coding you can make them (or one of them) part of your test suite, to make sure all of your rewrites and refactorings conform to your coding standards.

. If you really care about speed and want to optimize your program (only do this if it’s absolutely necessary), you should profile it first. Use the profile (or hotshot) module to find bottlenecks in your code.

Pp. 499-516

Project 9: File Sharing II—Now with GUI!

Magnus Lie Hetland

Let’s review some of the most important concepts covered in this chapter:

. A sequence is a data structure in which the elements are numbered (starting with zero). Examples of sequence types are lists, strings, and tuples. Of these, lists are mutable (you can change them), whereas tuples and strings are immutable (once they’re created, they’re fixed). Parts of a sequence can be accessed through slicing, supplying two indices, indicating the starting and ending position of the slice. To change a list, you assign new values to its positions, or use assignment to overwrite entire slices.

. Whether a value can be found in a sequence (or other container) is checked with the operator in. Using in with strings is a special case—it will let you look for substrings.

. Some of the built‐in types (such as lists and strings, but not tuples) have many useful methods attached to them. These are a bit like functions, except that they are tied closely to a specific value. Methods are an important aspect of object–oriented programming, which we look at later, in Chapter 7.

Pp. 517-525

Project 10: Do–It–Yourself Arcade Game

Magnus Lie Hetland

Finally, you now know how to create shiny, professional–looking software with fancy GUI installers—or how to automate the generation of those precious .tar.gz files. Here is a summary of the specific concepts covered:

. The Distutils toolkit lets you write installer scripts, conventionally called setup.py, which let you install modules, packages, and extensions, and which let you build distributable archives and simple Windows installers.

. You can run your setup.py script with several commands, such as build, build_ext, install, sdist, and bdist.

Installers. There are many installer generators available, and you can use many of them to install your Python programs, making the process easier for your users.

. You can use Distutils to have your C extensions compiled automatically, with Distutils automatically locating your Python installation and figuring out which compiler to use. You can even have it run SWIG automatically.

py2exe. The py2exe extension to Distutils can be used to create executable binaries from your Python programs. Along with a couple of extra files (which can be conveniently installed with an installer), these .exe files can be run without installing a Python interpreter separately.

Pp. 527-546