Friday, December 1, 2017

How Psychology Can Make Your Emails More Appealing - #infographic

Your email marketing campaigns aren’t as effective as they could be. How do we know? Well, unless you’re getting a 100% open rate on every campaign — which is rare or nonexistent — there’s room for improvement. When was the last time you examined the appeal and effectiveness of your email marketing...

[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Web Desk via Digital Information World

Refining the Message: The Journey, Episode 8

The Journey, a Social Media Examiner production, is an episodic video documentary that shows you what really happens inside a growing business. //www.youtube.com/watch?v=-CPH2nuwsDw Watch The Journey: Episode 8 Episode 8 of The Journey follows Michael Stelzner, founder of Social Media Examiner, as he continues to pursue what many will see as an impossible goal: to [...]

This post Refining the Message: The Journey, Episode 8 first appeared on .
- Your Guide to the Social Media Jungle


by Michael Stelzner via

Introduction to Python Generators

Generators make it easy to create iterations in Python and in return write less code. This tutorial will introduce you to Python generators, their benefits, and how they work.

Basics

A generator is a function that returns a generator object on which you can call the next() method, so that for every call it returns a value or the next value. A normal Python function uses the return keyword to return values, but generators use the keyword yield to return values. This means that any Python function containing a yield statement is a generator function.

The yield statement usually halts the function and saves the local state so that it can be resumed right where it left off. Generator functions can have one or more yield statements.

A generator is also an iterator, but what is an iterator? Before we dive into the details of generators, I think it's important to know what iterators are because they form an integral part of this discussion.

Python Iterators

A Python iterator is simply a class that defines an __iter__() method. Most Python objects are iterable, which means you can loop over each and every element in the objects. Examples of iterables in Python include strings, lists, tuples, dictionaries, and ranges.

Let's consider the example below, in which we are looping over a list of colors:

Behind the scenes, the for statement will call iter() on the list object. The function will then return an iterator object that defines the method __next__(), which will then access each color, one at a time. When there are no more colors left, __next__ will raise a stopIteration exception, which will in turn inform the for loop to terminate.

Iterating Over a Dictionary

Iterating Over Rows in a CSV File

Iterating Over a String

Benefits of Using Generators

Let's discuss some of the benefits of using generators as opposed to iterators:

Easy to Implement

Building an iterator in Python will require you to implement a class with __iter__() and __next__() methods as well as taking care of any errors that may cause a stopIteration error.

As you can see above, the implementation is very lengthy. All this burden is automatically handled by generators.

Less Memory Consumption

Generators help to minimize memory consumption, especially when dealing with large data sets, because a generator will only return one item at a time.

Better Performance and Optimisation

Generators are lazy in nature. This means that they only generate values when required to do so. Unlike a normal iterator, where all values are generated regardless of whether they will be used or not, generators only generate the values needed. This will, in turn, lead to your program performing faster.

How to Create a Generator in Python

Creating a generator is very easy. All you need to do is write a normal function, but with a yield statement instead of a return statement, as shown below.

While a return statement terminates a function entirely, yield just pauses the function until it is called again by the next() method.

For example, the program below makes use of both the yield and next() statements.

How Python Generators Work

Let's  see how generators work. Consider the example below.

In the function above, we define a generator named myGenerator, which takes a list l as an argument. We then define a variable total and assign to it a value of zero. In addition, we loop through each element in the list and subsequently add it to the total variable.

We then instantiate newGenerator and call the next() method on it. This will run the code until it yields the first value of total, which will be 0 in this case. The function then keeps the value of the total variable until the next time the function is called. Unlike a normal return statement, which will return all the values at once, the generator will pick up from where it left off.

Below are the remaining subsequent values.

If you try to call the function after it has completed the loop, you will get a StopIteration error.

StopIteration is raised by the next() method to signal that there are no further items produced by the iterator.

Example 2

In this example, we show how to use multiple yield statements in a function.

Whereas a normal function returns all the values when the function is a called, a generator waits until the next() method is called again. Once next() is called, the colors function resumes from where it had stopped.

Conclusion

Generators are more memory efficient, especially when working with very large lists or big objects. This is because you can use yields to work on smaller bits rather than having the whole data in memory all at once.

Additionally, don’t forget to see what we have available for sale and for study on Envato Market, and don't hesitate to ask any questions and provide your valuable feedback using the feed below.

Furthermore, if you feel stuck, there is a very good course on Python generators in the course section. 


by Esther Vaati via Envato Tuts+ Code

5 Social Tools for Social Media Marketers

Want to save time creating content and ads for your social media marketing? Interested in tools that help you track content and ad performance? To explore tools that simplify a marketer’s job, I interview Ian Cleary. More About This Show The Social Media Marketing podcast is an on-demand talk radio show from Social Media Examiner. [...]

This post 5 Social Tools for Social Media Marketers first appeared on .
- Your Guide to the Social Media Jungle


by Michael Stelzner via

3D Music XP - BDDI 2018

3D Music Experiments created by Interactive Designer & Developer Bachelor students from Gobelins school.
by via Awwwards - Sites of the day

3 Things Every CEO Should Do to Succeed on Social Media - #Infographic

Social networks have become central to the lives of many consumers, yet many chief executives aren’t engaging with them deeply. A recent study of Fortune 500 CEOs found that 61% have no public-facing social media presence. Moreover, of those leaders who are present, 70% have accounts on only one...

[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Web Desk via Digital Information World

The 20 Best Smartphones In The World

The gap between good and great smartphones is getting smaller and smaller, and ranking smartphones is becoming harder and harder. There's a lot to consider here, such as specs, features, design, and price. Thankfully, most of these smartphones come with more than enough power, great designs,...

[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Irfan Ahmad via Digital Information World