text:
from __future__ import print_function, division, absolute_import

"""
This defines the DataShape type system, with unified
shape and data type.
"""

import sys
import ctypes
import operator

from math import ceil

import datashape

import numpy as np

from .py2help import (
    OrderedDict,
    _inttypes,
    _strtypes,
    basestring,
    unicode,
    with_metaclass,
)
from .internal_utils import IndexCallable, isidentifier

# Classes of unit types.
DIMENSION = 1
MEASURE = 2

class Type(type):
    _registry = {}

    def __new__(meta, name, bases, dct):
        cls = super(Type, meta).__new__(meta, name, bases, dct)
        # Don't register abstract classes
        if not dct.get('abstract'):
            Type._registry[name] = cls
        return cls

    @classmethod
    def register(cls, name, type):
        # Don't clobber existing types.
        if name in cls._registry:
            raise TypeError('There is another type registered with name %s'
                            % name)

        cls._registry[name] = type

    @classmethod
    def lookup_type(cls, name):
        return cls._registry[name]

class Mono(with_metaclass(Type, object)):

    """
    Monotype are unqualified 0 parameters.

    Each type must be reconstructable using its parameters:

        type(datashape_type)(*type.parameters)
    """

    composite = False

    def __init__(self, *params):
        self._parameters = params

    @property
    def _slotted(self):
        return hasattr(self, '__slots__')

    @property
    def parameters(self):
        if self._slotted:
            return tuple(getattr(self, slot) for slot in self.__slots__)
        else:
            return self._parameters

    def info(self):
        return type(self), self.parameters

    def __eq__(self, other):
        return (isinstance(other, Mono) and
                self.shape == other.shape and
                self.measure.info() == other.measure.info())

    def __ne__(self, other):
        return not self.__eq__(other)

    def __hash__(self):
        try:
            h = self._hash
        except AttributeError:
            h = self._hash = hash(self.shape) ^ hash(self.measure.info())
        return h

    @property
    def shape(self):
        return ()

    def __len__(self):
        return 1

    def __getitem__(self, key):
        return [self][key]

    def __repr__(self):
        return '%s(%s)' % (
            type(self).__name__,
            ', '.join(
                (
                    '%s=%r' % (slot, getattr(self, slot))
                    for slot in self.__slots__
                ) if self._slotted else
                map(repr, self.parameters),
            ),
        )

    # Monotypes are their own measure
    @property
    def measure(self):
        return self

    def subarray(self, leading):
        """Returns a data shape object of the subarray with 'leading'
        dimensions removed. In the case of a measure such as CType,
        'leading' must be 0, and self is returned.
        """
        if leading >= 1:
            raise IndexError(('Not enough dimensions in data shape '
                              'to remove %d leading dimensions.') % leading)
        else:
            return self

    def __mul__(self, other):
        if isinstance(other, _strtypes):
            import datashape
            return datashape.dshape(other).__rmul__(self)
        if isinstance(other, _inttypes):
            other = Fixed(other)
        if isinstance(other, DataShape):
            return other.__rmul__(self)

        return DataShape(self, other)

    def __rmul__(self, other):
        if isinstance(other, _strtypes):
            import datashape
            return self * datashape.dshape(other)
        if isinstance(other, _inttypes):
            other = Fixed(other)

        return DataShape(other, self)

    def __getstate__(self):
        return self.parameters

    def __setstate__(self, state):
        if self._slotted:
            for slot, val in zip(self.__slots__, state):
                setattr(self, slot, val)
        else:
            self._parameters = state

    def to_numpy_dtype(self):
        raise TypeError('DataShape %s is not NumPy-compatible' % self)

class Unit(Mono):

    """
    Unit type that does not need to be reconstructed.
    """

    def __str__(self):
        return type(self).__name__.lower()

class Ellipsis(Mono):

    """Ellipsis (...). Used to indicate a variable number of dimensions.

    E.g.:

        ... * float32    # float32 array w/ any number of dimensions
        A... * float32   # float32 array w/ any number of dimensions,
                        # associated with type variable A
    """
    __slots__ = 'typevar',

    def __init__(self, typevar=None):
        self.typevar = typevar

    def __str__(self):
        return str(self.typevar) + '...' if self.typevar else '...'

    def __repr__(self):
        return '%s(%r)' % (type(self).__name__, str(self))

class Null(Unit):

    """The null datashape."""
    pass

class Date(Unit):

    """ Date type """
    cls = MEASURE
    __slots__ = ()

    def to_numpy_dtype(self):
        return np.dtype('datetime64[D]')

class Time(Unit):

    """ Time type """
    cls = MEASURE
    __slots__ = 'tz',

    def __init__(self, tz=None):
        if tz is not None and not isinstance(tz, _strtypes):
            raise TypeError('tz parameter to time datashape must be a string')
        # TODO validate against Olson tz database
        self.tz = tz

    def __str__(self):
        basename = super(Time, self).__str__()
        if self.tz is None:
            return basename
        else:
            return '%s[tz=%r]' % (basename, str(self.tz))

class DateTime(Unit):

    """ DateTime type """
    cls = MEASURE
    __slots__ = 'tz',

    def __init__(self, tz=None):
        if tz is not None and not isinstance(tz, _strtypes):
            raise TypeError('tz parameter to datetime datashape must be a '
                            'string')
        # TODO validate against Olson tz database
        self.tz = tz

    def __str__(self):
        basename = super(DateTime, self).__str__()
        if self.tz is None:
            return basename
        else:
            return '%s[tz=%r]' % (basename, str(self.tz))

    def to_numpy_dtype(self):
        return np.dtype('datetime64[us]')

_units = set(['ns', 'us', 'ms', 's', 'm', 'h', 'D', 'W', 'M', 'Y'])

_unit_aliases = {
    'year': 'Y',
    'week': 'W',
    'day': 'D',
    'date': 'D',
    'hour': 'h',
    'second': 's',
    'millisecond': 'ms',
    'microsecond': 'us',
    'nanosecond': 'ns'
}

def normalize_time_unit(s):
    """ Normalize time input to one of 'year', 'second', 'millisecond', etc..
    Example
    -------
    >>> normalize_time_unit('milliseconds')
    'ms'
    >>> normalize_time_unit('ms')
    'ms'
    >>> normalize_time_unit('nanoseconds')
    'ns'
    >>> normalize_time_unit('nanosecond')
    'ns'
    """
    s = s.strip()
    if s in _units:
        return s
    if s in _unit_aliases:
        return _unit_aliases[s]
    if s[-1] == 's' and len(s) > 2:
        return normalize_time_unit(s.rstrip('s'))

    raise ValueError("Do not understand time unit %s" % s)

class TimeDelta(Unit):
    cls = MEASURE
    __slots__ = 'unit',

    def __init__(self, unit='us'):
        self.unit = normalize_time_unit(str(unit))

    def __str__(self):
        return 'timedelta[unit=%r]' % self.unit

    def to_numpy_dtype(self):
        return np.dtype('timedelta64[%s]' % self.unit)

class Units(Unit):
    """ Units type for values with physical units """
    cls = MEASURE
    __slots__ = 'unit', 'tp'

    def __init__(self, unit, tp=None):
        if not isinstance(unit, _strtypes):
            raise TypeError('unit parameter to units datashape must be a '
                            'string')
        if tp is None:
            tp = DataShape(float64)
        elif not isinstance(tp, DataShape):
            raise TypeError('tp parameter to units datashape must be a '
                            'datashape type')
        self.unit = unit
        self.tp = tp

    def __str__(self):
        if self.tp == DataShape(float64):
            return 'units[%r]' % (self.unit)
        else:
            return 'units[%r, %s]' % (self.unit, self.tp)

class Bytes(Unit):

    """ Bytes type """
    cls = MEASURE
    __slots__ = ()

_canonical_string_encodings = {
    u'A': u'A',
    u'ascii': u'A',
    u'U8': u'U8',
    u'utf-8': u'U8',
    u'utf_8': u'U8',
    u'utf8': u'U8',
    u'U16': u'U16',
    u'utf-16': u'U16',
    u'utf_16': u'U16',
    u'utf16': u'U16',
    u'U32': u'U32',
    u'utf-32': u'U32',
    u'utf_32': u'U32',
    u'utf32': u'U32',
}

class String(Unit):

    """ String container

    >>> String()
    ctype("string")
    >>> String(10, 'ascii')
    ctype("string[10, 'A']")
    """
    cls = MEASURE
    __slots__ = 'fixlen', 'encoding'

    def __init__(self, *args):
        if len(args) == 0:
            fixlen, encoding = None, None
        if len(args) == 1:
            if isinstance(args[0], _strtypes):
                fixlen, encoding = None, args[0]
            if isinstance(args[0], _inttypes):
                fixlen, encoding = args[0], None
        if len(args) == 2:
            fixlen, encoding = args

        encoding = encoding or 'U8'
        if isinstance(encoding, str):
            encoding = unicode(encoding)
        try:
            encoding = _canonical_string_encodings[encoding]
        except KeyError:
            raise ValueError('Unsupported string encoding %s' %
                             repr(encoding))

        self.encoding = encoding
        self.fixlen = fixlen

        # Put it in a canonical form

    def __str__(self):
        if self.fixlen is None and self.encoding == 'U8':
            return 'string'
        elif self.fixlen is not None and self.encoding == 'U8':
            return 'string[%i]' % self.fixlen
        elif self.fixlen is None and self.encoding != 'U8':
            return 'string[%s]' % repr(self.encoding).strip('u')
        else:
            return 'string[%i, %s]' % (self.fixlen,
                                       repr(self.encoding).strip('u'))

    def __repr__(self):
        s = str(self)
        return 'ctype("%s")' % s.encode('unicode_escape').decode('ascii')

    def to_numpy_dtype(self):
        """
        >>> String().to_numpy_dtype()
        dtype('O')
        >>> String(30).to_numpy_dtype()
        dtype('<U30')
        >>> String(30, 'A').to_numpy_dtype()
        dtype('S30')
        """
        if self.fixlen:
            if self.encoding == 'A':
                return np.dtype('S%d' % self.fixlen)
            else:
                return np.dtype('U%d' % self.fixlen)

        from .py2help import unicode
        # Create a dtype with metadata indicating it's
        # a string in the same style as the h5py special_dtype
        return np.dtype('O', metadata={'vlen': unicode})

