Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 92481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:11:37+00:00 2026-05-10T23:11:37+00:00

I have an rrule instance e.g. r = rrule(WEEKLY, byweekday=SA, count=10, dtstart=parse(‘20081001’)) where dtstart

  • 0

I have an rrule instance e.g.

     r = rrule(WEEKLY, byweekday=SA, count=10, dtstart=parse('20081001')) 

where dtstart and byweekday may change.

If I then want to generate the ten dates that follow on from this rrule, what’s the best way of doing it? Can I assign a new value to the _dtstart member of r? That seems to work but I’m not sure.

e.g.

     r._dtstart = list(r)[-1] or something like that 

Otherwise I guess I’ll create a new rrule and access _dtstart, _count, _byweekday etc. of the original instance.

EDIT:

I’ve thought about it more, and I think what I should be doing is omitting the ‘count’ argument when I create the first rrule instance. I can still get ten occurrences the first time I use the rrule

instances = list(r[0:10])  

and then afterwards I can get more

more = list(r[10:20])  

I think that solves my problem without any ugliness

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:11:38+00:00Added an answer on May 10, 2026 at 11:11 pm

    Firstly, r._dtstart = list(r)[-1] will give you the last date in the original sequence of dates. If you use that, without modification, for the beginning of a new sequence, you will end up with a duplicate date, i.e. the last date of the first sequence will be the same as the first date of the new sequence, which is probably not what you want:

    >>> from dateutil.rrule import * >>> import datetime  >>> r = rrule(WEEKLY, byweekday=SA, count=10, dtstart=datetime.datetime(2008,10,01)) >>> print list(r) [datetime.datetime(2008, 10, 4, 0, 0), datetime.datetime(2008, 10, 11, 0, 0), datetime.datetime(2008, 10, 18, 0, 0), datetime.datetime(2008, 10, 25, 0, 0), datetime.datetime(2008, 11, 1, 0, 0), datetime.datetime(2008, 11, 8, 0, 0), datetime.datetime(2008, 11, 15, 0, 0), datetime.datetime(2008, 11, 22, 0, 0), datetime.datetime(2008, 11, 29, 0, 0), datetime.datetime(2008, 12, 6, 0, 0)] >>> r._dtstart = r[-1] >>> print list(r) [datetime.datetime(2008, 12, 6, 0, 0), datetime.datetime(2008, 12, 13, 0, 0), datetime.datetime(2008, 12, 20, 0, 0), datetime.datetime(2008, 12, 27, 0, 0), datetime.datetime(2009, 1, 3, 0, 0), datetime.datetime(2009, 1, 10, 0, 0), datetime.datetime(2009, 1, 17, 0, 0), datetime.datetime(2009, 1, 24, 0, 0), datetime.datetime(2009, 1, 31, 0, 0), datetime.datetime(2009, 2, 7, 0, 0)] 

    Furthermore, it is considered poor form to manipulate r._dtstart as it is clearly intended to be a private attribute.

    Instead, do something like this:

    >>> r = rrule(WEEKLY, byweekday=SA, count=10, dtstart=datetime.datetime(2008,10,01)) >>> r2 = rrule(WEEKLY, byweekday=SA, count=r.count(), dtstart=r[-1] + datetime.timedelta(days=1)) >>> print list(r) [datetime.datetime(2008, 10, 4, 0, 0), datetime.datetime(2008, 10, 11, 0, 0), datetime.datetime(2008, 10, 18, 0, 0), datetime.datetime(2008, 10, 25, 0, 0), datetime.datetime(2008, 11, 1, 0, 0), datetime.datetime(2008, 11, 8, 0, 0), datetime.datetime(2008, 11, 15, 0, 0), datetime.datetime(2008, 11, 22, 0, 0), datetime.datetime(2008, 11, 29, 0, 0), datetime.datetime(2008, 12, 6, 0, 0)] >>> print list(r2) [datetime.datetime(2008, 12, 13, 0, 0), datetime.datetime(2008, 12, 20, 0, 0), datetime.datetime(2008, 12, 27, 0, 0), datetime.datetime(2009, 1, 3, 0, 0), datetime.datetime(2009, 1, 10, 0, 0), datetime.datetime(2009, 1, 17, 0, 0), datetime.datetime(2009, 1, 24, 0, 0), datetime.datetime(2009, 1, 31, 0, 0), datetime.datetime(2009, 2, 7, 0, 0), datetime.datetime(2009, 2, 14, 0, 0)] 

    This codes does not access any private attributes of rrule (although you might have to look at _byweekday).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 125k
  • Answers 125k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer For me, the greatest learning experience was analyzing the source… May 12, 2026 at 5:08 am
  • Editorial Team
    Editorial Team added an answer I'm pretty sure that if your Info.plist file has the… May 12, 2026 at 5:08 am
  • Editorial Team
    Editorial Team added an answer I'm looking for something similar - came across this site… May 12, 2026 at 5:08 am

Related Questions

I have an rrule instance e.g. r = rrule(WEEKLY, byweekday=SA, count=10, dtstart=parse('20081001')) where dtstart
I have a group of text based rules that are structured like this: Rule
I'm currently working on an asp.net-mvc content management system. It would be incredibly useful
Using php5.2 and MySQL 4.1.22 I've come across something that, at first, appeared simple
So yeah, I'm a Java guy in this crazy iPhone world. When it comes

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.