Skip to content

Commit 0ac786f

Browse files
Special object for missing first argument
1 parent a334eab commit 0ac786f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pandas/tslib.pyx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ cdef inline bint _is_fixed_offset(object tz):
216216

217217

218218
_zero_time = datetime_time(0, 0)
219+
_no_input = object()
219220

220221
# Python front end to C extension type _Timestamp
221222
# This serves as the box for datetime64
@@ -230,7 +231,7 @@ class Timestamp(_Timestamp):
230231
keyword.
231232
232233
Parameters
233-
-----------------
234+
----------
234235
ts_input : datetime-like, str, int, float
235236
Value to be converted to Timestamp
236237
offset : str, DateOffset
@@ -240,7 +241,7 @@ class Timestamp(_Timestamp):
240241
unit : string
241242
numpy unit used for conversion, if ts_input is int or float
242243
243-
The other two forms copy the parameters from datetime.datetime. They can
244+
The other two forms mimic the parameters from datetime.datetime. They can
244245
be passed by either position or keyword, but not both mixed together.
245246
246247
:func:`datetime.datetime` Parameters
@@ -310,7 +311,7 @@ class Timestamp(_Timestamp):
310311
return cls(datetime.combine(date, time))
311312

312313
def __new__(cls,
313-
object ts_input=None, object offset=None, tz=None, unit=None,
314+
object ts_input=_no_input, object offset=None, tz=None, unit=None,
314315
year=None, month=None, day=None,
315316
hour=None, minute=None, second=None, microsecond=None,
316317
tzinfo=None):
@@ -328,14 +329,14 @@ class Timestamp(_Timestamp):
328329
# that the second argument is an int.
329330
# - Nones for the first four (legacy) arguments indicate pydatetime
330331
# keyword arguments. year, month, and day are required. As a
331-
# shortcut, we just check that the first argument is None.
332+
# shortcut, we just check that the first argument was not passed.
332333
#
333334
# Mixing pydatetime positional and keyword arguments is forbidden!
334335

335336
cdef _TSObject ts
336337
cdef _Timestamp ts_base
337338

338-
if ts_input is None:
339+
if ts_input is _no_input:
339340
# User passed keyword arguments.
340341
return Timestamp(datetime(year, month, day, hour or 0,
341342
minute or 0, second or 0, microsecond or 0, tzinfo),

0 commit comments

Comments
 (0)