4 ms·
Well this code is in Scala, not Java. Python doesn't have a library like the Stanford Datetime parser that can convert a phrase such as 'day after tomorrow' to
by deepGem 10y ago
Well this code is in Scala, not Java. Python doesn't have a library like the Stanford Datetime parser that can convert a phrase such as 'day after tomorrow' to the actual date. I understand that Writing Java is hard simply because of the amount of code you have to write. Scala is a good compromise.
- sixhobbits 10y agoOn the contrary, last time I needed to parse natural dates in Python I got confused because there are dozens of libraries that do exactly this. One example: >>> from parsedatetime import Calendar >>> cal = Calendar() >>> cal.parse("The day after tomorrow") (time.struct_time(tm_year=2016, tm_mon=10, tm_mday=3, tm_hour=9, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=277, tm_isdst=-1), 1) Yes I've used Java equivalents before and they're impressive, but I don't think Python is inferior in this regard. For me, the advantage of Python is mainly being able to easily run small sections of project code in an IPython shell while developing that make the development workflow so much faster and more pleasant, rather than the quantity of code.
- deepGem 10y agoThanks for pointing this out. We missed this during our comparison studies.
- sixhobbits 10y agoLooks like the output I pasted is actually wrong though so maybe I spoke too soon.