正式发布python版本年份_关于python:公元1000年(及其他年份)是a年吗?

如果Y可以被4整除,则Y年是a年。

不等于100,或者

分别为100和400

以下来源遵循上述规则:

Python(calendar.monthrange(1000,2)的输出是(5,28))

webconversiononline.com

但是,以下消息来源说1000年是a年:

Linux cal(命令cal 2 1000显示29天)

timeanddate.com

格里高利制于1582年引入,上面的规则显然开始适用(在1582年之前,唯一的要求是4除以完美除法)。 但是,测试其他几个年份的值(100、500、600、700、900、1100、1300、1400、1500和1700)表明,只有在1800年之后(包括1800年),Python和Linux cal的结果才会一致。

为什么这些资料来源给出不同的答案?

calendar模块使用多用公历。

从calendar文档:

Most of these functions and classes rely on the datetime module which

uses an idealized calendar, the current Gregorian calendar extended in

both directions. This matches the definition of the"proleptic

Gregorian" calendar in Dershowitz and Reingold’s book"Calendrical

Calculations", where it’s the base calendar for all computations.

从维基百科:

The proleptic Gregorian

calendar

is produced by extending the Gregorian calendar backward to dates

preceding its official introduction in 1582.

朱利安历法在单个日期没有被公历代替。 各国在不同的时间采用了它。

从我(相当古老)的计算机上的Linux cal手册页中:

-s -file ... -country_code

Assume the switch from Julian to Gregorian Calendar at the date

associated with the country_code If not specified, ncal tries to guess

the switch date from the local environment or falls back to September

2, 1752. This was when Great Britain and her colonies switched to the

Gregorian Calendar.

[...]

BUGS

The assignment of Julian–Gregorian switching dates to country codes is

historically naive for many countries.

Python使用这种幼稚的方法来leap年似乎是不幸的,但是情况可能更糟...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值