class Decimal(Unit):

    """Decimal type corresponding to SQL Decimal/Numeric types.

    The first parameter passed specifies the number of digits of precision that
    the Decimal contains. If an additional parameter is given, it represents
    the scale, or number of digits of precision that are after the decimal
    point.

    The Decimal type makes no requirement of how it is to be stored in memory,
    therefore, the number of bytes needed to store a Decimal for a given
    precision will vary based on the platform where it is used.

    Examples
    --------
    >>> Decimal(18)
    Decimal(precision=18, scale=0)
    >>> Decimal(7, 4)
    Decimal(precision=7, scale=4)
    >>> Decimal(precision=11, scale=2)
    Decimal(precision=11, scale=2)
    """

    cls = MEASURE
    __slots__ = 'precision', 'scale'

    def __init__(self, precision, scale=0):
        self.precision = precision
        self.scale = scale

    def __str__(self):
        return 'decimal[precision={precision}, scale={scale}]'.format(
            precision=self.precision, scale=self.scale
        )

    def to_numpy_dtype(self):
        """Convert a decimal datashape to a NumPy dtype.

        Note that floating-point (scale > 0) precision will be lost converting
        to NumPy floats.

        Examples
        --------
        >>> Decimal(18).to_numpy_dtype()
        dtype('int64')
        >>> Decimal(7,4).to_numpy_dtype()
        dtype('float64')
        """

        if self.scale == 0:
            if self.precision <= 2:
                return np.dtype(np.int8)
            elif self.precision <= 4:
                return np.dtype(np.int16)
            elif self.precision <= 9:
                return np.dtype(np.int32)
            elif self.precision <= 18:
                return np.dtype(np.int64)
            else:
                raise TypeError(
                    'Integer Decimal precision > 18 is not NumPy-compatible')
        else:
            return np.dtype(np.float64)

class DataShape(Mono):

    """
    Composite container for datashape elements.

    Elements of a datashape like ``Fixed(3)``, ``Var()`` or ``int32`` are on,
    on their own, valid datashapes.  These elements are collected together into
    a composite ``DataShape`` to be complete.

    This class is not intended to be used directly.  Instead, use the utility
    ``dshape`` function to create datashapes from strings or datashape
    elements.

    Examples
    --------

    >>> from datashape import Fixed, int32, DataShape, dshape

    >>> DataShape(Fixed(5), int32)  # Rare to DataShape directly
    dshape("5 * int32")

    >>> dshape('5 * int32')         # Instead use the dshape function
    dshape("5 * int32")

    >>> dshape([Fixed(5), int32])   # It can even do construction from elements
    dshape("5 * int32")

    See Also
    --------
    datashape.dshape
    """
    composite = False

    def __init__(self, *parameters, **kwds):
        if len(parameters) == 1 and isinstance(parameters[0], _strtypes):
            raise TypeError("DataShape constructor for internal use.\n"
                            "Use dshape function to convert strings into "
                            "datashapes.\nTry:\n\tdshape('%s')"
                            % parameters[0])
        if len(parameters) > 0:
            self._parameters = tuple(map(_launder, parameters))
            if getattr(self._parameters[-1], 'cls', MEASURE) != MEASURE:
                raise TypeError(('Only a measure can appear on the'
                                 ' last position of a datashape, not %s') %
                                repr(self._parameters[-1]))
            for dim in self._parameters[:-1]:
                if getattr(dim, 'cls', DIMENSION) != DIMENSION:
                    raise TypeError(('Only dimensions can appear before the'
                                     ' last position of a datashape, not %s') %
                                    repr(dim))
        else:
            raise ValueError('the data shape should be constructed from 2 or'
                             ' more parameters, only got %s' % len(parameters))
        self.composite = True
        self.name = kwds.get('name')

        if self.name:
            type(type(self))._registry[self.name] = self

    def __len__(self):
        return len(self.parameters)

    def __getitem__(self, index):
        return self.parameters[index]

    def __str__(self):
        return self.name or ' * '.join(map(str, self.parameters))

    def __repr__(self):
        s = pprint(self)
        if '\n' in s:
            return 'dshape("""%s""")' % s
        else:
            return 'dshape("%s")' % s

    @property
    def shape(self):
        return self.parameters[:-1]

    @property
    def measure(self):
        return self.parameters[-1]

    def subarray(self, leading):
        """Returns a data shape object of the subarray with 'leading'
        dimensions removed.

        >>> from datashape import dshape
        >>> dshape('1 * 2 * 3 * int32').subarray(1)
        dshape("2 * 3 * int32")
        >>> dshape('1 * 2 * 3 * int32').subarray(2)
        dshape("3 * int32")
        """
        if leading >= len(self.parameters):
            raise IndexError('Not enough dimensions in data shape '
                             'to remove %d leading dimensions.' % leading)
        elif leading in [len(self.parameters) - 1, -1]:
            return DataShape(self.parameters[-1])
        else:
            return DataShape(*self.parameters[leading:])

    def __rmul__(self, other):
        if isinstance(other, _inttypes):
            other = Fixed(other)
        return DataShape(other, *self)

    @property
    def subshape(self):
        return IndexCallable(self._subshape)

    def _subshape(self, index):
        """ The DataShape of an indexed subarray

        >>> from datashape import dshape

        >>> ds = dshape('var * {name: string, amount: int32}')
        >>> print(ds.subshape[0])
        {name: string, amount: int32}

        >>> print(ds.subshape[0:3])
        3 * {name: string, amount: int32}

        >>> print(ds.subshape[0:7:2, 'amount'])
        4 * int32

        >>> print(ds.subshape[[1, 10, 15]])
        3 * {name: string, amount: int32}

        >>> ds = dshape('{x: int, y: int}')
        >>> print(ds.subshape['x'])
        int32

        >>> ds = dshape('10 * var * 10 * int32')
        >>> print(ds.subshape[0:5, 0:3, 5])
        5 * 3 * int32

        >>> ds = dshape('var * {name: string, amount: int32, id: int32}')
        >>> print(ds.subshape[:, [0, 2]])
        var * {name: string, id: int32}

        >>> ds = dshape('var * {name: string, amount: int32, id: int32}')
        >>> print(ds.subshape[:, ['name', 'id']])
        var * {name: string, id: int32}

        >>> print(ds.subshape[0, 1:])
        {amount: int32, id: int32}
        """
        from .predicates import isdimension
        if isinstance(index, _inttypes) and isdimension(self[0]):
            return self.subarray(1)
        if isinstance(self[0], Record) and isinstance(index, _strtypes):
            return self[0][index]
        if isinstance(self[0], Record) and isinstance(index, _inttypes):
            return self[0].parameters[0][index][1]
        if isinstance(self[0], Record) and isinstance(index, list):
            rec = self[0]
            # Translate strings to corresponding integers
            index = [self[0].names.index(i) if isinstance(i, _strtypes) else i
                     for i in index]
            return DataShape(Record([rec.parameters[0][i] for i in index]))
        if isinstance(self[0], Record) and isinstance(index, slice):
            rec = self[0]
            return DataShape(Record(rec.parameters[0][index]))
        if isinstance(index, list) and isdimension(self[0]):
            return len(index) * self.subarray(1)
        if isinstance(index, slice):
            if isinstance(self[0], Fixed):
                n = int(self[0])
                start = index.start or 0
                stop = index.stop or n
                if start < 0:
                    start = n + start
                if stop < 0:
                    stop = n + stop
                count = stop - start
            else:
                start = index.start or 0
                stop = index.stop
                if not stop:
                    count = -start if start < 0 else var
                if (stop is not None and start is not None and stop >= 0 and
                        start >= 0):
                    count = stop - start
                else:
                    count = var

            if count != var and index.step is not None:
                count = int(ceil(count / index.step))

            return count * self.subarray(1)
        if isinstance(index, tuple):
            if not index:
                return self
            elif index[0] is None:
                return 1 * self._subshape(index[1:])
            elif len(index) == 1:
                return self._subshape(index[0])
            else:
                ds = self.subarray(1)._subshape(index[1:])
                return (self[0] * ds)._subshape(index[0])
        raise TypeError('invalid index value %s of type %r' %
                        (index, type(index).__name__))

    def __setstate__(self, state):
        self.__init__(*state)

numpy_provides_missing = frozenset((Date, DateTime, TimeDelta))

class Option(Mono):

    """
    Measure types which may or may not hold data. Makes no
    indication of how this is implemented in memory.
    """
    __slots__ = 'ty',

    def __init__(self, ds):
        self.ty = _launder(ds)

    @property
    def shape(self):
        return self.ty.shape

    @property
    def itemsize(self):
        return self.ty.itemsize

    def __str__(self):
        return '?%s' % self.ty

    def to_numpy_dtype(self):
        if type(self.ty) in numpy_provides_missing:
            return self.ty.to_numpy_dtype()
        raise TypeError('DataShape measure %s is not NumPy-compatible' % self)

class CType(Unit):

    """
    Symbol for a sized type mapping uniquely to a native type.
    """
    cls = MEASURE
    __slots__ = 'name', '_itemsize', '_alignment'

    def __init__(self, name, itemsize, alignment):
        self.name = name
        self._itemsize = itemsize
        self._alignment = alignment
        Type.register(name, self)

    @classmethod
    def from_numpy_dtype(self, dt):
        """
        From Numpy dtype.

        >>> from datashape import CType
        >>> from numpy import dtype
        >>> CType.from_numpy_dtype(dtype('int32'))
        ctype("int32")
        >>> CType.from_numpy_dtype(dtype('i8'))
        ctype("int64")
        >>> CType.from_numpy_dtype(dtype('M8'))
        DateTime(tz=None)
        >>> CType.from_numpy_dtype(dtype('U30'))
        ctype("string[30, 'U32']")
        """
        try:
            return Type.lookup_type(dt.name)
        except KeyError:
            pass
        if np.issubdtype(dt, np.datetime64):
            unit, _ = np.datetime_data(dt)
            defaults = {'D': date_, 'Y': date_, 'M': date_, 'W': date_}
            return defaults.get(unit, datetime_)
        elif np.issubdtype(dt, np.timedelta64):
            unit, _ = np.datetime_data(dt)
            return TimeDelta(unit=unit)
        elif np.issubdtype(dt, np.unicode_):
            return String(dt.itemsize // 4, 'U32')
        elif np.issubdtype(dt, np.str_) or np.issubdtype(dt, np.bytes_):
            return String(dt.itemsize, 'ascii')
        raise NotImplementedError("NumPy datatype %s not supported" % dt)

    @property
    def itemsize(self):
        """The size of one element of this type."""
        return self._itemsize

    @property
    def alignment(self):
        """The alignment of one element of this type."""
        return self._alignment

    def to_numpy_dtype(self):
        """
        To Numpy dtype.
        """
        # TODO: Fixup the complex type to how numpy does it
        name = self.name
        return np.dtype({
            'complex[float32]': 'complex64',
            'complex[float64]': 'complex128'
        }.get(name, name))

    def __str__(self):
        return self.name

    def __repr__(self):
        s = str(self)
        return 'ctype("%s")' % s.encode('unicode_escape').decode('ascii')

class Fixed(Unit):

    """
    Fixed dimension.
    """
    cls = DIMENSION
    __slots__ = 'val',

    def __init__(self, i):
        # Use operator.index, so Python integers, numpy int scalars, etc work
        i = operator.index(i)

        if i < 0:
            raise ValueError('Fixed dimensions must be positive')

        self.val = i

    def __index__(self):
        return self.val

    def __int__(self):
        return self.val

    def __eq__(self, other):
        return (type(other) is Fixed and self.val == other.val or
                isinstance(other, _inttypes) and self.val == other)

    __hash__ = Mono.__hash__

    def __str__(self):
        return str(self.val)

class Var(Unit):

    """ Variable dimension """
    cls = DIMENSION
    __slots__ = ()

class TypeVar(Unit):

    """
    A free variable in the signature. Not user facing.
    """
    # cls could be MEASURE or DIMENSION, depending on context
    __slots__ = 'symbol',

    def __init__(self, symbol):
        if not symbol[0].isupper():
            raise ValueError(('TypeVar symbol %r does not '
                              'begin with a capital') % symbol)
        self.symbol = symbol

    def __str__(self):
        return str(self.symbol)

class Function(Mono):
    """Function signature type
    """
    @property
    def restype(self):
        return self.parameters[-1]

    @property
    def argtypes(self):
        return self.parameters[:-1]

    def __str__(self):
        return '(%s) -> %s' % (
            ', '.join(map(str, self.argtypes)), self.restype
        )

class Map(Mono):
    __slots__ = 'key', 'value'

    def __init__(self, key, value):
        self.key = _launder(key)
        self.value = _launder(value)

    def __str__(self):
        return '%s[%s, %s]' % (type(self).__name__.lower(),
                               self.key,
                               self.value)

    def to_numpy_dtype(self):
        return to_numpy_dtype(self)

def _launder(x):
    """ Clean up types prior to insertion into DataShape

    >>> from datashape import dshape
    >>> _launder(5)         # convert ints to Fixed
    Fixed(val=5)
    >>> _launder('int32')   # parse strings
    ctype("int32")
    >>> _launder(dshape('int32'))
    ctype("int32")
    >>> _launder(Fixed(5))  # No-op on valid parameters
    Fixed(val=5)
    """
    if isinstance(x, _inttypes):
        x = Fixed(x)
    if isinstance(x, _strtypes):
        x = datashape.dshape(x)
    if isinstance(x, DataShape) and len(x) == 1:
        return x[0]
    if isinstance(x, Mono):
        return x

    raise TypeError("Received unsupported type {}".format(x))

class CollectionPrinter(object):

    def __repr__(self):
        s = str(self)
        strs = ('"""%s"""' if '\n' in s else '"%s"') % s
        return 'dshape(%s)' % strs

class RecordMeta(Type):
    @staticmethod
    def _unpack_slice(s, idx):
        if not isinstance(s, slice):
            raise TypeError(
                'invalid field specification at position %d.\n'
                'fields must be formatted like: {name}:{type}' % idx,
            )

        name, type_ = packed = s.start, s.stop
        if name is None:
            raise TypeError('missing field name at position %d' % idx)
        if not isinstance(name, basestring):
            raise TypeError(
                "field name at position %d ('%s') was not a string" % (
                    idx, name,
                ),
            )
        if type_ is None and s.step is None:
            raise TypeError(
                "missing type for field '%s' at position %d" % (name, idx))
        if s.step is not None:
            raise TypeError(
                "unexpected slice step for field '%s' at position %d.\n"
                "hint: you might have a second ':'" % (name, idx),
            )

        return packed

    def __getitem__(self, types):
        if not isinstance(types, tuple):
            types = types,

        return self(list(map(self._unpack_slice, types, range(len(types)))))

if sys.version_info[:2] == (2, 7):
    def unify_name_types(names):
        """ Construct the names of fields in a Record datashape to have a single
        string type

        Parameters
        ----------
        names : list[str|unicode]
            List of field names for a Record datashape

        Returns
        -------
        list[str|unicode]
            A list of strings of a *single* type: either str (Python 2 and 3)
            or unicode (Python 2 only)

        Examples
        --------
        >>> unify_name_types([u'a', 'b']) == list(u'ab')
        True
        >>> unify_name_types(list('ab')) == list('ab')
        True
        """
        types = set(map(type, names))
        if 0 <= len(types) <= 1:
            return names
        return list(map(unicode if unicode in types else str, names))
else:
    unify_name_types = lambda x: x

class Record(with_metaclass(RecordMeta, CollectionPrinter, Mono)):
    """
    A composite data structure of ordered fields mapped to types.

    Properties
    ----------

    fields: tuple of (name, type) pairs
        The only stored data, also the input to ``__init__``
    dict: dict
        A dictionary view of ``fields``
    names: list of strings
        A list of the names
    types: list of datashapes
        A list of the datashapes

    Example
    -------

    >>> Record([['id', 'int'], ['name', 'string'], ['amount', 'real']])
    dshape("{id: int32, name: string, amount: float64}")
    """
    cls = MEASURE

    def __init__(self, fields):
        """
        Parameters
        ----------
        fields : list/OrderedDict of (name, type) entries
            The fields which make up the record.
        """
        if isinstance(fields, OrderedDict):
            fields = fields.items()
        fields = list(fields)
        names = unify_name_types([
            str(name) if not isinstance(name, _strtypes) else name
            for name, _ in fields
        ])
        types = [_launder(v) for _, v in fields]

        if len(set(names)) != len(names):
            for name in set(names):
                names.remove(name)
            raise ValueError("duplicate field names found: %s" % names)

        self._parameters = tuple(zip(names, types)),

    @property
    def fields(self):
        return self._parameters[0]

    @property
    def dict(self):
        return dict(self.fields)

    @property
    def names(self):
        return [n for n, t in self.fields]

    @property
    def types(self):
        return [t for n, t in self.fields]

    def to_numpy_dtype(self):
        """
        To Numpy record dtype.
        """
        return np.dtype([(str(name), to_numpy_dtype(typ))
                         for name, typ in self.fields])

    def __getitem__(self, key):
        return self.dict[key]

    def __str__(self):
        return pprint(self)

R = Record  # Alias for record literals

def _format_categories(cats, n=10):
    return '[%s%s]' % (
        ', '.join(map(repr, cats[:n])),
        ', ...' if len(cats) > n else ''
    )

class Categorical(Mono):
    """Unordered categorical type.
    """

    __slots__ = 'categories', 'type', 'ordered'
    cls = MEASURE

    def __init__(self, categories, type=None, ordered=False):
        self.categories = tuple(categories)
        self.type = (type or datashape.discover(self.categories)).measure
        self.ordered = ordered

    def __str__(self):
        return '%s[%s, type=%s, ordered=%s]' % (
            type(self).__name__.lower(),
            _format_categories(self.categories),
            self.type,
            self.ordered
        )

    def __repr__(self):
        return '%s(categories=%s, type=%r, ordered=%s)' % (
            type(self).__name__,
            _format_categories(self.categories),
            self.type,
            self.ordered
        )

class Tuple(CollectionPrinter, Mono):

    """
    A product type.
    """
    __slots__ = 'dshapes',
    cls = MEASURE

    def __init__(self, dshapes):
        """
        Parameters
        ----------
        dshapes : list of dshapes
            The datashapes which make up the tuple.
        """
        dshapes = [DataShape(ds) if not isinstance(ds, DataShape) else ds
                   for ds in dshapes]
        self.dshapes = tuple(dshapes)

    def __str__(self):
        return '(%s)' % ', '.join(map(str, self.dshapes))

    def to_numpy_dtype(self):
        """
        To Numpy record dtype.
        """
        return np.dtype([('f%d' % i, to_numpy_dtype(typ))
                         for i, typ in enumerate(self.parameters[0])])

class JSON(Mono):

    """ JSON measure """
    cls = MEASURE
    __slots__ = ()

    def __str__(self):
        return 'json'

bool_ = CType('bool', 1, 1)
char = CType('char', 1, 1)

int8 = CType('int8', 1, 1)
int16 = CType('int16', 2, ctypes.alignment(ctypes.c_int16))
int32 = CType('int32', 4, ctypes.alignment(ctypes.c_int32))
int64 = CType('int64', 8, ctypes.alignment(ctypes.c_int64))

# int is an alias for int32
int_ = int32
Type.register('int', int_)

uint8 = CType('uint8', 1, 1)
uint16 = CType('uint16', 2, ctypes.alignment(ctypes.c_uint16))
uint32 = CType('uint32', 4, ctypes.alignment(ctypes.c_uint32))
uint64 = CType('uint64', 8, ctypes.alignment(ctypes.c_uint64))

float16 = CType('float16', 2, ctypes.alignment(ctypes.c_uint16))
float32 = CType('float32', 4, ctypes.alignment(ctypes.c_float))
float64 = CType('float64', 8, ctypes.alignment(ctypes.c_double))
# float128 = CType('float128', 16)

# real is an alias for float64
real = float64
Type.register('real', real)

complex_float32 = CType('complex[float32]', 8,
                        ctypes.alignment(ctypes.c_float))
complex_float64 = CType('complex[float64]', 16,
                        ctypes.alignment(ctypes.c_double))
Type.register('complex64', complex_float32)
complex64 = complex_float32

Type.register('complex128', complex_float64)
complex128 = complex_float64
# complex256 = CType('complex256', 32)

# complex is an alias for complex[float64]
complex_ = complex_float64

date_ = Date()
time_ = Time()
datetime_ = DateTime()
timedelta_ = TimeDelta()
Type.register('date', date_)
Type.register('time', time_)
Type.register('datetime', datetime_)
Type.register('timedelta', timedelta_)

null = Null()
Type.register('null', null)

c_byte = int8
c_short = int16
c_int = int32
c_longlong = int64

c_ubyte = uint8
c_ushort = uint16
c_ulonglong = uint64

if ctypes.sizeof(ctypes.c_long) == 4:
    c_long = int32
    c_ulong = uint32
else:
    c_long = int64
    c_ulong = uint64

if ctypes.sizeof(ctypes.c_void_p) == 4:
    intptr = c_ssize_t = int32
    uintptr = c_size_t = uint32
else:
    intptr = c_ssize_t = int64
    uintptr = c_size_t = uint64
Type.register('intptr', intptr)
Type.register('uintptr', uintptr)

c_half = float16
c_float = float32
c_double = float64

# TODO: Deal with the longdouble == one of float64/float80/float96/float128
# situation

# c_longdouble = float128

half = float16
single = float32
double = float64

void = CType('void', 0, 1)
object_ = pyobj = CType('object',
                        ctypes.sizeof(ctypes.py_object),
                        ctypes.alignment(ctypes.py_object))

na = Null
NullRecord = Record(())
bytes_ = Bytes()

string = String()
json = JSON()

Type.register('float', c_float)
Type.register('double', c_double)

Type.register('bytes', bytes_)

Type.register('string', String())

var = Var()

def to_numpy_dtype(ds):
    """ Throw away the shape information and just return the
    measure as NumPy dtype instance."""
    if isinstance(ds.measure, datashape.coretypes.Map):
        ds = ds.measure.key
    return to_numpy(ds.measure)[1]

def to_numpy(ds):
    """
    Downcast a datashape object into a Numpy (shape, dtype) tuple if
    possible.

    >>> from datashape import dshape, to_numpy
    >>> to_numpy(dshape('5 * 5 * int32'))
    ((5, 5), dtype('int32'))
    >>> to_numpy(dshape('10 * string[30]'))
    ((10,), dtype('<U30'))
    >>> to_numpy(dshape('N * int32'))
    ((-1,), dtype('int32'))
    """
    shape = []
    if isinstance(ds, DataShape):
        # The datashape dimensions
        for dim in ds[:-1]:
            if isinstance(dim, Fixed):
                shape.append(int(dim))
            elif isinstance(dim, TypeVar):
                shape.append(-1)
            else:
                raise TypeError('DataShape dimension %s is not '
                                'NumPy-compatible' % dim)

        # The datashape measure
        msr = ds[-1]
    else:
        msr = ds

    return tuple(shape), msr.to_numpy_dtype()

def from_numpy(shape, dt):
    """
    Upcast a (shape, dtype) tuple if possible.

    >>> from datashape import from_numpy
    >>> from numpy import dtype
    >>> from_numpy((5, 5), dtype('int32'))
    dshape("5 * 5 * int32")

    >>> from_numpy((10,), dtype('S10'))
    dshape("10 * string[10, 'A']")
    """
    dtype = np.dtype(dt)

    if dtype.kind == 'S':
        measure = String(dtype.itemsize, 'A')
    elif dtype.kind == 'U':
        measure = String(dtype.itemsize // 4, 'U32')
    elif dtype.fields:
        fields = [(name, dtype.fields[name]) for name in dtype.names]
        rec = [(name, from_numpy(t.shape, t.base))  # recurse into nested dtype
               for name, (t, _) in fields]  # _ is the byte offset: ignore it
        measure = Record(rec)
    else:
        measure = CType.from_numpy_dtype(dtype)

    if not shape:
        return measure
    return DataShape(*tuple(map(Fixed, shape)) + (measure,))

def print_unicode_string(s):
    try:
        return s.decode('unicode_escape').encode('ascii')
    except AttributeError:
        return s

def pprint(ds, width=80):
    ''' Pretty print a datashape

    >>> from datashape import dshape, pprint
    >>> print(pprint(dshape('5 * 3 * int32')))
    5 * 3 * int32

    >>> ds = dshape("""
    ... 5000000000 * {
    ...     a: (int, float32, real, string, datetime),
    ...     b: {c: 5 * int, d: var * 100 * float32}
    ... }""")
    >>> print(pprint(ds))
    5000000000 * {
      a: (int32, float32, float64, string, datetime),
      b: {c: 5 * int32, d: var * 100 * float32}
      }

    Record measures print like full datashapes
    >>> print(pprint(ds.measure, width=30))
    {
      a: (
        int32,
        float32,
        float64,
        string,
        datetime
        ),
      b: {
        c: 5 * int32,
        d: var * 100 * float32
        }
      }

    Control width of the result
    >>> print(pprint(ds, width=30))
    5000000000 * {
      a: (
        int32,
        float32,
        float64,
        string,
        datetime
        ),
      b: {
        c: 5 * int32,
        d: var * 100 * float32
        }
      }
    >>>
    '''
    result = ''

    if isinstance(ds, DataShape):
        if ds.shape:
            result += ' * '.join(map(str, ds.shape))
            result += ' * '
        ds = ds[-1]

    if isinstance(ds, Record):
        pairs = ['%s: %s' % (name if isidentifier(name) else
                             repr(print_unicode_string(name)),
                             pprint(typ, width - len(result) - len(name)))
                 for name, typ in zip(ds.names, ds.types)]
        short = '{%s}' % ', '.join(pairs)

        if len(result + short) < width:
            return result + short
        else:
            long = '{\n%s\n}' % ',\n'.join(pairs)
            return result + long.replace('\n', '\n  ')

    elif isinstance(ds, Tuple):
        typs = [pprint(typ, width-len(result))
                for typ in ds.dshapes]
        short = '(%s)' % ', '.join(typs)
        if len(result + short) < width:
            return result + short
        else:
            long = '(\n%s\n)' % ',\n'.join(typs)
            return result + long.replace('\n', '\n  ')
    else:
        result += str(ds)
    return result

redpajama_set_name: RedPajamaGithub


text:
Q: Select a date in my time zone when database is in UTC with PostgreSQL I want to select a day in my timezone for example:
from the 2021-09-09 00:00 +02 to 2021-09-10 00:00 +02. But the following code:
set timezone TO 'Europe/Berlin';
SELECT TIMESTAMP::timestamptz,sensor_id,value
FROM my_table
WHERE sensor_id IN (1,2,3)
AND TIMESTAMP > '2021-09-09' AND TIMESTAMP < '2021-09-10'
ORDER BY TIMESTAMP

gives me the right values but with wrong timezone for example first rows are:
timestamp,sensor_id,value
2021-09-09 02:00 +02,1,21
2021-09-09 02:00 +02,2,34
2021-09-09 02:00 +02,3,54

but should be 2021-09-09 00:00 +02 or 2021-09-08 22:00 +00
The problem is bigger when the difference with utc changes between winter and summer
Anybony can help me?
PostgreSQL v.12

A: SELECT TIMESTAMP::timestamptz AT TIME ZONE 'CETDST',sensor_id,value
FROM my_table
WHERE sensor_id IN (1,2,3)
AND TIMESTAMP AT TIME ZONE 'CETDST' > '2021-09-09'
AND TIMESTAMP AT TIME ZONE 'CETDST' < '2021-09-10'
ORDER BY TIMESTAMP

redpajama_set_name: RedPajamaStackExchange


text:
"Voting is the opium of the masses in this country. Every four years you deaden the pain."
moonspinner555 January 2017
A personal triumph for co-writer-producer-director-star Warren Beatty, who won the Oscar for his direction and gives a cautious, interesting performance as early-1900s American journalist John Reed, who shared a tumultuous courtship and marriage to Louise Bryant (Diane Keaton), a socialite and self-described writer. Reed, a radical political activist, became intrigued with the Communist teachings of Russia and, with Bryant, defended the Bolsheviks and opposed American intervention. Their acquaintances, a community of activists and artists, included anarchist Emma Goldman (masterfully played by Oscar-winner Maureen Stapleton) and playwright Eugene O'Neill (Jack Nicholson), who also had a passionate affair with Bryant (one "guest witness" speculates the Reed-Bryant marriage was actually a menage a trois that included O'Neill). Beatty's film is too long at 195 minutes--and is far better in its early stages, so momentum tends to decrease as the story progresses--however, its an actors' paradise and everyone brings something special to the fore. Keaton's chattering sometimes feels anachronistic ("yeah, yeah...uh-huh, uh-huh"), but she works the camera mercilessly with her big, enchanting smile (to knock us dead) and sad, questioning stare. Keaton manages to translate her innermost thoughts into expressions, and her penetrating scenes with Nicholson are quietly-charged and fascinating, although her romance with Beatty's Reed feels somewhat muffled. Beatty, content to let his co-stars shine, has chosen to remain reserved; some may applaud the performance as successfully subtle, yet he might have shown us a bit more of his own personality (it would help in a three-hour-plus movie such as this). The epic-sized "Reds" is a strange melodrama, at times, and an overachiever, but with surprising humor in the mix and the fire of determination at its core. **1/2 from ****
8 out of 8 found this helpful. Was this review helpful? Sign in to vote.
You Forget..
tedg16 November 2008
I am old enough to have lived through (probably) three different Americas. These are radically different worlds. It isn't just the mood, styles or state of the economy; its the adoption of a whole cosmology. Religions change under our feet. Family, love, belonging. These things are malleable yet largely beyond our control and we forget what "things were like." Memory always is constructed in terms of the present world.
So projects like this are necessary. We cannot know who we are unless we remind ourselves who we were.
The ordinary fold here is a romance, folded into grand political actions. Here they are a bit more cerebral than usual, but never getting past the notion of simple justice.
The more unusual and complex fold is that we see a story based on real events and people. Interspersed with that story are interviews of people who were personally involved in the story. These are remarkable, the way they are captured and the way they are edited to overlap with and annotate the story. But much more engaging is that these are enticing people, many with minds and phases that invite us into their faces — made warmer and more open by Beatty's camera. I compare this to the "Up" serious and the contrast is astonishing. True, here we want to be informed about the lives of others, and the "Up" goals pretend that the people randomly selected decades ago are remotely worth knowing.
But these folks are. We want more, simply based on their implicit invitation, and we carry ourselves into the narrative more forcefully, sort of like the characters do. This is folding doing its job and doing it well. They remember. I remember, and therefore am.
Ted's Evaluation -- 3 of 3: Worth watching.
34 out of 46 found this helpful. Was this review helpful? Sign in to vote.
Great movie
green4tom16 June 2004
This movie was great, and I hope it comes out on DVD real soon. Beatty became Reed in more than one sense--not only did he act the part, but he directed the movie in a way reminiscent of the kind of "new journalistic" style that Reed and his fellow MASSES writers pioneered, mixing the drama with interviews of people who knew JR, Louise, etc.
The film also sort of puts forward the question, "What if, instead of running back to Russia (to die of kidney failure and mistreatment by the CP), Jack Reed had stayed in this country to build the CP? Would it have turned out to become Stalinist?" According to Howe and Coser, who wrote a good book on THE AMERICAN COMMUNIST PARTY, much like Rosa Luxemburg and Karl Liebknecht in Germany, Reed was the ONLY leader who was independent, who had some real backbone.
The best part of the movie is when Emma Goldmann, played by Maureen Stapleton, tells Jack that "it doesn't work" (i.e. statist, bureaucratic socialism that the Bolsheviks were instituting as a grossly mistaken response to the economic crisis and Allied invasion of Russia after the Revolution). And then his rebellion against the lying propaganda of Zinoviev. Kind of hits me right now that Jerzy Kosinski should play Zinoviev--didn't he commit suicide when he was exposed as a plagiarist? Where is the line between art and reality, politics and life?
Of course I loved the romantic reality between Beatty, Bryant, and Nicholson (Reed, Bryant, and Eugene O'Neill). And the cynicism that Reed expresses about the Democrats and Wilson is certainly apropos today.
Every movie lover should see this film!
Princess-Alice26 June 2001
Warren Beatty's Reds follows only Gone With The Wind in my list of favourite films. This movie is both a love story, and a documentary. It educates the viewer not just on John Reed and his comrades, but on WWI era society in general.
This brilliant script, (which, like the writings of Jack Reed expresses his political feelings with the same poetic eloquence as his love poems to his wife Louise), is interspersed with commentary from Jack's contemporaries, who tell the history from their own unique perspectives. As the truth of what was going on in that community is such an illusive thing, the only way to tell this story accurately was to show the often completely opposite view points of what was going on as told by the people for whom this history is a first hand memory.
The acting in Reds is breath taking. Every member of this, extremely large, cast committed fully to their characters. One feels a true connection to even those characters who lurked in the background with only occasional lines. The most notable performances were by Beatty himself, (who's embodiment of Jack Reed was incredible), Diane Keaton, (who portrayed all the facets of Louise's personality with stunning realism), Jack Nickelson, (who delivers O'Neil's quick witted dialogue with an almost frightening cynicism), and Maureen Stapelton, (who conveyed an amazing strength as Emma Goldman). While these actors were the most prominently featured, all the actors delivered noteworthy performances as far as I'm concerned.
The political history covered in this movie is nothing if not vast. This is proof of Beatty's most impressive knowledge of history. This is a film I would recommend be shown in schools, as one the most in depth study of American communism on screen to date.
Reds is truly an inspiration, and should be seen by every actor, director, writer, liberal, film maker, history buff & movie lover! You will not be disappointed!
A Monumental Achievement in Epic Film-Making
tfrizzell29 July 2000
"Reds" is a 200-minute epic masterpiece which deals with left-wing American journalist John Reed (Warren Beatty in an Oscar-nominated performance) and his coverage of the Russian Revolution of the 1910s. Beatty's passion is what carries this ambitious film, which could have easily been a multi-million dollar disaster. His Oscar-winning direction, screenplay, and overall performance carry the film as far as it can possibly go. The top-flight performances by Diane Keaton, Jack Nicholson (both Oscar-nominated), and Maureen Stapleton (Oscar-winning) all add great depth to the performance. Paul Sorvino, Edward Herrmann, and Gene Hackman also make lasting impressions in supporting roles. Overall a great achievement all the way around. 5 stars out of 5.
A great companion piece to 1965's 'Doctor Zhivago'.
WalterFrith4 March 1999
Warren Beatty's 'Reds' is a terrific film that is not only great story telling in the conventional Hollywood way but also has an original style of narration told in many ways from the point of view of witnesses to the real story who lived during the days the film is centred around.
The film is especially significant to view since the iron curtain in Russia has come down and 'Reds' is a movie that never looks dated and stresses the fact that morals at the early part of the 20th century were about the same as they are now. It's just that no one discussed it back then and it emphasizes that times change but people don't.
With top notch performances from the entire cast, it is one of the few films to be nominated for an Oscar in all four acting categories and was victorious in the Best Supporting Actress category for Maureen Stapleton although the film's best performance comes from Diane Keaton who should have won her second Oscar.
To date, Beatty is the only film maker to be Oscar nominated for Best Director, Actor, Screenwriter and Producer twice for the same film. The other time was for 1978's 'Heaven Can Wait'.
Political insight!!
will_thehighlander3 September 2002
Reds, a succinct, controversial title totally typical of a major directorial outing by Warren Beatty. We always knew that Beatty was on the left, but a film glamourising a known Communist who defected to the USSR and is buried within the Kremlin. How the studios let him make it is a mystery to me, but I suppose that the name Warren Beatty was enough.
The film is long, and not for the light-hearted. It covers the broad canvas of early 20th Century American socialism. Concentrating first on Reeds efforts to form an American Socialist party, before moving to Russia; Beatty plays Jack Reed, the playboy writer, journalist and socialist. He opposes the war after initially supporting Wilson at the Democratic convention. After the Russian Revolution he becomes enamoured with the newly founded Soviet Union, as does his wife and sparring partner Louise Bryant, marvellously played by Diane Keaton who is excellent as the proto-feminist Bryant. Self-assured and very sexy, and her tragic love triangle between her, Reed and Jack Nicholson's character is brilliant. A number of other actors also crop up, including Paul Sorvino and M. Emmet Walsh.
One of the most important films of its generation, and every movie fan should make this compulsory viewing. Any aspiring left-wing intellectual should also make this compulsory viewing - there were Communists and Socialists in America, and one of them is even buried in the Kremlin. The USSR may be reviled these days, but you cannot deny the hope and utopianism that swept the world in those first few years after the 1917 Revolution. Beatty brings all this marvellously to the screen in Reds.
80 out of 134 found this helpful. Was this review helpful? Sign in to vote.
A maverick magnum opus with a political theme -- rare in American movies
Chris Knipp3 October 2006
Warren Beatty's magnum opus Reds was presented as a revival film official selection of the New York Film Festival 2006 to celebrate the twenty-fifth anniversary of its original appearance.
Reds's greatest virtue may be that it's grand, without being pompous, film-making. It's a film that takes some pride in being big and turbulent and unruly. It's important, but it's not tidy. It's in part certainly very much about ideology, but it avoids sharp, well-honed edges or large hard-etched "points." John Reed (played by the film's impresario, its sole producer, director, co-author, and star, Warren Beatty) was a man who happened to be able to write a first-hand account of the Bolshevik revolution, a long-time bestseller called Ten Days That Shook the World. At that time early in the twentieth century in America Reed arguably was a central figure, if only in the sense that during his time in Greenwich Village he managed to be (as he wanted to be) consistently at the center of things American political and cultural – when he wasn't in Russia (which was pretty central then too). Roger Ebert thinks the movie "never succeeds in convincing us that the feuds between the American socialist parties were much more than personality conflict and ego-bruisings" (that may depend on how hard we need to be convinced to begin with), but we do care about Reds (Ebert thinks) as "a traditional Hollywood romantic epic, a love story written on the canvas of history, as they used to say in the ads…it is the thinking man's Doctor Zhivago, told from the other side, of course." What about the choice of Warren Beatty and Diane Keaton as the lovers? Initially that may seem an odd and chemistry-poor decision. (I'm not sure I overcome that impression.) But arguably the film takes long enough with each of its main characters to make them into rounded people, complex enough to be attractive to others and to each other. Beatty uses the romance to hold the story together, and in doing so, he follows a conventional enough scheme. Reds stands out from other American mainstream products – and for all its maverick central force, it remains that – in its attempt to deal seriously with complex socio-political events during a turbulent period, and to approach them in an open-minded way. Beatty weaves other significant characters into the fabric of his drama, notably the leftist activist Emma Goldman (Maureen Stapleton, who got the Oscar for Best Supporting Actress) and the radical editor Max Eastman (Edward Herrmann), who are members of the same political-intellectual salon into which he brings Louise, as is the playwright Eugene O'Neill (Jack Nicholson).
Beatty's filmic recreation of John Reed is good in not being too serious or too idealized: in having a silly side Beatty's Reed perhaps has something of himself. Reed's lover Louise Bryant (Keaton), though originally a bourgeois lady from Portland, is similarly rounded; she's led by her relationship to Reed to develop other facets and strengths, and further enlarged as a personality through the way the film depicts her long affair with the alcoholic O'Neill, played by a toned-down but emotionally potent Nicholson. His discontent and negative energy are disturbing. Personalities anchor the film; but in some of the political debates and adventures one loses track and forgets why Reed is somewhere in Russia. He is at the center of things. But why he is where he is otherwise at certain moments is uncertain. In its ambition to keep juggling the many balls of major personalities and major political currents and historical events, Reds loses some of its narrative clarity and momentum over time. Complex political and historical currents are tracked, but the emotional trajectory loses its momentum. Nonetheless the film develops sweep in its length of three and a quarter hours. One walks out convinced that the material was complex enough to be worthy of such length, even if Beatty and his co-writer Trevor Griffiths could not whip it all into shape.
Whether it's all worth it on the stage of international cinema or not, this is a film of historical interest as a great independent project, begun logically in the Seventies, but completed right in the middle of Hollywood by an American intelligent and engaged enough to be star, director, writer, and producer, to raise $35 million to do it, and to make more or less the movie he wanted to make – right in the middle, so to speak, of a wave of conservatism and yuppiedom, in the early Eighties, when people were thinking about making money and making it, when Ronald Reagon was President of the United States. What more appropriate time to reexamine this achievement than in the middle of the second term of George Bush II? No doubt Beatty took on this story because he was interested in a time in America when it was rife with left-wing politics. But he is realistic, and he made a Hollywood movie, with big stars and romance. And that's what it is and remains. But one can't imagine anybody else making it, and that's what makes it worth revisiting. Warren Beatty is an admirable maverick in the clone-heavy world of Southern California media-moguldom. He's a real person. And this is his great performance as a person and as an artist. I first saw it with a group of real communists. "We're "reds," they said as we walked out. The theater staff looked impressed. I was bowled over by their pride. Not everyone watches this film as a "traditional Hollywood romantic epic." It would never have been made if that were all it was. Its grandeur and ambition are still moving and it must not be forgotten. For a more pungent treatment of a political and social theme starring Beatty, consider Hal Ashby's 1975 Shampoo.
Great piece of political discussion and drama
Quinoa198427 June 2000
Warren Beatty makes himself the only director to get Oscar nominations in Best Producer (picture), director, actor and writer twice (Heaven Can Wait is the other one), and he won his only Oscar (besides his honorary Thalberg award in 2000) for direction here. And it is well deserved. Mainly because this is the best film about communism and other political issues ever made.
Here, Beatty portrays journalist and idealist John Reed to maximum potential. He also comes of great with Diane Keaton as his love. Long, yet immensly entertaining and interesting, which was one of the few political films (besides maybe South Park) that got me thinking about communism. By the way, this film also won best conematography (Vittoro Storatto) and Best Supporting Actress (Maureen Stapleton as Emma Goldman), though I think it should've also won Oscars for Nicholson and Beatty. One of the better films (top 20) of the decade. A+
"Reds"- A Love Story told inside period politics at the height of the Russian Revolution
rcj536524 October 2006
Bolshevik leader V.I. Lenin once wrote, "The capitalists will sell us the rope with which we will hang them."
Lenin's quote came to mind when I was watching one of the most spellbinding movies to come along in years,and not since David Lean's brilliant 1965 epic classic "Doctor Zhivago" hasn't been a movie in recent memory that has come close. That motion picture is "Reds",released in 1981 by Paramount Pictures. The film was Warren Beatty's peeve project which he served not only as it star,but also the co-writer and direction. Director Warren Beatty's epic love story about American writers John Reed and Louise Bryant,set amid of the turbulence of American politics in the 1910's World War I and the Russian revolution that set this movie into plain focus. The movie itself is astounding to behold and is a tragic love story between the writers John Reed(Warren Beatty),and Louise Bryant(Diane Keaton). But it creatively used artsy,radical Greenwich Village in the 1910's-and such as real-life characters as playwright Eugene O'Neill(Jack Nicholson),and anarchist activist Emma Goldman(Maureen Stapleton)-as well as the drama of the Russian Revolution and the subsequent civil war as the principal landscapes in which their relationship plays out.
Director Beatty also made creative use of on-camera "testimony" by the likes of novelists Henry Miller and Rebecca West,Republican politician Hamilton Fish,comic George Jessel and civil libertarian Roger Baldwin. These senior citizens recall,with varying degrees of historical accuracy,Reed,Bryant and the times in which they lived. "Reds" shows convincingly that many of the contemporary issues in politics and culture have their antecendents in the first debates of the 20th century. Debates over birth control and abortion,marriage and commitment,public life versus private life,revolution versus reform are given full expression from varying viewpoints throughout the lengthy film(which runs over three hours). To Beatty's credit,his film captures the excitement the Bolshevik revolution stirred,both inside and outside Russia while revealing how the Bolshevik leadership quickly began to suppressing dissent within the revolutionary ranks on the way to becoming a dictatorship with a country that is in constant turmoil. Beatty's efforts certainly paid off artistically,bringing him prestige to him and Paramount making "Reds" a huge box office success for the studio when it premiered in theatres around Christmas of 1981.
"Reds" became one of the top highest grossing pictures of that year,and it paid off in high standards too. "Reds",which received 12 Academy Award nominations including Best Picture,lost an upset to Hugh Hudson's "Chariots Of Fire" in the Best Picture category. However it won three Oscars for Best Director(Warren Beatty),Best Supporting Actress(Maureen Stapleton),and Best Cimematopgraphy(Vittorio Storaro). Eventually,"Reds" made more than $40 million at the domestic box office,and once international figures were added in,it became one of the top grossing films of the 1980's. A feat Warren Beatty is still proud of to this day.
This is a film treat it as such....
jmb32227 February 2004
This is an interesting film, all the more so because it is meant to tell a true story (insofar as any film of real events is true!)
I suppose you'll either like it or loathe it. If you like it, good; it isn't a bad film, but a bit of an idea of European history will help you.
If you you fall into the latter category loathe it because you think it's a bad film not because of the stupid bigotry shown in some of the other reviews here which seem to be so hung up on the USA and Mom and apple pie that they see "Commies" in even thinking about the event of the early 20th century!
After seeing it it made me interested enough to find out about John Reed. You might not like what he thought, you might not like Warren Beatty and what he thinks but for heaven's sake don't rubbish this film simply because it's about a political system you may not like, or have been indoctrinated not to like!
It's not brilliant but neither is it a "love poem to communism".
Coxer9921 April 1999
An engrossing film about John Reed's love affair with Louise Bryant and his struggles in the midst of the Russian Revolution. There are great performances from Beatty, Keaton, Nicholson (excellent as Eugene O'Neill) and Stapelton in her Oscar winning performance as Emma Goldman. Beatty's precision and timing in the use of his camera in this picture is a superb achievement. There is a touch of David Lean in director Beatty in this film. The color, the editing, the sound. All of those important filmic elements are at play here in great form. Beatty won the Best Director Oscar, but lost the Best Picture award to Chariots of Fire.
Pretentious, long, boring
Indy-117 December 2009
Warning: Spoilers
How this was nominated for anything completely escapes me. This movie signifies everything wrong with the 70's style of movie making- letting the director (who happens to be the lead actor) do pretty much anything he wants- scenes that ramble on and on in an effort to be "realistic- trying to cram way too much into an already overlong film.
At no point in the film did I feel like the characters were not "acting". Every set piece felt like another staged scene forced upon my already dulled and bored senses. Good old Jack does his best, but he wasn't in the movie long enough to save it from disaster. Way to similar in style and result to "Heaven's Gate".
Maybe I got my expectations up from all the positive reviews I've read over the years. They were wrong, though. One more thing- didn't one of those Russian leaders look and sound just like Eugene Levy?
Stupefyingly Boring And Long-Winded
sddavis6325 August 2008
All those Oscar nominations? And three wins? You have to be kidding! I'll grant that the cast is a good one, headed up by Warren Beatty and Diane Keaton, with a smaller part for Jack Nicholson, supported by lesser known but very talented actors like Maureen Stapleton, Paul Sorvino, Dolph Sweet and Ian Wolfe among others, but even a good cast can't turn a complete snoozer into an Academy Award winner, so I'm just left wondering what happened with this one.
Essentially the movie tells the story of left-wing American journalist Jack Reed (Beatty), whose journey to Russia in 1917 to report on the Revolution there made him a committed Communist. Frankly, the first half of the movie is filled with far too much of two things: i) interviews with the "talking heads" - identified in the credits as "witnesses" who I guess had known Reed and his love interest Louise Bryant (Keaton), and ii) interminable portrayals of the tempestuous relationship between the two. The title of the movie suggests that the focus of the movie is on the leftist movement, but at times this comes close to being little more than a typical Hollywood romance. The second half of the movie, set mostly in Russia, finally downplays those two problems. There's a depiction of the battle for recognition from the Comintern (Communist International) by two competing U.S. Communist Parties, and we see Reed drafted as a propagandist by the Bolshevik authorities in Moscow.
The movie seems to avoid taking a hard position either for or against communism. Its weaknesses and failures are clearly pointed out, although overall I'd say the "feel" of the movie was favourable to the reds. Frankly, though, my real reaction to this film was to be bored almost to tears virtually from the first moment, when began several minutes of the talking heads - well - talking. The movie really lost me then, and it never managed to get me back - not even close. My gut tells me I can't do anything but a 1/10.
Boring, pretentious, preachy
damonby17 April 2008
I walked out of this movie when it first came out. It was boring, pretentious, and preachy when it came out and, on a reviewing, it was still the same.
A synopsis of the plot: The two main characters, Warren Beatty and Diane Keaton, first have a loud preachy argument, they then have makeup sex, then something important in history happens. Repeat as needed until more than three hours pass.
One of the ten best films? Really? Are Porkys I, II and III also in the top ten?
This film is loaded with self absorbed, angry, yelling characters. No cast managed to portray as many unlikeable characters this effectively until the advent of the Sopranos. At least in the Sopranos case it was a conscious decision.
Lenin's smiling...
DoctorMartin19 July 2002
... at the spectacle of one of Hollywood's highest paid stars making a movie about the only American buried in the Kremlin wall.... at the irony of literally millions of evil capitalist dollars being sucked from the coffers of an American studio to fund this love poem to Communism.... and at the useful idiots who swooned over this long, dull, golden turkey and nominated it for an Oscar. Fortunately, the American public was smarter; this crap lost tens of millions, or basically, a dollar for every victim of Soviet genocide.
A maudlin valentine to Leninist fascism
seamus3914 June 2005
Workers of the World Unite! All you have to lose is your cookies if you sit through this overly long preach-fest dedicated to the romantic joy of coffee-house revolutionaries made good. Frustrated that Marx had ruined all the fun by stating that Russia would be the LAST country in the world to attain Communism (due to its economic underdevelopment), Lenin, Trotsky and (American)hack poet-turned-revolutionary John Reed decide to skip all the intermediate stages and jump right to Utopia. How? Through a conspiratorial dictatorship that enslaved Russia in the name of the peoples' rights. You get to see Warren Beatty (Reed) moon over Communist theory while justifying murder and genocide in the name of humanitarianism. Weee! At the end he wonders: "Was all the killing worth it?" That's a real bit of editorial license. The real Reed had no doubts and was a true believer in Lenin's bloody tactics to the end. One of the finest of Hollywood's love notes to murderous Communist dogma.
average / annoying
onepotato22 January 2008
I last saw this more than 15 years ago. When I resurrected it for evidence that it's actually good (after reading a superlative review of it on another site) I wasn't surprised by what I saw. It's exactly what I recall. A series of so many cute scenes that a viewers teeth begin to hurt. For the life of me I'll never understand what a pretty-boy like Beatty saw in the life of Reed, that drove him for a decade to research and write this movie. It's bewildering – and the answer is not on screen. What I will say for Beatty is that he had a lot of courage to push, and produce a bio of Jack Reed, and get it made in Hollywood. No one would attempt this in today's economic and political climate. And no one would anticipate that 20 years after Splendor in the Grass he'd even be interested in anything this ambitious and political. The effort is respectable even if the achievement is complete mediocrity. Regardless of any viewers politics, being in Russia in 1917 must have been an extremely exciting environment.
Having said that... Beatty proceeds through this as if he's to be congratulated for being a pretty boy who discovered intellectual life. But he's a dabbler, and his looks are his curse - he always falls back on superficiality/cuteness; his own, puppies, the writing, the manufactured plot points. His keen directors insight boils down to "I'll be cute here, I'll say something cute here, You be cute here, We'll cut away to something cute, then I'll burn dinner, then we'll cut to the dog, then I'll bump my head on the chandelier…" One constantly yearns to view an adult, which makes Emma Goldman's (Maureen Staleton) small bits a welcome break. Reds may be better than the aimless Dr. Zhivago. But as with Frida, I'm not really sure who the audience is, for a terminally cute version of the Jack Reed story.
REDS is formless. Beatty takes an entire revolution and makes it the backdrop to a Harlequin romance. It's three hours of indistinguishable bickering between Keaton and Beatty, interrupted occasionally by communist adversaries bickering. Cue the next frozen shot of Diane Keaton, looking red-eyed and phlegmatic. All Warren seems to want to tell us is that Reed was a swell guy and got laid a lot, like him.
He time-travels back to Russia with his 1980s hair and his late 20th century "very sensitive man of the 80s" thing in place. Reed has already been feminized to an absurd degree, when Beatty goes over the top and puts him in an apron, cooking Louise a birthday dinner. Well if you can imagine, he burns everything, and my goodness, it's some real hilarity... yeah, maybe if this was 1950. This is like making a sci-fi movie in 1930 and insisting that the aliens do the Charleston. It's so overconventionalized that I've always assumed about 80 percent of it is made up to give Beatty regular star moments. The witnesses are an interesting idea, but their only purpose is to make a very superficial movie feel a little weightier.
Keaton in 'confident' mode is about as believable as Bette Davis doing 'demure.' Reed was a forceful figure, but Beatty can't get out of 'false modesty' mode. And his false modesty is a tiresome thing. Beatty just cannot act. It's just a catalog of his tics again. He can't cry, like he couldn't in Shampoo. And if I have to watch him do that midsentence acknowledgment/bullsh1t smile to someone offscreen one more time, I'll give him a revolution. On top of that, Beatty's looks are starting to go, and to salve his ego the make-up team is struggling to make him look like himself at twenty, not to look his age.
REDS is the kind of movie that a viewer who doesn't want to have to defend his praise prefers. I mean clearly, look at the screen! It must be important, right? Characters have been to 4 countries already. Politics are being discussed. Things are exploding. Money has been spent. People look angry, etc. But it's just the kind of ambitious, technically respectable 'production' that it's unfashionable for critics to pan.
It's unfortunate that people rate this low because it's about "a Commie." Communism failed after the movie, and it's failing in the movie's finale. So it's either about a historical person, or it's about an idealist. The real problem is that it's an annoying, amateurish movie about an idealist. Other complaints are about the length. There's no excuse for that. Read your DVD box when you rent a movie.
This review is written by someone who's seen it enough to be very tired of it's wall-to-wall, shallow schmaltz. So if you haven't seen it, you probably should. Judge for yourself. I find it to be a consumable throwaway. It has no depth, despite efforts to convince you otherwise. In the end you know a little about Jack Reed and you've felt some very manufactured feelings. I seriously doubt I could find more than a couple minutes of merit in this.
Warren Beatty's Communist Baby
evanston_dad27 January 2017
"Reds" was Warren Beatty's ambitious passion project of 1981, the film that was supposed to clean up at the Oscars that year. The Academy ended up being fairly cool toward it, giving it only three awards out of 12 nominations, but it did finally recognize Beatty for his balls if nothing else by giving him the Best Director Oscar.
It's a good film that holds up well, even if it can be a bit dry at times. Beatty (Oscar nominated) is compelling as Communist revolutionary John Reed, who worked tirelessly to bring a Socialist revolution to America, but he's outshone in the acting department by Diane Keaton (also Oscar nominated), who gets a chance to shed her Woody Allen persona and prove what a good dramatic actress she could be. I could have done with less of the domestic squabbling that drags down the middle part of the film, and found the parts detailing the couple's experiences in Russia to be the most engrossing. The movie has a whopper of a running time (3 and a half hours) but even at the slower parts I never felt especially impatient with its length.
Maureen Stapleton won an Oscar for her fiery performance as Emma Goldman, and Vittorio Storaro won his second Oscar for cinematography (bookended by his work on "Apocalypse Now" and "The Last Emperor"). The film's other nomination were for Best Picture, Best Actor (Beatty), Best Supporting Actor (Jack Nicholson, never especially convincing as playwright Eugene O'Neill), Best Original Screenplay, Best Art Direction, Best Costume Design, Best Film Editing, and Best Sound. Alas, no nomination for Stephen Sondheim who provided the original score.
Incidentally, "Reds" became the 13th and last film to win Oscar nominations in all four acting categories until David O. Russell added back to back films number 14 and 15 with "Silver Linings Playbook" and "American Hustle." He's the only director to achieve that feat two years in a row.
One of the 10 best American films
ese19426 May 2000
A fascinating, expertly made look at why "The Red Menace" never was that, here in the United States, and why the Russian Revolution never turned out to be what it could have been.
Technically, the movie is beautiful to look at, well written and well acted. It has a lot of great professional actors in it, and lots of the people who were actually there at the time this part of our history was being made. The "witnesses" device works well for Warren Beatty who as a director and writer always seems to include the easily overlooked details of the stories in most of his films. He is also at his fumbling best as John Reed, whose 10 Days That Shook The World fell into well-deserved obscurity probably almost as soon as it was written. That this great historical perspective could rise out of that is truly a testimony to Beatty's talent.
There are many great acting performances in this film, including one of Jack Nicholson's very best as Eugene O'Neil, as well as those of Paul Sorvino, Gene Hackman and George Plimpton who demonstrate the range of persons who touched Jack Reed's life. Jerzy Kozinsky is riveting as Zinoviev.
If one likes historically based dramas, this one should leave you breathless, and will probably leave you wanting to watch it more than once, just to make sure you don't miss any of the details.
10 Stars, Absolutely.
Beatty's masterpiece.
Mr Jason21 May 2002
'Reds' is one of the finest American films ever made- it is the film that Beatty worked towards from 'Bonnie & Clyde'; tellingly he would not make another film until the excerable 'Ishtar' (which was probably more fun to make than watch).
This film feels like a cross between David Lean ('Dr Zhivago' & 'Lawrence of Arabia' from his oeuvre) and Oliver Stone (in 'Nixon' mode). As with 'Bonnie & Clyde' the right music has been picked for the soundtrack- 'The Internationale' & Keaton's take of '...In my Yard' standout (though the score is taken from Sondheim, with contributions by 'Graduate'-composer Dave Gruisin). The film is brilliantly shot by the great Vittorio Storaro- who uses the same huge talent as he did on Bertolucci's 'Il Conformista' & Coppola's 'Apocalypse Now Redux'. Trevor Griffiths co-wrote this film- though there were contributions from a variety of historians- most notably Robert Rosenstone.
Fans of the film should consult Rosenstone's biography of John Reed ('Romantic Revolutionary') and his chapter on his involvement with and objections to elements in 'Reds' in the book 'Visions of the Past'. This Biopic is an interpretation of a life- as with films like 'Patton' it takes a rather small period of the protaganists total life experience- running from roughly 1914 to Reed's death from typhus in 1920. The film charts Reed's major experiences- his coverage of the First World War and the Mexican War of 1916 is shown- though the major achievments are his ventures into the complexities of American Socialism and American-Communism and his eventual experience in Russia/Soviet Union. The main aspect, the stalwart element throughout the film is his love affair with Louise Bryant- which is where the film begins and ends. Rosenstone believes this may have been a concession to Hollywood audience- but I think it puts the human and greater-backdrop into context.
'Visions of the Past' censures much of Beatty's "twists of truth" and the filmic conventions of compression and dramatic-symbolistic interpretation. This is not a documentary and this is not the actual John Reed. This is a biopic film, starring Warren Beatty playing 'John Reed'. If you want to read about the real thing- try 'Romantic Revolutionary' and Reed's masterpiece 'Ten Days That Shook the World' (which, ironically, came in for criticism regarding Reed's fictionalisation of the events of the Russian Revolution!- see the introduction to the Penguin edition by AJP Taylor). Remember historians have a vested interest in their interpretation- which by placing into lineal order in a history (non-fiction) book they are placing into a narrative form.
Beatty and Keaton are great in this film- with brilliant support from Gene Hackman,Jack Nicholson, Paul Sorvino & Maureen Stapleton. We see the John Reed on-screen move from Jack Reed journalist to John Reed idealist- the only American to be buried within the walls of the Kremlin.
Various anti-commies have objected to this film as it depicts Communism- well, at the time, this development from Marx/Engels 1848 Manifesto seemed liberating. Many intellectuals pondered on a new collective, non-Capitalist world- which was sadly a utopia that was unattainable. The Russian experiment failed- Beatty alludes to the flaws and Stalinism in the speech which the Party retranslate towards their own ends towards the end of the film. The Russian Revolution was an ideal- the workers of the world uniting- which considering the treatement meted out by the likes of Henry Ford was a good thing. This message is still relevant- as 'free market Capitalism' means market dominance for Superpowers, poverty for others- the persistence of a constant underclass and the eradication of Union Rights. There are as many flawed ethics to Capitalism as Communism- the arms trade (Reagan/Bush to Hussain, the US-sponsored coup in Chile-Cambodia-El Salvador- a policy which continues up to the failed one last week in Venezuala). Beatty takes the socialist ideals which 'Shampoo' alluded to and which he continued in the satirical 'Bulworth'.
Unlike Attenborough's 'Gandhi', this is not a biopic that is too reverent to its focus- many times Reed is shown to be a clown and it is Bryant's character who undergoes the vaster change- giving this film a strong feminist element. The other stroke of genius is the use of the witnesses- who provide a commentary on the film that sometimes contradict each other- alluding to a multiplicity of truths that overlap (as with Stone's alternate scenarios in 'JFK' & 'Nixon'- they themselves are not true but point out that the truth is relative and the accepted historist take may not be any more "real").
The Oscar people exhibited their usual poor taste again- choosing the yawnworthy 'Chariots of Fire' over this for best picture (well, the year before they chose 'Ordinary People' over 'Raging Bull'- and to this day mediocrity wins that coveted award: 'Forrest Gump', 'Schindler's List', 'Gladiator', 'Braveheart', 'Titanic'). This film has an epic scope- that the worthy Oscar winner 'The English Patient' also exhibited- though both show influence from David Lean. This was a time when Hollywood had ambition and made some great films that may not have set the box-office on fire a la 'Jaws' or 'Star Wars' but made some great works for posterity: 'The Deer Hunter', 'New York New York', 'Raging Bull', 'Heavens Gate' and this. 'Reds' is a masterpiece that should be seen by everyone and desrves to take its place alongside classic works by directors such as John Ford, Howard Hawks and Orson Welles.
25 Years Later, 'Reds' Still Brings History to Life
Larry_L_Peel23 July 2007
In the midst of the Cold War, Warren Beatty set out to bring history to life with an epic tale of the Russian Revolution and the rise of the American Left. After an introduction at this year's 44th New York Film Festival, Beatty's Oscar gold shines through on REDS Silver Anniversary DVD.
Reagan just took the White House, the hostages had just come home from Iran, the Berlin Wall still stood strong, and America had grown tired of the shallow and often gloomy films of the 1970's. The stage was set for a subtle political epic that would pave the way for such films as Gandhi and Chariots of Fire (which beat REDS for the title Best Picture). REDS took the critics by storm and garnered 3 Academy Awards in the process. Twenty-five years later, the film still carries a powerful message of the determination of love, and the dangers of fear.
With the Cold War still raging full strength and America still nursing wounds from the Vietnam Era, Warren Beatty's epic historical drama of the rise of Communism in America may have been a gamble, but with a stellar cast and riding the wave of the success of Heaven Can Wait, the Academy Award winning director brought his dream to life. Beatty co-wrote, produced, directed and starred in the film that not only showcases his political beliefs that the American public unreasonably feared Communism, but also gave voice to his vision and talent as both actor and director. The film garnered more Academy Award nominations – twelve – than any other film in the previous 15 years.
Based on actual events, the film tells the story of John Reed (Beatty), American Communist, activist and journalist, who falls for feminist/writer Louise Bryant (Diane Keaton). Their love affair grows as the world around them unravels in the midst of World War I, the Russian Revolution and Congressional inquests into the American Communist Party. Bryant's love is put to the test when Reed is arrested trying to return to the United States from Russia and she embarks on a treacherous journey to be reunited with him. As the only American entombed in the Kremlin, Reeds impact on both the American Communist movement and the Russian Revolution itself are chronicled in the film. The film deftly utilizes personal interviews with those who actually knew Reed and Bryant, along with a steady pace of drama and romance to completely immerse its audience in the story. Beatty utilizes historic re-enactments and poignant deliveries from his stars – including Maureen Stapleton, who won Best Supporting Actress gold for her role – to create a bond with the characters and hope for their fates.
8 out of 14 found this helpful. Was this review helpful? Sign in to vote.
Pretentious and ineffectual
mnpollio20 April 2011
Warren Beatty's "masterpiece" competes with Raging Bull as the most overrated drama of the 1980s. Critics and Hollywood could not be more effusive in their praise for this staggeringly long epic documenting the life of leftist journalist John Reed and his tempestuous romance with feminist Louise Bryant leading up to the October Revolution.
The politics of the piece are murky at best. Beatty compiled a talented cast and certainly took on material that should have been incredibly interesting. Unfortunately, in his hands, it simply never comes to life. The film cannot seem to figure out whether it is a political piece, a biography or a sweeping romance, and thus fails at all three. Despite the life he led, Reed as played by Beatty is bland and uninvolving. We have no emotional attachment to anything he does and every shot seems determined to depict Beatty as some sort of icon. This must be an affect of Beatty the director as he did this to some extent years later in his rendition of Dick Tracy. Beatty's performance could conceivably have been contributed by a mannequin without much adjustment. Bryant emerges as a more interesting character, but so many of the scenes come off a phony or staged that it becomes impossible to invest too much interest in anyone.
Without a doubt Diane Keaton outacts Beatty. Her Louise Bryant has what should be an amazing passage where she traverses her way across Russia in order to join Reed, but the sequence is directed by Beatty as almost a cliff notes adventure - we get merely the highlights. Perhaps that is just as well because Beatty's film is long-winded enough and seems to have very little to actually say. It's position on Communism is vague and it really gives no compelling reason why the characters populating this landscape are so enamored of it, other than a handful of unconvincing postulations. None of them seem especially passionate about it - but the film is not particularly passionate about Reed or his romance with Bryant either. It is a beautifully photographed mammoth production that seems just there - a sort of earlier day version of The English Patient.
Other than Keaton, Jack Nicholson is good in a rare non-nutball role as Eugene O'Neill. The film won a number of Oscars - including a puzzling one for Beatty's direction. This is indeed fatuous as the film drones on forever, as if Beatty feels that every single frame of film he shot was indispensible. Did no one edit this movie? Beatty recreates a Woody Allen specialty of interspersing the "action" with testimonials from real-life people who knew Reed and Bryant. Unfortunately, very few of these witnesses have anything of worth to contribute about either character. One old lady rambles on forever about Bryant having borrowed her coat and never giving it back. Did anyone really think these anecdotes were especially revealing that they had to be included in a film already bloated in its running time and self-importance?
The other puzzling Oscar comes from Maureen Stapleton's Best Supporting Actress turn as anarchist Emma Goldman. I have nothing against Stapleton as an actress, but this selection is indefensible. We learn absolutely nothing about Goldman. Stapleton has three very brief scenes in the whole film: one where she disagrees with Keaton at a table that lasts maybe a moment, another where she stands next to Beatty at a demonstration and utters maybe one line, and her last moment where she exchanges maybe three lines with Keaton after her excursion across Russia. None of these three moments have any big emotions to play, we really have no idea who this Emma Goldman is and if one blinked or went to the restroom at the wrong moments, you would not even be aware that Stapleton was in the film. And she won a Best Supporting Actress Oscar for this? Really? Really!
Incredibly long and boring tale of Communist sympathizers
roghache21 April 2006
This takes the prize for me as surely one of the most boring movies of all time. Though it's many years since I have seen it, its extreme length and astonishing tedium have remained fresh in my mind for decades.
Back in the early 1980's, I went to the theatre fully expecting to be impressed by the movie. It is based on the true life story of an American journalist, Jack Reed, who travels to Russia to cover the October Revolution of 1917, accompanied by his adoring feminist lover, Louise Bryant. She is a writer who previously has left her husband for Reed after becoming mesmerized by him at one of his lectures. The pair hope to lead a similar revolution back in the U.S. Reed founded the American Communist Party and was in fact eventually buried at the Kremlin wall.
The acting is not the cause of my distaste for the movie as competent stars, Warren Beatty and Diane Keaton, play the lead roles. Other cast members include Maureen Stapleton, Gene Hackman, and Jack Nicholson as famous playwright Eugene O'Neill, who forms a third party in the love triangle with Reed & Bryant. (Reed becomes too wrapped up in his cause, so Bryant leaves him to live with O'Neill for awhile.) As far as I'm concerned, there's too much dull depiction of the bohemian lifestyle of this Greenwich Village intelligentsia, most of whom never put in an honest day's work in their lives. Much better to focus on the REAL workers in both countries, Russia & the States. The characters are neither sympathetic nor even very interesting, the radical feminist Bryant, who initially feels trapped in her respectable married life, unlikely to elicit much concern from me. As for her romance with Reed, it's about as dull as dishwater.
I'm no Communist but have no extreme political ideologies that would turn me off the story. Perhaps a two hour documentary on Communist & Socialist American ideologies in the early 20th Century might have been informative. There are some real life interviews included, best to have kept it all a realistic documentary. However, here they over glamorize the misguided Reed's character, and he's certainly no hero as I see it. As far as Warren Beatty is concerned, it does seem a little ironic (as another also noted) that a wealthy actor is making a movie idealizing a Communist sympathizer. At least the film does eventually imply that the Russian people were duped by Lenin's promises of Communism, and Emma Goldman (Stapleton's character) even suggests that the system cannot work in practice.
Given the drama of the Bolshevik Revolution, this film promised to be totally engaging, but in fact as another reviewer commented and strange as it would appear, this comes across as a movie where nothing ever happens...though you keep hoping it might. It's an epic of nothingness. As I see it, this film is best described as approximately four hours too long. Surely it was at least four hours; it seemed twenty. If you want romance & the Russian Revolution, watch that genuine classic, Doctor Zhivago, a true epic.
Most overrated movie of all time...a tedious bore to watch for three hours...
Doylenf10 September 2005
Except for technical brilliance in photography and settings, this is possibly the most boring of all the epic movies to come out of the Hollywood mill. Not only is it difficult to praise the storyline, which wanders all over the place and never gives you time to sympathize or care about the characters, but the film is overbloated with dull scenes and some ludicrous casting. Jack Nicholson as Eugene O'Neill??? Give me a break.
Warren Beatty is at his most obnoxious throughout and Diane Keaton makes a most unattractive co-star in a bland and underwritten role as his adoring sweetheart. Unlike another tale told against the Russian revolution, DR. ZHIVAGO, this film seems claustrophobic from beginning to end, darkly lit interiors and muted color giving it all a very dull finish.
How the Academy voters got so excited over this one, I'll never understand. It's one of those films where, by the time "The End" flashes on the screen, you're ready to breathe a sigh of relief that the whole impossible thing is over. Sorry, but this is about as atrocious a piece of film-making as I've ever witnessed. Hard to see how anyone can enjoy this film who does not come to it with a complete background in the history of Russia during a time of great upheaval. Even then, it is a clumsy piece of work that seems to have been created to puff up the overwhelming ego of its star/director who obviously thought he was creating another CITIZEN KANE.
7 Get Best Cinematography winners
Political Films & Series
Jack Nicholson films: Best to Worst
Retro / Noir

redpajama_set_name: RedPajamaCommonCrawl


Ken Bakely is the founder, editor, and webmaster of filmreviews12.com. He's a student based in South Jersey, who took reviewing up as a hobby one fateful summer day in 2012. Regardless of when you're asking, he is in the process of desperately attempting to absolve responsibility for anything he wrote earlier than three weeks ago. Ken is a member of the Online Film Critics Society, and has written for a number of other publications, including On This Day in Film (now defunct), Audiences Everywhere (now defunct), and Film Pulse. He can be seen sharing his thoughts on the latest industry developments every week in the Indiewire Critic Survey, and can be can be heard every month on the podcast Saved by the '90s.
Bret Walker is an avid movie viewer and amateur reviewer. Always a fan of the obscure and eclectic, he and a friend started the Really, Really Bad Film Club at Rutgers University (Camden) in 1988. He also made his share of bad films under the guise of the film production company Experimental Films from 1988 to 1992. From 1998 to 2001 he ran a website called "The People's Reviews," on which he and his wife Erin posted over 100 movie reviews, many of which can be found here. These days, Bret is a Methodist pastor in Salem County, New Jersey, but has not lost his love of film – both good and bad. He is a fan of Golden Age musicals, action, sci-fi, horror, documentary and indie films, but especially low-budget schlock films.